init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.TanuloErtekeles.Models.TanuloErtekeles;
|
||||
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.TanuloErtekeles.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue, KretaClaimPackages.Osztalyfonok.ClaimValue, KretaClaimPackages.SzuperOsztalyfonok.ClaimValue, KretaClaimPackages.Naplo.ClaimValue)]
|
||||
public class ErtekelesApiController : BaseTanuloErtekelesApiController
|
||||
{
|
||||
public DataSourceResult GetErtekelesGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<ErtekelesListModel>(data);
|
||||
|
||||
int? osztalyCsoportId = model.OsztalyCsoportIdSearch;
|
||||
int? tantargyId = model.TantargyIdSearch;
|
||||
if (!osztalyCsoportId.IsEntityId() || !tantargyId.IsEntityId())
|
||||
{
|
||||
return new DataSourceResult();
|
||||
}
|
||||
|
||||
var gridParameters = Converter.GridParameter(request);
|
||||
DataSourceResult result = GetErtekelesGridData(osztalyCsoportId.Value, tantargyId.Value, model.Datum, gridParameters);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public DataSourceResult GetNaplozasErtekelesGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<ErtekelesListModel>(data);
|
||||
|
||||
int? osztalyCsoportId = model.OsztalyCsoportIdSearch;
|
||||
int? tantargyId = model.TantargyIdSearch;
|
||||
if (!osztalyCsoportId.IsEntityId() || !tantargyId.IsEntityId())
|
||||
{
|
||||
return new DataSourceResult();
|
||||
}
|
||||
|
||||
var gridParameters = Converter.GridParameter(request);
|
||||
DataSourceResult result = GetErtekelesGridData(osztalyCsoportId.Value, tantargyId.Value, model.Datum, gridParameters);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult GetErtekelesGridData(int osztalyCsoportId, int tantargyId, DateTime? datum, GridParameters gridParameters)
|
||||
{
|
||||
var helper = new TanuloErtekelesHelper(ConnectionTypeExtensions.GetSessionConnectionType())
|
||||
{
|
||||
GridParameters = gridParameters
|
||||
};
|
||||
DataSet dataSet = helper.GetTanuloErtekelesDataSetByTantargyForGrid(ClaimData.FelhasznaloId, osztalyCsoportId, tantargyId, datum, false);
|
||||
|
||||
return dataSet.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetFotargyAltargyErtekelesGrid(int tanuloId, int tantargyId, DateTime? datum, int feladatKategoriaId)
|
||||
{
|
||||
var helper = new TanuloErtekelesHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
DataSet dataSet = helper.GetTanuloErtekelesDataSetByFotargyAltargyForGrid(ClaimData.FelhasznaloId, tanuloId, tantargyId, datum, feladatKategoriaId);
|
||||
|
||||
return dataSet.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetErtekelesDetailGrid(int tanuloId, int tantargyId, DateTime? datum, int feladatKategoriaId, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var gridParameters = Converter.GridParameter(request);
|
||||
DataSet dataSet = GetDetailGridDataBase(tanuloId, tantargyId, true, datum, (int)ErtekelesMegjelenesFajtaEnum.Tantargy, feladatKategoriaId: feladatKategoriaId, gridParameters: gridParameters);
|
||||
return dataSet.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Save(ErtekelesListSaveModel model)
|
||||
{
|
||||
List<TanuloErtekelesCo> tanuloErtekelesCoList = model.ToCoList();
|
||||
HttpResponseMessage result = SaveTanuloErtekelesList(Request, tanuloErtekelesCoList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Edit(ErtekelesEditModel model)
|
||||
{
|
||||
int id = model.IdEdit;
|
||||
var authorization = (IKretaAuthorization)Request.GetDependencyScope().GetService(typeof(IKretaAuthorization));
|
||||
if (!authorization.IsValidErtekeles(id))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.Forbidden, ErrorResource.AFelhasznalonakNincsMegfeleloJogosultsagaAFunkcioHasznalatahoz);
|
||||
}
|
||||
|
||||
var tanuloErtekelesCoList = new List<TanuloErtekelesCo> { model.ToCo() };
|
||||
HttpResponseMessage result = SaveTanuloErtekelesList(Request, tanuloErtekelesCoList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Delete([FromBody] int id)
|
||||
{
|
||||
var authorization = (IKretaAuthorization)Request.GetDependencyScope().GetService(typeof(IKretaAuthorization));
|
||||
bool isValid = authorization.IsValidErtekeles(id);
|
||||
HttpResponseMessage result = DeleteTanuloErtekeles(id, isValid);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue