init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Logic;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Orarend.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.Orarend.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class AdminNemNaplozottTanorakApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetNemNaplozottTanorakGrid(string data, DataSourceRequest request)
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(data, request);
|
||||
|
||||
return modelList.ToDataSourceResult(gridParameter);
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetExport(string data, DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (gridParameter, modelList) = GetGridData(data, request);
|
||||
|
||||
modelList = modelList.SortingAndPaging(gridParameter.OrderDictionary);
|
||||
|
||||
var simpleExportColumnCos = SimpleExportLogic.GetSimpleExportColumnCos<NemNaplozottTanorakGridModel>(NemNaplozottTanorakGridModel.NemNaplozottTanorakExportAttributeId);
|
||||
|
||||
var memoryStream = SimpleExportLogic.GetExport(NemNaplozottTanorakResource.ExportSheetName, simpleExportColumnCos, modelList, ClaimData.SelectedTanevID.Value);
|
||||
|
||||
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), NemNaplozottTanorakResource.ExportFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
|
||||
private (GridParameters gridParameter, List<NemNaplozottTanorakGridModel> modelList) GetGridData(string data, DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<NemNaplozottTanorakSearchModel>(data);
|
||||
|
||||
var gridParameter = Converter.GridParameter(request);
|
||||
|
||||
var coList = new OrarendHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetNemNaplozottOrarendiOraCoList(NemNaplozottTanorakSearchModel.ConvertModelToCo(model));
|
||||
|
||||
var modelList = new List<NemNaplozottTanorakGridModel>();
|
||||
|
||||
foreach (var co in coList)
|
||||
{
|
||||
var gridModel = new NemNaplozottTanorakGridModel(co);
|
||||
modelList.Add(gridModel);
|
||||
}
|
||||
|
||||
return (gridParameter, modelList);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue