kreta/KretaWeb/Areas/OsztalyCsoport/ApiControllers/EGYMIAktTanevSorolasApiController.cs
2024-03-13 00:33:46 +01:00

226 lines
8.9 KiB
C#

namespace Kreta.Web.Areas.OsztalyCsoport.ApiControllers
{
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Core.Exceptions;
using Kreta.Web.Areas.OsztalyCsoport.Logic;
using Kreta.Web.Areas.OsztalyCsoport.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Helpers.Error;
using Kreta.Web.Security;
[ApiRoleClaimsAuthorize(true)]
[ApiRolePackageAuthorize(KretaClaimPackages.EGYMIModul.ClaimValue)]
public class EGYMIAktTanevSorolasApiController : ApiController
{
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyBesorolasElsoAlkalom(AktTanevOsztalyBesorolasElsoAlkalomModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMIOsztalybaSorolasElsoAlkalommal(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyKisorolas(AktTanevOsztalyKisorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMIOsztalyKisorolas(model, model.ConvertModelToJogviszonyCo());
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyTevesBesorolasJavitas(AktTanevOsztalyTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMIOsztalybaSorolasJavitasa(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyAtsorolas(AktTanevOsztalyAtsorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMIOsztalyAtsorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyVisszairatkoztatas(AktTanevOsztalyVisszairatkoztatasModel model)
{
try
{
OsztalyCsoportLogic.AktTanevOsztalyVisszairatkoztatasJogviszonyCustomValidation(ModelState, model);
if (ModelState.IsValid)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMIVisszaIratkoztatas(model, model.ConvertModelToJogviszonyCo());
}
catch (BlException e)
{
var error = new StatusError(HttpStatusCode.BadRequest, e.Message);
throw error;
}
}
else
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
}
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportBesorolas(AktTanevCsoportBesorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMICsoportbaSorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusError(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportAtsorolas(AktTanevCsoportAtsorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMICsoportbaAtsorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportKisorolas(AktTanevCsoportKisorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMICsoportbolKisorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportTevesBesorolasJavitas(AktTanevCsoportTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).EGYMICsoportSorolasJavitas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
}