init
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Tanulo.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.Tanulo.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Osztalyfonok.ClaimValue, KretaClaimPackages.SzuperOsztalyfonok.ClaimValue, KretaClaimPackages.Evfolyamfelelos.ClaimValue)]
|
||||
public class OsztalyTanuloiApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetOsztalyTanuloiGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<OsztalyTanuloiSearchModel>(data);
|
||||
|
||||
if (!model.OsztalyCsoport.HasValue)
|
||||
{
|
||||
return new DataSourceResult();
|
||||
}
|
||||
|
||||
var authorization = (IKretaAuthorization)Request.GetDependencyScope().GetService(typeof(IKretaAuthorization));
|
||||
if (!authorization.IsValidOsztaly(model.OsztalyCsoport.Value))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.Forbidden, ErrorResource.AFelhasznalonakNincsMegfeleloJogosultsagaAFunkcioHasznalatahoz);
|
||||
}
|
||||
|
||||
bool? tankozelezett = null;
|
||||
if (model.Tankotelezett.HasValue)
|
||||
{
|
||||
tankozelezett = model.Tankotelezett.Value == 1;
|
||||
}
|
||||
|
||||
var helper = new TanuloHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType())
|
||||
{
|
||||
GridParameters = Converter.GridParameter(request)
|
||||
};
|
||||
|
||||
DataSet tanulok = helper.GetTanuloDataSetByOsztalyCsoportId(
|
||||
model.OsztalyCsoport.Value,
|
||||
model.FeladatKategoriaId,
|
||||
model.Nev,
|
||||
model.AnyjaSzuletesiNev,
|
||||
model.SzuletesiHely,
|
||||
model.SzuletesiIdoTol,
|
||||
model.SzuletesiIdoIg,
|
||||
model.OktatasiAzonosito,
|
||||
tankozelezett,
|
||||
model.Tanterv,
|
||||
model.FeladatEllatasiHelyId);
|
||||
|
||||
return tanulok.ToDataSourceResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user