98 lines
4.2 KiB
C#
98 lines
4.2 KiB
C#
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.Helpers;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Enums.ManualEnums;
|
|
using Kreta.Web.Areas.Orarend.Models;
|
|
using Kreta.Web.Areas.Tanar.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Helpers.Grid;
|
|
using Kreta.Web.Security;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Kreta.Web.Areas.Orarend.ApiControllers
|
|
{
|
|
[ApiRoleClaimsAuthorize(true)]
|
|
[ApiRolePackageAuthorize(KretaClaimPackages.Ellenorzo.ClaimValue)]
|
|
public class InformaciokFogadoorakApiController : ApiController
|
|
{
|
|
public DataSourceResult GetFogadooraGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
|
{
|
|
var model = JsonConvert.DeserializeObject<FogadooraSearchModel>(data);
|
|
|
|
var helper = new FogadooraHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
var gridParameters = Converter.GridParameter(request);
|
|
|
|
var ds = helper.GetFogadooraGondviselo(ClaimData.GondviseloId ?? -1, model.TanarIdSrc, model.TeremIdSrc, model.IdopontTolSrc, model.IdopontIgSrc, model.IdointervallumTolSrc, model.IdointervallumIgSrc, model.IsJelentkezheto);
|
|
|
|
var modelList = new List<InformaciokFogadoorakGridModel>();
|
|
foreach (var row in ds.Tables[0].AsEnumerable())
|
|
{
|
|
modelList.Add(new InformaciokFogadoorakGridModel
|
|
{
|
|
ID = row.Field<int>("ID").ToString(),
|
|
JelentkezesekKezeleseId = row.Field<int>("JelentkezesekKezeleseId"),
|
|
IdopontGondviseloId = row.Field<int?>("IdopontGondviseloId"),
|
|
IdopontStr = row.Field<string>("IdopontStr"),
|
|
JelentkezesiHatarido = row.Field<DateTime?>("JelentkezesiHatarido"),
|
|
Pedagogus = row.Field<string>("Pedagogus"),
|
|
Terem = row.Field<string>("Terem"),
|
|
FogadooraKezdete = row.Field<DateTime>("FogadooraKezdete"),
|
|
FogadooraVege = row.Field<DateTime>("FogadooraVege"),
|
|
JelentkezesAllapot = row.Field<int>("JelentkezesAllapot")
|
|
});
|
|
}
|
|
|
|
return modelList.ToDataSourceResult(gridParameters);
|
|
}
|
|
|
|
public JsonResult<List<ComboBoxListItem>> GetFogadooraIdopontok(int fogadooraId)
|
|
{
|
|
var ds = new FogadooraHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetFogadooraIdopontok(fogadooraId, ClaimData.GondviseloId.Value, FogadooraTipusEnum.Jelentkezheto);
|
|
|
|
List<ComboBoxListItem> dropdownListItems = new List<ComboBoxListItem>();
|
|
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
ComboBoxListItem sli = new ComboBoxListItem() { Text = row.Field<string>("Text"), Value = row.Field<int>("Value").ToString() };
|
|
dropdownListItems.Add(sli);
|
|
}
|
|
|
|
return Json(dropdownListItems);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ApiValidateAjaxAntiForgeryToken]
|
|
public HttpResponseMessage Jelentkezes(int idopontId)
|
|
{
|
|
new FogadooraHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).FogadooraGondviseloJelentkezes(idopontId, ClaimData.GondviseloId.Value);
|
|
|
|
return new HttpResponseMessage(HttpStatusCode.OK);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ApiValidateAjaxAntiForgeryToken]
|
|
public HttpResponseMessage Lemondas(int idopontGondviseloId)
|
|
{
|
|
new FogadooraHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).FogadooraGondviseloJelentkezesLemondas(idopontGondviseloId);
|
|
|
|
return new HttpResponseMessage(HttpStatusCode.OK);
|
|
}
|
|
|
|
[HttpGet]
|
|
[ApiValidateAjaxAntiForgeryToken]
|
|
public int isSzabadIdopontByFogadooraIdopontId(int fogadooraIdopontId)
|
|
{
|
|
var result = new FogadooraHelper(ConnectionTypeExtensions.GetSessionConnectionType()).IsSzabadIdopontByFogadooraIdopontId(fogadooraIdopontId);
|
|
return result;
|
|
}
|
|
}
|
|
}
|