init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,210 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.Extensions;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.SzirApi;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Logic;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.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.Adatszolgaltatasok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class SZIRAdatszolgApiController : ApiController
|
||||
{
|
||||
private readonly ISzirApiClient _szirApiClient;
|
||||
|
||||
public SZIRAdatszolgApiController(ISzirApiClient szirApiClient)
|
||||
{
|
||||
_szirApiClient = szirApiClient ?? throw new ArgumentNullException(nameof(szirApiClient));
|
||||
}
|
||||
|
||||
public DataSourceResult GetSZIRAdatszolgGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
var result = helper.GetSZIRAdatszolgGrid();
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetNemAllamiGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
var result = helper.GetNemAllamiGrid();
|
||||
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SetSZIRAdatszolgGrid(List<SZIRAdatszolgInfraGridModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SetSZIRAdatszolgGrid(item.SzirId, item.FeladatellatasiHelyId, item.OkostelefonSzama, item.TabletSzama, item.NotebookSzama, item.AsztaliGepSzama);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public DataSourceResult GetSZIRAdatszolgaltatasKonyvtarGrid()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.GetKonyvtarItemCoList();
|
||||
|
||||
var model = new List<SZIRAdatszolgaltatasKonyvtarGridModel>();
|
||||
model.AddRange(result.Select(x => new SZIRAdatszolgaltatasKonyvtarGridModel(x)).OrderBy(x => x.Sorszam));
|
||||
|
||||
return model.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SetSZIRKonyvtarAdatszolgaltatasGrid(List<SZIRAdatszolgaltatasKonyvtarGridModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SaveKonyvtarAdatszolgaltatasRow(item.SzirId, item.Nyitoadat, item.NyitoadatNemzetisegi, item.Gyarapodas, item.Forgalom, item.KategoriaId);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage SetSZIRBekuldes()
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
if (helper.SetSZIRBekuldes())
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.SikertelenAdatszolgaltatasBekuldes);
|
||||
}
|
||||
|
||||
public DataSourceResult GetTanuloEvVegeGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var panel = JsonConvert.DeserializeObject<SZIRAdatszolgaltatasTanuloEvVegeModel>(data);
|
||||
|
||||
if (panel.SearchModel.WasChanged)
|
||||
{
|
||||
var model = new List<SZIRAdatszolgaltatasTanuloEvVegeGridModel>();
|
||||
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.GetTanuloEvVegeCoList(ClaimData.PrevTanevID.Value, panel.SearchModel.ConvertToCo());
|
||||
|
||||
model.AddRange(result.Select(co => new SZIRAdatszolgaltatasTanuloEvVegeGridModel(co)));
|
||||
|
||||
return model.ToDataSourceResult();
|
||||
}
|
||||
|
||||
return new DataSourceResult();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SaveTanuloEvVegeGrid(List<SZIRAdatszolgaltatasTanuloEvVegeSaveModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.SaveTanuloEvVege(ClaimData.PrevTanevID.Value, item.ConvertToCo());
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage SetNemAllamiVeglegesites()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var tanevSorszam = new TanevHelper(connectionType).GetTanevInfo().Sorszam;
|
||||
var helper = new SZIRAdatszolgHelper(connectionType);
|
||||
|
||||
if (!helper.IsNemAllamiJogosult(_szirApiClient, tanevSorszam, ClaimData.IntezmenyAzonosito) || !helper.IsVezetoAlkalmazott(ClaimData.FelhasznaloId))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NincsJogaAMuveletVegrehajtasahoz);
|
||||
}
|
||||
|
||||
var _ = helper.SendNemAllamiVeglegesites(_szirApiClient, ClaimData.IntezmenyAzonosito, tanevSorszam);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, CommonResource.HibaTortentAzOldalon);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveDetail(NemAllamiDetailModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var tanevSorszam = new TanevHelper(connectionType).GetTanevInfo().Sorszam;
|
||||
var helper = new SZIRAdatszolgHelper(connectionType);
|
||||
|
||||
if (!helper.IsNemAllamiJogosult(_szirApiClient, tanevSorszam, ClaimData.IntezmenyAzonosito) || !helper.IsVezetoAlkalmazott(ClaimData.FelhasznaloId))
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NincsJogaAMuveletVegrehajtasahoz);
|
||||
}
|
||||
|
||||
var validate = SZIRAdatszolgLogic.ValidateNemAllamiModelOsszegzes(model);
|
||||
if (!string.IsNullOrWhiteSpace(validate))
|
||||
{
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, validate);
|
||||
}
|
||||
|
||||
var _ = helper.SendNemAllamiBekuldes(_szirApiClient, ClaimData.IntezmenyAzonosito, tanevSorszam, model.ConvertToCo());
|
||||
helper.SaveNemAllami(model.ConvertToCo());
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue