init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adminisztracio.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.Adminisztracio.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.DiakolimpiaKezelo.ClaimValue)]
|
||||
public class DiakolimpiaApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetDiakolimpiaGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
//Az oktatási azonosító maszkolása miatt kell kivenni
|
||||
data = data.Replace("_", "");
|
||||
|
||||
var model = JsonConvert.DeserializeObject<DiakolimpiaSearchModel>(data);
|
||||
|
||||
var helper = new DiakolimpiaHelper(ConnectionTypeExtensions.GetSessionConnectionType()) { GridParameters = Converter.GridParameter(request) };
|
||||
var ds = helper.GetDiakolimpiaGrid(ConvertSearchModelToCo(model));
|
||||
|
||||
return ds.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SendData(DataForMdszModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var message = string.Empty;
|
||||
try
|
||||
{
|
||||
var sorszam = new DiakolimpiaHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetFeladhelySorszambyId(model.FeladhelySorszam.Value);
|
||||
message = new DiakolimpiaHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetDataForMdszInterface(model.Tanulok, sorszam);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAMuveletSoran) { UnHandledException = e };
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK, message);
|
||||
}
|
||||
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAMuveletSoran);
|
||||
}
|
||||
|
||||
private DiakolimpiaSearchCO ConvertSearchModelToCo(DiakolimpiaSearchModel model)
|
||||
{
|
||||
return new DiakolimpiaSearchCO
|
||||
{
|
||||
SearchNev = model.SearchNev,
|
||||
SearchSzuletesiDatumtol = model.SearchSzuletesiDatumtol,
|
||||
SearchSzuletesiDatumig = model.SearchSzuletesiDatumig,
|
||||
SearchAnyjaNeve = model.SearchAnyjaNeve,
|
||||
SearchOktatasiAzonosito = model.SearchOktatasiAzonosito,
|
||||
SearchOsztalya = model.SearchOsztalya
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue