This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,189 @@
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.KollegiumModul.ClaimValue)]
public class KollegiumKovTanevSorolasApiController : ApiController
{
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportLeptetes(KovTanevCsoportAtleptetesModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumCsoportLeptetes(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 CsoportBesorolas(KovTanevCsoportBesorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumCsoportbaSorolas(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 CsoportTevesBesorolasJavitas(KovTanevCsoportTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumCsoportSorolasJavitas(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 OsztalyLeptetes(KovTanevOsztalyAtleptetesModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumOsztalyLeptetes(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 OsztalyBesorolasElsoAlkalom(KovTanevOsztalyBesorolasElsoAlkalomModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumOsztalybaSorolasElsoAlkalommal(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 OsztalyTevesBesorolasJavitas(KovTanevOsztalyTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).KollegiumOsztalybaSorolasJavitasa(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(KovTanevVisszairatkoztatasModel model)
{
try
{
OsztalyCsoportLogic.KovTanevVisszairatkoztatasJogviszonyCustomValidation(ModelState, model);
if (ModelState.IsValid)
{
try
{
new OsztalyCsoportbaSorolasHelper(
ConnectionTypeExtensions.GetSessionConnectionType(),
ClaimData.IsSzakkepzoIntezmeny,
ClaimData.IsSelectedTanev21_22OrLater,
ClaimData.AktivTanevID,
ClaimData.KovTanevID,
true).KollegiumVisszaIratkoztatas(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);
}
}
}