97 lines
5.6 KiB
C#
97 lines
5.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Results;
|
|
using Kendo.Mvc.UI;
|
|
using Kreta.BusinessLogic.Classes.ComboBox;
|
|
using Kreta.BusinessLogic.HelperClasses;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.BusinessLogic.Utils;
|
|
using Kreta.Enums;
|
|
using Kreta.Framework.Util;
|
|
using Kreta.Resources;
|
|
using Kreta.Web.Areas.Tantargy.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Helpers.Error;
|
|
using Kreta.Web.Security;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Kreta.Web.Areas.Tantargy.ApiControllers
|
|
{
|
|
[ApiRoleClaimsAuthorize(true)]
|
|
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
|
public class TantargyFelosztasApiController : BaseTantargyFelosztasApiController
|
|
{
|
|
[HttpGet]
|
|
public HttpResponseMessage ExportLepedoOsztalyTantargyfelosztas(string data, bool isFromSzervezet = false)
|
|
{
|
|
try
|
|
{
|
|
var model = JsonConvert.DeserializeObject<TantargyFelosztasModel>(data);
|
|
|
|
var memoryStream = new BusinessLogic.Classes.ExcelHelpers.TTFExportHelper(ConnectionTypeExtensions.GetSessionConnectionType()).ExportLepedoOsztalyTTF(model.SearchTanar, model.SearchOsztalCsoport, model.SearchTantargy, targyKatId: null, evfolyamId: model.SearchEvfolyam, foglalkozasTipusId: model.SearchFoglalkozasTipusa, feladatKategoriaId: model.SearchFeladatKategoriaId, feladatellatasiHelyId: model.SearchFeladatellatasihely, oraszam: model.SearchOraszam, isImportalt: null, osztalybontasokkal: model.Osztalybontasokkal, kapcsolodoCsoportokkal: model.KapcsolodoCsoportokkal, isFromSzervezet: model.IsFromSzervezet);
|
|
|
|
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), $"{ClaimData.IntezmenyAzonosito}_{TantargyResource.Tantargyfelosztas_Export}_{DateTime.Now:yyyy_MM_dd}.xlsx");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
public HttpResponseMessage ExportLepedoTantargyfelosztas(string data)
|
|
{
|
|
try
|
|
{
|
|
var model = JsonConvert.DeserializeObject<TantargyFelosztasModel>(data);
|
|
|
|
var memoryStream = new BusinessLogic.Classes.ExcelHelpers.TTFExportHelper(ConnectionTypeExtensions.GetSessionConnectionType()).ExportLepedoTTF(model.SearchTanar, model.SearchOsztalCsoport, model.SearchTantargy, targyKatId: null, evfolyamId: model.SearchEvfolyam, foglalkozasTipusId: model.SearchFoglalkozasTipusa, feladatKategoriaId: model.SearchFeladatKategoriaId, feladatellatasiHelyId: model.SearchFeladatellatasihely, oraszam: model.SearchOraszam, isImportalt: null, osztalybontasokkal: model.Osztalybontasokkal, kapcsolodoCsoportokkal: model.KapcsolodoCsoportokkal, isFromSzervezet: model.IsFromSzervezet);
|
|
|
|
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), $"{ClaimData.IntezmenyAzonosito}_{TantargyResource.Tantargyfelosztas_Export}_{DateTime.Now:yyyy_MM_dd}.xlsx");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
public HttpResponseMessage ExportEgyszeruTantargyfelosztas(string data)
|
|
{
|
|
try
|
|
{
|
|
var model = JsonConvert.DeserializeObject<TantargyFelosztasModel>(data);
|
|
|
|
var memoryStream = new BusinessLogic.Classes.ExcelHelpers.TTFExportHelper(ConnectionTypeExtensions.GetSessionConnectionType()).ExportEgyszeruTTF(model.SearchTanar, model.SearchOsztalCsoport, model.SearchTantargy, targyKatId: null, evfolyamId: model.SearchEvfolyam, foglalkozasTipusId: model.SearchFoglalkozasTipusa, feladatKategoriaId: model.SearchFeladatKategoriaId, feladatellatasiHelyId: model.SearchFeladatellatasihely, oraszam: model.SearchOraszam, isImportalt: null, osztalybontasokkal: model.Osztalybontasokkal, kapcsolodoCsoportokkal: model.KapcsolodoCsoportokkal, isFromSzervezet: model.IsFromSzervezet);
|
|
|
|
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), $"{ClaimData.IntezmenyAzonosito}_{TantargyResource.Tantargyfelosztas_Export}_{DateTime.Now:yyyy_MM_dd}.xlsx");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
|
}
|
|
}
|
|
|
|
public IntezmenyCO GetIntezmenyAdatok() => new IntezmenyHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetIntezmenyiAdatok();
|
|
|
|
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
|
public JsonResult<List<ComboBoxListItem>> GetEvfolyamok([DataSourceRequest] DataSourceRequest request)
|
|
{
|
|
List<ComboBoxListItem> items = ((int)GeneratedAdatszotarTipusEnum.EvfolyamTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList();
|
|
|
|
return Json(items);
|
|
}
|
|
|
|
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
|
public JsonResult<List<ComboBoxListItem>> GetFoglalkozasTipusok([DataSourceRequest] DataSourceRequest request)
|
|
{
|
|
List<ComboBoxListItem> items = ((int)GeneratedAdatszotarTipusEnum.FoglalkozasTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList();
|
|
|
|
return Json(items);
|
|
}
|
|
}
|
|
}
|