init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,84 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Helpers.SystemSettings;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.BusinessLogic.Utils;
|
||||
using Kreta.Web.Areas.Orarend.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Orarend.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Naplo.ClaimValue)]
|
||||
[ApiRolePackageDenyAuthorize(KretaClaimPackages.IsDualisKepzohelyiOktato.ClaimValue)]
|
||||
public class TanarOralatogatasApiController : ApiController
|
||||
{
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveOralatogatas(OralatogatasModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var helper = new OralatogatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
if (!model.OralatogatasID.HasValue && model.TanarId != ClaimData.FelhasznaloId
|
||||
&& helper.OralatogatasUtkozes(ClaimData.FelhasznaloId, model.OraID.Value, out string errorMessage))
|
||||
{
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, errorMessage);
|
||||
}
|
||||
|
||||
OralatogatasokCO co = new OralatogatasokCO()
|
||||
{
|
||||
LatogatoID = ClaimData.FelhasznaloId,
|
||||
Megjegyzes = model.OralatogatasSzovege,
|
||||
Date = model.OralatogatasDatuma,
|
||||
Ora = model.OraID.Value,
|
||||
Id = model.OralatogatasID ?? -1,
|
||||
NemKotottMunkaidos = model.NemKotottMunkaidos
|
||||
};
|
||||
|
||||
if (new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue<bool>(Enums.RendszerBeallitasTipusEnum.kotott_munkaido_nevelesseloktatassal_le_nem_kotott_resz_kezelesenek_tiltasa))
|
||||
{
|
||||
co.NemKotottMunkaidos = false;
|
||||
}
|
||||
|
||||
helper.SaveOralatogatas(co);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage DeleteOralatogatas(int id)
|
||||
{
|
||||
var helper = new OralatogatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
helper.DeleteOralatogatas(id, ClaimData.FelhasznaloId);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetTanarList()
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var felhasznalokOnlyAlkalmazottSzerepkorIds = new FelhasznaloHelper(connectionType).GetFelhasznaloIdsOnlyAlkalmazottSzerepkor();
|
||||
IDictionary<string, string> lista;
|
||||
var helper = new TanarHelper(connectionType);
|
||||
lista = helper.GetTanarok(string.Empty, oktatasiAzonositoval: true);
|
||||
|
||||
lista.Remove("");
|
||||
|
||||
return Json(lista.ToComboBoxItemList().Where(x => !felhasznalokOnlyAlkalmazottSzerepkorIds.Contains(SDAConvert.ToInt32(x.Value))).ToList());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue