init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,199 @@
|
|||
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.Enums.ManualEnums;
|
||||
using Kreta.Framework.Entities;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class EnaploAdatszolgaltatasApiController : ApiController
|
||||
{
|
||||
public EnaploAdatszolgaltatasModel GetEnaploAdatszolgaltatas()
|
||||
{
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
var co = helper.GetEnaploAdatszolgaltatas();
|
||||
|
||||
return Convert_CO_to_Model(co);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveModifiedOrNewEnaploAdatszolgaltatas(EnaploAdatszolgaltatasModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
AdatszolgaltatasokHelper h = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
EnaploAdatszolgaltatasCO co = Convert_Model_to_CO(model);
|
||||
if (model.ID.HasValue && model.ID > 0)
|
||||
{
|
||||
h.InsertorUpdateEnaploAdatszolgaltatasCO(co, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
h.InsertorUpdateEnaploAdatszolgaltatasCO(co, false);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage RemoveSzerzodes()
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
helper.DeleteSzerzodesFile();
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (EntityDeleteFailedException ex)
|
||||
{
|
||||
var uzenet = string.Format(ErrorResource.NemTorolhetoKapcsolatMiatt, AdatszolgaltatasokResource.Szerzodes, ex.ConnectionErrorMessage);
|
||||
throw new StatusError(HttpStatusCode.BadRequest, uzenet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private EnaploAdatszolgaltatasModel Convert_CO_to_Model(EnaploAdatszolgaltatasCO co)
|
||||
{
|
||||
EnaploAdatszolgaltatasModel model = new EnaploAdatszolgaltatasModel()
|
||||
{
|
||||
ID = co.ID,
|
||||
HasznalENaplot = EncodeIgenNemSelector(co.HasznalENaplot),
|
||||
HasznalPapirNaplot = EncodeIgenNemSelector(co.HasznalPapirNaplot),
|
||||
HasznalEEllenorzot = EncodeIgenNemSelector(co.HasznalEEllenorzot),
|
||||
ENaploTipus = co.ENaploTipus,
|
||||
ENaploInfra = co.ENaploInfra,
|
||||
ForrasTipusa = co.ForrasTipusa,
|
||||
SzerzodesOsszege = co.SzerzodesOsszege,
|
||||
SzerzodoNeve = co.SzerzodoNeve,
|
||||
SzerzodoPozicio = co.SzerzodoPozicio,
|
||||
SzerzodesKezdete = co.SzerzodesKezdete,
|
||||
SzerzodesVege = co.SzerzodesVege,
|
||||
VanHonlap = EncodeIgenNemSelector(co.VanHonlap),
|
||||
HonlapUrl = co.HonlapUrl
|
||||
};
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
private EnaploAdatszolgaltatasCO Convert_Model_to_CO(EnaploAdatszolgaltatasModel model)
|
||||
{
|
||||
EnaploAdatszolgaltatasCO co = new EnaploAdatszolgaltatasCO();
|
||||
|
||||
co.ID = model.ID;
|
||||
|
||||
if (model.HasznalENaplot.HasValue && model.HasznalENaplot == (int)IgenNemEnum.Nem)
|
||||
{
|
||||
co.HasznalENaplot = DecodeIgenNemSelector(model.HasznalENaplot);
|
||||
return co;
|
||||
}
|
||||
else if (model.HasznalENaplot.HasValue && model.HasznalENaplot == (int)IgenNemEnum.Igen)
|
||||
{
|
||||
co.HasznalENaplot = DecodeIgenNemSelector(model.HasznalENaplot);
|
||||
co.HasznalPapirNaplot = DecodeIgenNemSelector(model.HasznalPapirNaplot);
|
||||
co.HasznalEEllenorzot = DecodeIgenNemSelector(model.HasznalEEllenorzot);
|
||||
|
||||
if (model.ENaploTipus.HasValue && (model.ENaploTipus == (int)ENaploTipusEnum.KRETA || model.ENaploTipus == (int)ENaploTipusEnum.NN))
|
||||
{
|
||||
co.ENaploTipus = model.ENaploTipus;
|
||||
return co;
|
||||
}
|
||||
else
|
||||
{
|
||||
co.ENaploTipus = model.ENaploTipus;
|
||||
co.ENaploInfra = model.ENaploInfra;
|
||||
co.ForrasTipusa = model.ForrasTipusa;
|
||||
co.SzerzodesOsszege = model.SzerzodesOsszege;
|
||||
co.SzerzodoNeve = model.SzerzodoNeve;
|
||||
co.SzerzodoPozicio = model.SzerzodoPozicio;
|
||||
co.SzerzodesKezdete = model.SzerzodesKezdete;
|
||||
co.SzerzodesVege = model.SzerzodesVege;
|
||||
co.VanHonlap = DecodeIgenNemSelector(model.VanHonlap);
|
||||
|
||||
if (model.VanHonlap.HasValue && model.VanHonlap == (int)IgenNemEnum.Igen)
|
||||
{
|
||||
co.HonlapUrl = model.HonlapUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return co;
|
||||
}
|
||||
|
||||
private bool? DecodeIgenNemSelector(int? ertek)
|
||||
{
|
||||
if (ertek == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (ertek == (int)IgenNemEnum.Igen)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private int? EncodeIgenNemSelector(bool? ertek)
|
||||
{
|
||||
if (ertek == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return ertek == true ? (int)IgenNemEnum.Igen : (int)IgenNemEnum.Nem;
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetEnaploTipusok([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
IDictionary<string, string> dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.ENaploTipus, ClaimData.SelectedTanevID.Value, toLower: true);
|
||||
|
||||
return Json(dictionary.ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetEnaploInfra([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
IDictionary<string, string> dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.ENaploInfra, ClaimData.SelectedTanevID.Value, toLower: true);
|
||||
|
||||
return Json(dictionary.ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetEnaploForras([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
IDictionary<string, string> dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.ENaploForras, ClaimData.SelectedTanevID.Value, toLower: true);
|
||||
|
||||
return Json(dictionary.ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetSzerzodoPozicio([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
IDictionary<string, string> dictionary = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.SzerzodoSzemelyPozicio, ClaimData.SelectedTanevID.Value, toLower: true);
|
||||
|
||||
return Json(dictionary.ToComboBoxItemList());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System.Data;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class EslRiportApiController : ApiController
|
||||
{
|
||||
public JsonResult<DataSet> GetLemorzsolodasEslRiportGrid(string data)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<EslRiportModel>(data);
|
||||
if (!model.FeladatellatasiHely.HasValue)
|
||||
{ return Json(new DataSet()); }
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
DataSet ds = helper.GetLemorzsolodasEslRiport(model.FeladatellatasiHely, model.IsFelevi);
|
||||
|
||||
return Json(ds);
|
||||
}
|
||||
|
||||
public JsonResult<DataSet> GetElegtelenEslRiportGrid(string data)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<EslRiportModel>(data);
|
||||
if (!model.FeladatellatasiHely.HasValue)
|
||||
{ return Json(new DataSet()); }
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
DataSet ds = helper.GetElegtelenEslRiport(model.FeladatellatasiHely, model.IsFelevi);
|
||||
|
||||
return Json(ds);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Logic;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class HittanOraszamApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetHittanOraszamGrid(DataSourceRequest request)
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request);
|
||||
|
||||
return modelList.ToDataSourceResult(gridParameter);
|
||||
}
|
||||
|
||||
public DataSourceResult GetHittanOraszamGridForJanuar(DataSourceRequest request)
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request, forJanuar: true);
|
||||
|
||||
return modelList.ToDataSourceResult(gridParameter);
|
||||
}
|
||||
|
||||
private (GridParameters gridParameter, List<HittanOraszamGridModel> modelList) GetGridData(DataSourceRequest request, bool forJanuar = false)
|
||||
{
|
||||
var gridParameter = Converter.GridParameter(request);
|
||||
|
||||
var coList = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetHittanOraszamCoList(forJanuar);
|
||||
|
||||
var modelList = new List<HittanOraszamGridModel>();
|
||||
|
||||
foreach (var co in coList)
|
||||
{
|
||||
var gridModel = new HittanOraszamGridModel(co);
|
||||
modelList.Add(gridModel);
|
||||
}
|
||||
|
||||
return (gridParameter, modelList);
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetExportSzeptemberDecember(DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request);
|
||||
|
||||
return GetExportFile(gridParameter, modelList, AdatszolgaltatasokResource.HittanOraszamSzeptemberDecemberExportSheetName, AdatszolgaltatasokResource.HittanOraszamSzeptemberDecemberExportFileName, ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HttpResponseMessage GetExportJanuarJunius(DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request, forJanuar: true);
|
||||
|
||||
return GetExportFile(gridParameter, modelList, AdatszolgaltatasokResource.HittanOraszamJanuarJuniusExportSheetName, AdatszolgaltatasokResource.HittanOraszamJanuarJuniusExportFileName, ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
|
||||
private HttpResponseMessage GetExportFile(GridParameters gridParameter, List<HittanOraszamGridModel> modelList, string worksheetName, string fileName, int tanevId)
|
||||
{
|
||||
var orderedList = modelList.SortingAndPaging(gridParameter.OrderDictionary);
|
||||
|
||||
var simpleExportColumnCos = SimpleExportLogic.GetSimpleExportColumnCos<HittanOraszamGridModel>(HittanOraszamGridModel.HittanOraszamExportAttributeId);
|
||||
|
||||
var memoryStream = SimpleExportLogic.GetExport(worksheetName, simpleExportColumnCos, orderedList, tanevId);
|
||||
|
||||
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), fileName);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Save(HittanOraszamSaveModel model, bool forJanuar = false)
|
||||
{
|
||||
TanevCO tanevCo;
|
||||
|
||||
var tanev = new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
tanevCo = tanev.GetTanevInfo();
|
||||
|
||||
AdatszolgaltatasokHelper helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
// kezdőnap januárnál záróév január 1, nem januárnál tanév első napja
|
||||
var startDate = forJanuar ? new DateTime(tanevCo.UtolsoNap.Year, 1, 1) : tanevCo.KezdoNap;
|
||||
// végenap januárnál tanév utolsó napja, nem januárnál kezdő év december 31
|
||||
var endDate = forJanuar ? tanevCo.UtolsoNap : new DateTime(tanevCo.KezdoNap.Year, 12, 31);
|
||||
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
foreach (var item in model.oraszamok)
|
||||
{
|
||||
if (errorMsg.Length > 0)
|
||||
{ errorMsg.Append("<br />"); }
|
||||
if (!item.HittanTipusId.HasValue)
|
||||
{
|
||||
errorMsg.Append($"{item.CsoportNev} {AdatszolgaltatasokResource.HittanTipusKotelezo}");
|
||||
}
|
||||
else if (item.Darabszam.HasValue && item.Darabszam.Value < 0)
|
||||
{
|
||||
errorMsg.Append($"{item.CsoportNev} {AdatszolgaltatasokResource.HittanAdatszolgaltatasDarabszamNegativ}");
|
||||
}
|
||||
else if (item.Letszam.HasValue && item.Letszam.Value < 0)
|
||||
{
|
||||
errorMsg.Append($"{item.CsoportNev} {AdatszolgaltatasokResource.HittanAdatszolgaltatasLetszamNegativ}");
|
||||
}
|
||||
else if (item.Darabszam.HasValue && item.Darabszam.Value > 10000)
|
||||
{
|
||||
errorMsg.Append($"{item.CsoportNev} {AdatszolgaltatasokResource.HittanAdatszolgaltatasDarabszamTulNagy}");
|
||||
}
|
||||
else if (item.Letszam.HasValue && item.Letszam.Value > 10000)
|
||||
{
|
||||
errorMsg.Append($"{item.CsoportNev} {AdatszolgaltatasokResource.HittanAdatszolgaltatasLetszamTulNagy}");
|
||||
}
|
||||
else
|
||||
{
|
||||
helper.SaveHittanOraszam(item.Id, item.HittanTipusId.Value, item.Darabszam ?? 0, item.Letszam ?? 0, startDate, endDate, forJanuar);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMsg.Length > 0)
|
||||
throw new StatusError(HttpStatusCode.BadRequest, errorMsg.ToString());
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveForJanuar(HittanOraszamSaveModel model)
|
||||
{
|
||||
return Save(model, forJanuar: true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Web.Areas.Hianyzas.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class IktSzandeknyilatkozatokApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetIktSzandeknyilatkozatokGrid([System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
DataSourceResult result;
|
||||
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
result = helper.GetIktSzandeknyilatkozatokGrid().ToDataSourceResult();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public HttpResponseMessage SaveIktSzandeknyilatkozatok(List<IktSzandeknyilatkozatokSaveModel> list)
|
||||
{
|
||||
var helper = new NyomtatvanyokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.Id != null && item.IsElfogadottSzandeknyilatkozat != null)
|
||||
{
|
||||
helper.UpdateIktSzandeknyilatkozat(item.Id.Value, item.IsElfogadottSzandeknyilatkozat.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class InformatikaiAdatszolgaltatasApiController : ApiController
|
||||
{
|
||||
|
||||
public DataSourceResult GetInformatikaiAdatszolgaltatasGrid([ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var helper = new InformatikaiAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.GridParameters = Converter.GridParameter(request);
|
||||
DataSet ds = helper.GetInformatikaiAdatszolgaltatasGrid();
|
||||
|
||||
return ds.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Save(InformatikaiAdatszolgaltatasRogzitesModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var helper = new InformatikaiAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.Save(ConvertModelToCo(model));
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, InformatikaiAdatszolgResource.HibaAMentesSoran) { UnHandledException = e };
|
||||
}
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
|
||||
public InformatikaiAdatszolgCO ConvertModelToCo(InformatikaiAdatszolgaltatasRogzitesModel model)
|
||||
{
|
||||
var co = new InformatikaiAdatszolgCO();
|
||||
co.AlapszintuAMAktualis = model.AlapszintuAMAktualis;
|
||||
co.AlapszintuAMIgeny = model.AlapszintuAMIgeny;
|
||||
co.BillentyuzetAktualis = model.BillentyuzetAktualis;
|
||||
co.BillentyuzetIgeny = model.BillentyuzetIgeny;
|
||||
co.EgerAktualis = model.EgerAktualis;
|
||||
co.EgerIgeny = model.EgerIgeny;
|
||||
co.EgyebSzoftverAktualis = model.EgyebSzoftverAktualis;
|
||||
co.EgyebSzoftverIgeny = model.EgyebSzoftverIgeny;
|
||||
co.EgyebSzoftverLeiras = model.EgyebSzoftverLeiras;
|
||||
co.FFENAktualis = model.FFENAktualis;
|
||||
co.FFENIgeny = model.FFENIgeny;
|
||||
co.FFTNAktualis = model.FFTNAktualis;
|
||||
co.FFTNIgeny = model.FFTNIgeny;
|
||||
co.InteraktivTablaAktualis = model.InteraktivTablaAktualis;
|
||||
co.InteraktivTablaIgeny = model.InteraktivTablaIgeny;
|
||||
co.IrodaiSzoftverAktualis = model.IrodaiSzoftverAktualis;
|
||||
co.IrodaiSzoftverIgeny = model.IrodaiSzoftverIgeny;
|
||||
co.NotebookAktualis = model.NotebookAktualis;
|
||||
co.NotebookIgeny = model.NotebookIgeny;
|
||||
co.ProfMAktualis = model.ProfMAktualis;
|
||||
co.ProfMIgeny = model.ProfMIgeny;
|
||||
co.ProjektorAktualis = model.ProjektorAktualis;
|
||||
co.ProjektorIgeny = model.ProjektorIgeny;
|
||||
co.ScannerAktualis = model.ScannerAktualis;
|
||||
co.ScannerIgeny = model.ScannerIgeny;
|
||||
co.SzinesENAktualis = model.SzinesENAktualis;
|
||||
co.SzinesENIgeny = model.SzinesENIgeny;
|
||||
co.SzinesTNAktualis = model.SzinesTNAktualis;
|
||||
co.SzinesTNIgeny = model.SzinesTNIgeny;
|
||||
co.TabletAktualis = model.TabletAktualis;
|
||||
co.TabletIgeny = model.TabletIgeny;
|
||||
co.Tervezett3D = model.Tervezett3D;
|
||||
co.TervezettLego = model.TervezettLego;
|
||||
co.VekonykliensAktualis = model.VekonykliensAktualis;
|
||||
co.VekonykliensIgeny = model.VekonykliensIgeny;
|
||||
co.VirusvedelmiAktualis = model.VirusvedelmiAktualis;
|
||||
co.VirusvedelmiIgeny = model.VirusvedelmiIgeny;
|
||||
co.VizualisOMAktualis = model.VizualisOMAktualis;
|
||||
co.VizualisOMIgeny = model.VizualisOMIgeny;
|
||||
|
||||
foreach (var item in model.MukodesiHelyAdatszolgaltatasList)
|
||||
{
|
||||
var adatszolgaltatasCo = new MukodesiHelyAdatszolgaltatasCo
|
||||
{
|
||||
InformatikaOktatasVanNincs = item.InformatikaOktatasVanNincs,
|
||||
InternetFeltoltesiSavszelessege = item.InternetFeltoltesiSavszelessege,
|
||||
InternetLetoltesiSavszelessege = item.InternetLetoltesiSavszelessege,
|
||||
InternetszolgaltatasHaviNettoDija = item.InternetszolgaltatasHaviNettoDija,
|
||||
InternetszolgaltatoNeve = item.InternetszolgaltatoNeve,
|
||||
MukodesiHelyId = item.MukodesiHelyId
|
||||
};
|
||||
co.MukodesiHelyAdatszolgaltatasList.Add(adatszolgaltatasCo);
|
||||
}
|
||||
return co;
|
||||
}
|
||||
|
||||
public InformatikaiAdatszolgaltatasModel ConvertCoToModel(InformatikaiAdatszolgCO co)
|
||||
{
|
||||
return new InformatikaiAdatszolgaltatasModel
|
||||
{
|
||||
AlapszintuAMAktualis = co.AlapszintuAMAktualis,
|
||||
AlapszintuAMIgeny = co.AlapszintuAMIgeny,
|
||||
BillentyuzetAktualis = co.BillentyuzetAktualis,
|
||||
BillentyuzetIgeny = co.BillentyuzetIgeny,
|
||||
EgerAktualis = co.EgerAktualis,
|
||||
EgerIgeny = co.EgerIgeny,
|
||||
EgyebSzoftverAktualis = co.EgyebSzoftverAktualis,
|
||||
EgyebSzoftverIgeny = co.EgyebSzoftverIgeny,
|
||||
EgyebSzoftverLeiras = co.EgyebSzoftverLeiras,
|
||||
FFENAktualis = co.FFENAktualis,
|
||||
FFENIgeny = co.FFENIgeny,
|
||||
FFTNAktualis = co.FFTNAktualis,
|
||||
FFTNIgeny = co.FFTNIgeny,
|
||||
InteraktivTablaAktualis = co.InteraktivTablaAktualis,
|
||||
InteraktivTablaIgeny = co.InteraktivTablaIgeny,
|
||||
IrodaiSzoftverAktualis = co.IrodaiSzoftverAktualis,
|
||||
IrodaiSzoftverIgeny = co.IrodaiSzoftverIgeny,
|
||||
NotebookAktualis = co.NotebookAktualis,
|
||||
NotebookIgeny = co.NotebookIgeny,
|
||||
ProfMAktualis = co.ProfMAktualis,
|
||||
ProfMIgeny = co.ProfMIgeny,
|
||||
ProjektorAktualis = co.ProjektorAktualis,
|
||||
ProjektorIgeny = co.ProjektorIgeny,
|
||||
ScannerAktualis = co.ScannerAktualis,
|
||||
ScannerIgeny = co.ScannerIgeny,
|
||||
SzinesENAktualis = co.SzinesENAktualis,
|
||||
SzinesENIgeny = co.SzinesENIgeny,
|
||||
SzinesTNAktualis = co.SzinesTNAktualis,
|
||||
SzinesTNIgeny = co.SzinesTNIgeny,
|
||||
TabletAktualis = co.TabletAktualis,
|
||||
TabletIgeny = co.TabletIgeny,
|
||||
Tervezett3D = co.Tervezett3D,
|
||||
TervezettLego = co.TervezettLego,
|
||||
VekonykliensAktualis = co.VekonykliensAktualis,
|
||||
VekonykliensIgeny = co.VekonykliensIgeny,
|
||||
VirusvedelmiAktualis = co.VirusvedelmiAktualis,
|
||||
VirusvedelmiIgeny = co.VirusvedelmiIgeny,
|
||||
VizualisOMAktualis = co.VizualisOMAktualis,
|
||||
VizualisOMIgeny = co.VizualisOMIgeny
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
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;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class KozmuszamlaApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetKozmuszamlaGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
KozmuszamlaSearchModel model = JsonConvert.DeserializeObject<KozmuszamlaSearchModel>(data);
|
||||
|
||||
var kozmuszamlaHelper = new KozmuszamlaHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
kozmuszamlaHelper.GridParameters = Converter.GridParameter(request);
|
||||
|
||||
var kozmuszamlaList = kozmuszamlaHelper.KozmuszamlaKereses(model.FizetesiHataridoTolSearch, model.FizetesiHataridoIgSearch, model.IsFizetveSearch, model.KibocsatoSearch, model.KozmuSzamlaTipusIdSearch, model.OsszegTolSearch, model.OsszegIgSearch);
|
||||
return kozmuszamlaList.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetKozmuszamlaTipusList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.KozmuSzamlaTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage SaveKozmuszamla(KozmuszamlaModel model)
|
||||
{
|
||||
ValidateModel(model);
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
KozmuszamlaCO KozmuszamlaCo = ConvertKozmuszamlaModelToCo(model);
|
||||
new KozmuszamlaHelper(ConnectionTypeExtensions.GetSessionConnectionType()).SaveKozmuszamla(KozmuszamlaCo);
|
||||
}
|
||||
catch (KretaError kretaError)
|
||||
{
|
||||
SDAServer.Instance.Logger.ExceptionThrown(kretaError);
|
||||
ModelState.AddModelError("Error", kretaError.Message);
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
var httpResponseMessage = Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
return httpResponseMessage;
|
||||
}
|
||||
|
||||
private KozmuszamlaCO ConvertKozmuszamlaModelToCo(KozmuszamlaModel model)
|
||||
{
|
||||
return new KozmuszamlaCO
|
||||
{
|
||||
Id = model.Id,
|
||||
BefizetesDatuma = model.BefizetesDatuma,
|
||||
FizetesiHatarido = model.FizetesiHatarido,
|
||||
Fizetve = model.Fizetve == 1 || model.BefizetesDatuma.HasValue,
|
||||
InvaliditasOka = model.InvaliditasOka,
|
||||
Kelte = model.Kelte,
|
||||
Kibocsato = model.Kibocsato,
|
||||
KozmuszamlaTipusId = model.KozmuszamlaTipusId,
|
||||
Osszeg = model.Osszeg,
|
||||
PenznemId = model.PenznemId,
|
||||
MerohelyId = model.MerohelyId.Value
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage DeleteKozmuszamla([FromBody] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
new KozmuszamlaHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).DeleteKozmuszamlaById(id);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.InternalServerError,
|
||||
StringResourcesUtil.GetString(4358) /*Hiba történt törlés közben!*/)
|
||||
{
|
||||
UnHandledException = exception
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateModel(KozmuszamlaModel model)
|
||||
{
|
||||
if (model.Kelte.HasValue && model.FizetesiHatarido.HasValue && model.Kelte.Value > model.FizetesiHatarido.Value)
|
||||
{
|
||||
ModelState.AddModelError(nameof(KozmuszamlaModel.Kelte), ErrorResource.SzamlaKelteNemLehetKesobbMintAFizetesiHatarido);
|
||||
}
|
||||
|
||||
if (model.Kelte.HasValue && model.BefizetesDatuma.HasValue && model.Kelte.Value > model.BefizetesDatuma.Value)
|
||||
{
|
||||
ModelState.AddModelError(nameof(KozmuszamlaModel.Kelte), ErrorResource.SzamlaKelteNemLehetKesobbMintABefizetesiDatum);
|
||||
}
|
||||
|
||||
if (model.BefizetesDatuma.HasValue && model.FizetesiHatarido.HasValue && model.BefizetesDatuma.Value > model.FizetesiHatarido.Value)
|
||||
{
|
||||
ModelState.AddModelError(nameof(KozmuszamlaModel.BefizetesDatuma), ErrorResource.BefizetesDatumaNemLehetKesobbMintAFizetesiHatarido);
|
||||
}
|
||||
|
||||
if (model.Fizetve.HasValue && model.Fizetve != default(int) && !model.BefizetesDatuma.HasValue)
|
||||
{
|
||||
ModelState.AddModelError(nameof(KozmuszamlaModel.BefizetesDatuma), ErrorResource.FizetveJelolesEsetenBefizetesDatumaKotelezo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using System.Web.Http.Results;
|
||||
using Kendo.Mvc.Extensions;
|
||||
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.Core.FileService;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class MerohelyApiController : ApiController
|
||||
{
|
||||
private readonly IFileService FileService;
|
||||
|
||||
public MerohelyApiController(IFileService fileService)
|
||||
{
|
||||
FileService = fileService;
|
||||
}
|
||||
|
||||
public DataSourceResult GetMerohelyGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
MerohelySearchModel model = JsonConvert.DeserializeObject<MerohelySearchModel>(data);
|
||||
|
||||
var merohelyHelper = new MerohelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
merohelyHelper.GridParameters = Converter.GridParameter(request);
|
||||
var merohelyList = merohelyHelper.MerohelyKereses(model.MerohelyNevSearch, model.MerohelyTipusIdSearch, model.MerohelyMukodesiHelyIdSearch, model.IsMeroallasFrissiteseSzuksegesSearch);
|
||||
return merohelyList.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetMerohelyTipusList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.MerohelyTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public DataSourceResult GetMeroallasDetailGrid(int merohelyId)
|
||||
{
|
||||
DataSet meroallasList = new MerohelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetMeroallasListByMerohelyId(merohelyId);
|
||||
return meroallasList.ToDataSourceResult();
|
||||
}
|
||||
|
||||
#region Meroallas
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage SaveMeroallas(MeroallasModel model)
|
||||
{
|
||||
ModelState.Merge(model.Validate());
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
new MerohelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).SaveMeroallas(model.ConvertToCo(), FileService);
|
||||
}
|
||||
catch (KretaError kretaError)
|
||||
{
|
||||
SDAServer.Instance.Logger.ExceptionThrown(kretaError);
|
||||
ModelState.AddModelError("Error", kretaError.Message);
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
var httpResponseMessage = Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
return httpResponseMessage;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage DeleteMeroallas([FromBody] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var merohelyHelper = new MerohelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
MeroallasCO co = merohelyHelper.GetMeroallasById(id);
|
||||
|
||||
if (co.KepId.HasValue)
|
||||
{
|
||||
merohelyHelper.DeleteFileAndFileData(FileService, co.KepId.Value);
|
||||
}
|
||||
|
||||
merohelyHelper.DeleteMeroallasById(id);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.InternalServerError,
|
||||
StringResourcesUtil.GetString(4358) /*Hiba történt törlés közben!*/)
|
||||
{
|
||||
UnHandledException = exception
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IHttpActionResult GetPicture(int meroallasId, int pictureId, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
if (meroallasId > 0 && pictureId > 0)
|
||||
{
|
||||
return Json(new MerohelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetPictureList(FileService, meroallasId).ToDataSourceResult(request));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(new { });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Meroallas
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class OkosmeroEnergetikaiAdatApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetOkosmeroEnergetikaiAdatGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
OkosmeroEnergetikaiAdatSearchModel model = JsonConvert.DeserializeObject<OkosmeroEnergetikaiAdatSearchModel>(data);
|
||||
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
helper.GridParameters = Converter.GridParameter(request);
|
||||
|
||||
return Converter.ToDataSourceResult(helper.OkosmeroEnergetikaiAdatKereses(model.FeladatellatasiHely));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Logic;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class OsztalyokEsCsoportLetszamokApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetOsztalyCsoportLetszamGrid(DataSourceRequest request)
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request);
|
||||
|
||||
return modelList.ToDataSourceResult(gridParameter);
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetExport(DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(request);
|
||||
|
||||
modelList = modelList.SortingAndPaging(gridParameter.OrderDictionary);
|
||||
|
||||
var simpleExportColumnCos = SimpleExportLogic.GetSimpleExportColumnCos<OsztalyokEsCsoportokGridModel>(OsztalyokEsCsoportokGridModel.OsztalyCsoportLetszamExportAttributeId);
|
||||
|
||||
var memoryStream = SimpleExportLogic.GetExport(OsztalyCsoportResource.OsztalyCsoportLetszamExportSheetName, simpleExportColumnCos, modelList, ClaimData.SelectedTanevID.Value);
|
||||
|
||||
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), OsztalyCsoportResource.OsztalyEsCsoportletszamokExportFilename);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
|
||||
private (GridParameters gridParameter, List<OsztalyokEsCsoportokGridModel> modelList) GetGridData(DataSourceRequest request)
|
||||
{
|
||||
var gridParameter = Converter.GridParameter(request);
|
||||
|
||||
var coList = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetOsztalyCsoportLetszamCoList();
|
||||
|
||||
var modelList = new List<OsztalyokEsCsoportokGridModel>();
|
||||
|
||||
foreach (var co in coList)
|
||||
{
|
||||
var gridModel = new OsztalyokEsCsoportokGridModel(co);
|
||||
modelList.Add(gridModel);
|
||||
}
|
||||
|
||||
return (gridParameter, modelList);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public HttpResponseMessage Veglegesites()
|
||||
{
|
||||
AdatszolgaltatasokHelper helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
try
|
||||
{
|
||||
helper.Veglegesites();
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch
|
||||
{
|
||||
StatusError error = new StatusError(HttpStatusCode.BadRequest, StringResourcesUtil.GetString(4998)/*Az osztályok létszámának véglegesítésekor hiba történt!*/);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public HttpResponseMessage Visszavonas()
|
||||
{
|
||||
AdatszolgaltatasokHelper helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
try
|
||||
{
|
||||
helper.Visszavonas();
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch
|
||||
{
|
||||
StatusError error = new StatusError(HttpStatusCode.BadRequest, StringResourcesUtil.GetString(4999)/*Hiba történt a véglegesítés visszavonásakor!*/);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
public OsztalyokEsCsoportokModel GetStatusz()
|
||||
{
|
||||
OsztalyokEsCsoportokModel model = new OsztalyokEsCsoportokModel();
|
||||
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
model.Vegleges = helper.GetStatusz('V') ?? false;
|
||||
model.Elfogadott = helper.GetStatusz('E') ?? false;
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
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.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class PedagogusIKTAdatszolgaltatasApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetPedagogusIKTAdatszolgaltatasGrid([ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
DataSet ds;
|
||||
var helper = new PedagogusIKTAdatszolgaltatasHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.GridParameters = Converter.GridParameter(request);
|
||||
ds = helper.GetPedagogusIKTAdatszolgaltatasGrid();
|
||||
|
||||
#region "Header helyett nulladik sor"
|
||||
//NOTE: "Ideiglenesen mivel a grid headerbe nincs lehetőség az összes oszlopérték beállítására egyszerre, ezért bekerül egy nulladik sor, amivel állítani lehet..."
|
||||
|
||||
DataRow dr = ds.Tables[0].NewRow();
|
||||
dr["ID"] = 0;
|
||||
dr["TanarNev"] = string.Empty;
|
||||
dr["SzuletesiIdo"] = DBNull.Value;
|
||||
ds.Tables[0].Rows.InsertAt(dr, 0);
|
||||
|
||||
#endregion "Header helyett nulladik sor"
|
||||
|
||||
return ds.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SavePedagogusIKTAdatszolgaltatas(PedagogusIKTAdatszolgaltatasRogzitesModel model)
|
||||
{
|
||||
|
||||
if (model.ProjektorokSzama.HasValue && model.MukodoProjektorokSzama.HasValue)
|
||||
{
|
||||
if (model.ProjektorokSzama < model.MukodoProjektorokSzama)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, AdatszolgaltatasokResource.AProjektorokSzamaNemLehetAlacsonyabbMintAMukodoProjektorokSzama);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.TermekSzama.HasValue && model.WifiLefedettTermekSzama.HasValue)
|
||||
{
|
||||
if (model.TermekSzama < model.WifiLefedettTermekSzama)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, AdatszolgaltatasokResource.ATermekSzamaNemLehetAlacsonyabbMintAWifiAltalLefedettTermekSzama);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var pedagogusIKTKompetencia in model.PedagogusIKTKompetenciaList)
|
||||
{
|
||||
if (!pedagogusIKTKompetencia.IKTKompetenciaSzint.HasValue)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, string.Format(AdatszolgaltatasokResource.PedagogusnalKotelezoMezo, pedagogusIKTKompetencia.TanarNev, AdatszolgaltatasokResource.IKTKompetenciaSzint));
|
||||
}
|
||||
if (!pedagogusIKTKompetencia.IKTEszkozhasznalatModja.HasValue)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, string.Format(AdatszolgaltatasokResource.PedagogusnalKotelezoMezo, pedagogusIKTKompetencia.TanarNev, AdatszolgaltatasokResource.IKTEszkozhasznalatModja));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pedagogusIKTKompetencia.IKTEszkozhasznalatModja != (int)IKTEszkozhasznalatModEnum.Nincs && !pedagogusIKTKompetencia.ElsodlegesIKTEszkoz.HasValue)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, string.Format(AdatszolgaltatasokResource.PedagogusnalKotelezoMezo, pedagogusIKTKompetencia.TanarNev, AdatszolgaltatasokResource.PedagogusElsodlegesIKTEszkoze));
|
||||
}
|
||||
if (pedagogusIKTKompetencia.IKTEszkozhasznalatModja == (int)IKTEszkozhasznalatModEnum.Nincs && pedagogusIKTKompetencia.ElsodlegesIKTEszkoz.HasValue)
|
||||
{
|
||||
ModelState.AddModelError(Core.Constants.General.Error, string.Format(AdatszolgaltatasokResource.PedagogusnalIKTEszkozhasznalatModjaNincs, pedagogusIKTKompetencia.TanarNev));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var helper = new PedagogusIKTAdatszolgaltatasHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.SavePedagogusIKTAdatszolgaltatas(ConvertModelToCo(model));
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetIKTKompetenciaSzintList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.IKTKompetenciaSzint).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetIKTEszkozhasznalatModjaList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.IKTEszkozhasznalatMod).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetElsodlegesIKTEszkozList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.ElsodlegesIKTEszkoz).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
private PedagogusIKTAdatszolgaltatasRogzitesCO ConvertModelToCo(PedagogusIKTAdatszolgaltatasRogzitesModel model)
|
||||
{
|
||||
var co = new PedagogusIKTAdatszolgaltatasRogzitesCO
|
||||
{
|
||||
ENaploHasznalat = model.ENaploHasznalat,
|
||||
ProjektorokSzama = model.ProjektorokSzama,
|
||||
MukodoProjektorokSzama = model.MukodoProjektorokSzama,
|
||||
TermekSzama = model.TermekSzama,
|
||||
WifiLefedettTermekSzama = model.WifiLefedettTermekSzama,
|
||||
WifiEleres = model.WifiEleres,
|
||||
PedagogusIKTKompetenciaList = new List<PedagogusIKTKompetenciaCO>()
|
||||
};
|
||||
foreach (var item in model.PedagogusIKTKompetenciaList)
|
||||
{
|
||||
co.PedagogusIKTKompetenciaList.Add(new PedagogusIKTKompetenciaCO
|
||||
{
|
||||
ElsodlegesIKTEszkoz = item.ElsodlegesIKTEszkoz,
|
||||
IKTEszkozhasznalatModja = item.IKTEszkozhasznalatModja,
|
||||
IKTKompetenciaSzint = item.IKTKompetenciaSzint,
|
||||
TanarId = item.TanarId
|
||||
});
|
||||
}
|
||||
return co;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.SzirApi;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Logic;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class SZIRAdatszolgApiController : ApiController
|
||||
{
|
||||
private readonly ISzirApiClient _szirApiClient;
|
||||
|
||||
public SZIRAdatszolgApiController(ISzirApiClient szirApiClient)
|
||||
{
|
||||
_szirApiClient = szirApiClient ?? throw new ArgumentNullException(nameof(szirApiClient));
|
||||
}
|
||||
|
||||
public DataSourceResult GetSZIRAdatszolgGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
var result = helper.GetSZIRAdatszolgGrid();
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetNemAllamiGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
var result = helper.GetNemAllamiGrid();
|
||||
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SetSZIRAdatszolgGrid(List<SZIRAdatszolgInfraGridModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SetSZIRAdatszolgGrid(item.SzirId, item.FeladatellatasiHelyId, item.OkostelefonSzama, item.TabletSzama, item.NotebookSzama, item.AsztaliGepSzama);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public DataSourceResult GetSZIRAdatszolgaltatasKonyvtarGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.GetKonyvtarItemCoList();
|
||||
|
||||
var model = new List<SZIRAdatszolgaltatasKonyvtarGridModel>();
|
||||
model.AddRange(result.Select(x => new SZIRAdatszolgaltatasKonyvtarGridModel(x)).OrderBy(x => x.Sorszam));
|
||||
|
||||
return model.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SetSZIRKonyvtarAdatszolgaltatasGrid(List<SZIRAdatszolgaltatasKonyvtarGridModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SaveKonyvtarAdatszolgaltatasRow(item.SzirId, item.Nyitoadat, item.NyitoadatNemzetisegi, item.Gyarapodas, item.Forgalom, item.KategoriaId);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage SetSZIRBekuldes()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
if (helper.SetSZIRBekuldes())
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.SikertelenAdatszolgaltatasBekuldes);
|
||||
}
|
||||
|
||||
public DataSourceResult GetTanuloEvVegeGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var panel = JsonConvert.DeserializeObject<SZIRAdatszolgaltatasTanuloEvVegeModel>(data);
|
||||
|
||||
if (panel.SearchModel.WasChanged)
|
||||
{
|
||||
var model = new List<SZIRAdatszolgaltatasTanuloEvVegeGridModel>();
|
||||
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.GetTanuloEvVegeCoList(ClaimData.PrevTanevID.Value, panel.SearchModel.ConvertToCo());
|
||||
|
||||
model.AddRange(result.Select(co => new SZIRAdatszolgaltatasTanuloEvVegeGridModel(co)));
|
||||
|
||||
return model.ToDataSourceResult();
|
||||
}
|
||||
|
||||
return new DataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SaveTanuloEvVegeGrid(List<SZIRAdatszolgaltatasTanuloEvVegeSaveModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SaveTanuloEvVege(ClaimData.PrevTanevID.Value, item.ConvertToCo());
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage SetNemAllamiVeglegesites()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var tanevSorszam = new TanevHelper(connectionType).GetTanevInfo().Sorszam;
|
||||
var helper = new SZIRAdatszolgHelper(connectionType);
|
||||
|
||||
if (!helper.IsNemAllamiJogosult(_szirApiClient, tanevSorszam, ClaimData.IntezmenyAzonosito) || !helper.IsVezetoAlkalmazott(ClaimData.FelhasznaloId))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NincsJogaAMuveletVegrehajtasahoz);
|
||||
}
|
||||
|
||||
var _ = helper.SendNemAllamiVeglegesites(_szirApiClient, ClaimData.IntezmenyAzonosito, tanevSorszam);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, CommonResource.HibaTortentAzOldalon);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveDetail(NemAllamiDetailModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var tanevSorszam = new TanevHelper(connectionType).GetTanevInfo().Sorszam;
|
||||
var helper = new SZIRAdatszolgHelper(connectionType);
|
||||
|
||||
if (!helper.IsNemAllamiJogosult(_szirApiClient, tanevSorszam, ClaimData.IntezmenyAzonosito) || !helper.IsVezetoAlkalmazott(ClaimData.FelhasznaloId))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NincsJogaAMuveletVegrehajtasahoz);
|
||||
}
|
||||
|
||||
var validate = SZIRAdatszolgLogic.ValidateNemAllamiModelOsszegzes(model);
|
||||
if (!string.IsNullOrWhiteSpace(validate))
|
||||
{
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, validate);
|
||||
}
|
||||
|
||||
var _ = helper.SendNemAllamiBekuldes(_szirApiClient, ClaimData.IntezmenyAzonosito, tanevSorszam, model.ConvertToCo());
|
||||
helper.SaveNemAllami(model.ConvertToCo());
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using System.Web.Http.Results;
|
||||
using Kendo.Mvc;
|
||||
using Kendo.Mvc.Infrastructure;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.BusinessLogic.Utils;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class TTFApiController : ApiController
|
||||
{
|
||||
private readonly IKozpontiKretaHelper KozpontiKretaHelper;
|
||||
|
||||
public TTFApiController(IKozpontiKretaHelper kozpontiKretaHelper)
|
||||
{
|
||||
KozpontiKretaHelper = kozpontiKretaHelper ?? throw new ArgumentNullException(nameof(kozpontiKretaHelper));
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public DataSourceResult GetTantargyFelosztasok(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
TantargyFelosztasSearchModel model = JsonConvert.DeserializeObject<TantargyFelosztasSearchModel>(data);
|
||||
|
||||
var helper = new TantargyFelosztasHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.GridParameters = Converter.GridParameter(request);
|
||||
List<int> tantargyIds = model.SearchTantargy.HasValue ? new List<int> { model.SearchTantargy.Value } : null;
|
||||
var dataSet = helper.GetTantargyFelosztasData(model.SearchTanar, model.SearchOsztalyCsoport, tantargyIds, evfolyamId: model.SearchEvfolyam, foglalkozasTipusId: model.SearchFoglalkozasTipusa, feladatellatasiHelyId: model.SearchFeladatellatasihely, oraszam: model.SearchOraszam);
|
||||
|
||||
var dataSourceResult = dataSet.ToDataSourceResult();
|
||||
if (dataSourceResult != null && dataSet.Tables.Count == 1)
|
||||
{
|
||||
dataSourceResult.AggregateResults = new List<AggregateResult>
|
||||
{
|
||||
new AggregateResult(dataSet.Tables[0].ExtendedProperties["Oraszam_SUM"], new SumFunction { SourceField = "Oraszam" })
|
||||
};
|
||||
}
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public TantargyFelosztasSearchModel Veglegesites()
|
||||
{
|
||||
try
|
||||
{
|
||||
TantargyFelosztasSearchModel model = KozpontiKretaHelper.PostTTFEllenorzes(ClaimData.IntezmenyAzonosito, new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetTanevInfo());
|
||||
|
||||
return model;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(
|
||||
HttpStatusCode.BadRequest,
|
||||
StringResourcesUtil.GetString(4049) /*Hiba történt a művelet közben*/)
|
||||
{
|
||||
UnHandledException = e
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public TantargyFelosztasSearchModel GetStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
TantargyFelosztasSearchModel model = KozpontiKretaHelper.GetTTFEllenorzes(ClaimData.IntezmenyAzonosito, new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetTanevInfo());
|
||||
|
||||
return model;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(
|
||||
HttpStatusCode.BadRequest,
|
||||
StringResourcesUtil.GetString(4049) /*Hiba történt a művelet közben*/)
|
||||
{
|
||||
UnHandledException = e
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public JsonResult<List<ComboBoxListItem>> GetTanar([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
var helper = new TanarHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
var dictionary = helper.GetAlkalmazottNevek(oktatasiAzonositoval: true);
|
||||
var dropdownListItems = new List<ComboBoxListItem>();
|
||||
|
||||
foreach (var item in dictionary)
|
||||
{
|
||||
var sli = new ComboBoxListItem() { Text = item.Value, Value = item.Key };
|
||||
dropdownListItems.Add(sli);
|
||||
}
|
||||
return Json(dropdownListItems);
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public JsonResult<List<ComboBoxListItem>> GetTanev([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
var helper = new TanevHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
var dictionary = helper.GetTanevekForDDL("");
|
||||
var dropdownListItems = new List<ComboBoxListItem>();
|
||||
|
||||
foreach (var item in dictionary)
|
||||
{
|
||||
var sli = new ComboBoxListItem() { Text = item.Value, Value = item.Key };
|
||||
dropdownListItems.Add(sli);
|
||||
}
|
||||
return Json(dropdownListItems);
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public JsonResult<List<ComboBoxListItem>> GetEvfolyamok([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.EvfolyamTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public JsonResult<List<ComboBoxListItem>> GetFoglalkozasTipusok([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
return Json(((int)GeneratedAdatszotarTipusEnum.FoglalkozasTipus).GetItemsByType(ClaimData.SelectedTanevID.Value, true).ToComboBoxItemList());
|
||||
}
|
||||
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public JsonResult<List<ComboBoxListItem>> GetFeladatellatasiHelyek([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
var helper = new FeladatEllatasiHelyHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
var dictionary = helper.GetFeladatEllatasiHelyDDl(StringResourcesUtils.GetString(364));
|
||||
var dropdownListItems = new List<ComboBoxListItem>();
|
||||
|
||||
foreach (var item in dictionary)
|
||||
{
|
||||
var sli = new ComboBoxListItem() { Text = item.Value, Value = item.Key };
|
||||
dropdownListItems.Add(sli);
|
||||
}
|
||||
return Json(dropdownListItems);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue