init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,146 @@
|
|||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using System.Web.Http.Results;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Web.Areas.GRModul.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.GRModul.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize("KretaClaimPackages.GazdasagiUgyintezo.ClaimValue")]
|
||||
public class BeszerzesiIgenyApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetBeszerzesiIgenyGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
BeszerzesiIgenySearchModel model = JsonConvert.DeserializeObject<BeszerzesiIgenySearchModel>(data);
|
||||
|
||||
var helper = new BeszerzesiModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
helper.GridParameters = Converter.GridParameter(request);
|
||||
var result = helper.BeszerzesiIgenyKereses(model.ConvertModelToCo(ClaimData.SelectedTanevID.Value));
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetBeszerzesiIgenyDokGrid(int igenylesId)
|
||||
{
|
||||
var helper = new BeszerzesiModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.BeszerzesiIgenyDokList(igenylesId);
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetBeszerzesiIgenyMegjegyzesGrid(int igenylesId)
|
||||
{
|
||||
var helper = new BeszerzesiModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var result = helper.BeszerzesiIgenyMegjegyzesList(igenylesId);
|
||||
return result.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public JsonResult<AnyagModel> GetAnyagTorzsAdat(int torzsId)
|
||||
{
|
||||
var helper = new BeszerzesiModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
return Json(ConvertCoToAnyagModel(helper.GetAnyagTorzsAdat(torzsId)));
|
||||
}
|
||||
|
||||
public JsonResult<SzallitoModel> GetSzallitoTorzsAdat(int torzsId)
|
||||
{
|
||||
var helper = new BeszerzesiModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
return Json(ConvertCoToSzallitoModel(helper.GetSzallitoTorzsAdat(torzsId)));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveBeszerzesiIgeny(BeszerzesiIgenyModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var co = BeszerzesiIgenyModel.ConvertModelToCo(model);
|
||||
new BeszerzesiModulHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).SaveBeszerzesiIgeny(co);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
StatusError error = new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
protected static AnyagModel ConvertCoToAnyagModel(BeszerzesiIgenyCo co)
|
||||
{
|
||||
return new AnyagModel()
|
||||
{
|
||||
//AnyagId = co.AnyagId, //TODO
|
||||
AnyagMegnevezes = co.AnyagMegnevezes,
|
||||
AnyagMennyisegiEgysegId = co.AnyagMennyisegiEgysegId,
|
||||
AnyagRovidLeiras = co.AnyagRovidLeiras,
|
||||
AnyagTetelMegnevezes = co.AnyagTetelMegnevezes,
|
||||
AnyagTetelEgysegar = co.AnyagTetelEgysegar,
|
||||
AnyagTetelMennyisegiEgysegId = co.AnyagTetelMennyisegiEgysegId,
|
||||
AnyagTetelMennyiseg = co.AnyagTetelMennyiseg
|
||||
};
|
||||
}
|
||||
|
||||
protected static SzallitoModel ConvertCoToSzallitoModel(BeszerzesiIgenyCo co)
|
||||
{
|
||||
return new SzallitoModel()
|
||||
{
|
||||
//SzallitoId = co.SzallitoId, //TODO
|
||||
SzallitoNev = co.SzallitoNev,
|
||||
IrSzam = co.Iranyitoszam,
|
||||
HelysegNev = co.HelysegNev,
|
||||
KozteruletNev = co.KozteruletNev,
|
||||
KozteruletJellegId = co.KozteruletJellegeId,
|
||||
Hazszam = co.Hazszam,
|
||||
Emelet = co.Emelet,
|
||||
Ajto = co.Ajto,
|
||||
Adoszam = co.Adoszam,
|
||||
KepviseloNeve = co.KepviseloNev,
|
||||
EmailCim = co.EmailCim,
|
||||
Telefonszam = co.Telefonszam,
|
||||
FizetesiMod = co.FizetesiMod
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveBeszerzesiIgenyElfogadas(int igenyId)
|
||||
{
|
||||
//new GRModulHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).BeszerzesiIgenyElfogadas(igenyId);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveBeszerzesiIgenyElutasitas(int igenyId)
|
||||
{
|
||||
//new GRModulHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).BeszerzesiIgenyElutasitas(igenyId);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveBeszerzesiIgenyHianyPotlas(int igenyId)
|
||||
{
|
||||
//new GRModulHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).BeszerzesiIgenyHianyPotlas(igenyId);
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Logic;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.KGR;
|
||||
using Kreta.Core;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.GRModul.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.GRModul.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class KotvallKezelesApiController : ApiController
|
||||
{
|
||||
private readonly IKGRClient _kgrClient;
|
||||
|
||||
public KotvallKezelesApiController(IKGRClient kgrClient)
|
||||
{
|
||||
_kgrClient = kgrClient ?? throw new ArgumentNullException(nameof(kgrClient));
|
||||
}
|
||||
|
||||
public DataSourceResult GetKotvallGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<KotvallSearchModel>(data);
|
||||
|
||||
var helper = new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType())
|
||||
{
|
||||
GridParameters = Converter.GridParameter(request),
|
||||
};
|
||||
|
||||
var result = helper.GetKotvallItemList(_kgrClient, ClaimData.IntezmenyGuid ?? throw new ApplicationException(ErrorResource.NincsAzIskolanakEgyediAzonositoja), model.ConvertToCo());
|
||||
var gridModel = result.Select(x => new KotvallGridModel(x, ClaimData.FelhasznaloIdpEgyediAzonosito)).ToList();
|
||||
return gridModel.ToDataSourceResult(helper.GridParameters);
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetKotvallExport(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<KotvallSearchModel>(data);
|
||||
var helper = new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType())
|
||||
{
|
||||
GridParameters = Converter.GridParameter(request),
|
||||
};
|
||||
var result = helper.GetKotvallItemListExport(_kgrClient, ClaimData.IntezmenyGuid ?? throw new ApplicationException(ErrorResource.NincsAzIskolanakEgyediAzonositoja), model.ConvertToCo());
|
||||
var gridModelList = result.Select(x => new KotvallGridModel(x, ClaimData.FelhasznaloIdpEgyediAzonosito)).ToList();
|
||||
gridModelList = gridModelList.SortingAndPaging(helper.GridParameters.OrderDictionary);
|
||||
var simpleExportColumnCos = SimpleExportLogic.GetSimpleExportColumnCos<KotvallGridModel>(KotvallGridModel.KotvallGridExportAttributeId);
|
||||
var memoryStream = SimpleExportLogic.GetExport(KotvallKezelesResource.KotVallGridExportSheetName, simpleExportColumnCos, gridModelList, ClaimData.SelectedTanevID.Value);
|
||||
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), $"{KotvallKezelesResource.ExportFilename}.xlsx");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Data["IntezmenyBeszerzesHiba"] != null)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, null) { Json = ex.Data["IntezmenyBeszerzesHiba"], };
|
||||
}
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ComboBoxListItem> GetKotvallStatusList()
|
||||
{
|
||||
return new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetKotvallStatusList(_kgrClient).Select(x => new ComboBoxListItem() { Text = x.Nev, Value = x.Id.ToString() }).ToList();
|
||||
}
|
||||
|
||||
public List<ComboBoxListItem> GetKotvallTargyList()
|
||||
{
|
||||
return new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetKotvallTargyList(_kgrClient).Select(x => new ComboBoxListItem() { Text = x.Nev, Value = x.Id.ToString() }).ToList();
|
||||
}
|
||||
|
||||
public HttpResponseMessage SaveBeszerzesiIgeny(KotvallModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
model.IntezmenyEgyediAzonosito = ClaimData.IntezmenyGuid ?? throw new ApplicationException(ErrorResource.NincsAzIskolanakEgyediAzonositoja);
|
||||
var (oktatasiAzonosito, emailCim, elotag, vezeteknev, utonev) = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetUserDetailsForKotVall();
|
||||
model.IdpEgyediAzonosito = ClaimData.FelhasznaloIdpEgyediAzonosito;
|
||||
model.TanevId = ClaimData.SelectedTanevID;
|
||||
model.LetrehozoEmail = emailCim;
|
||||
model.OktatasiAzonosito = oktatasiAzonosito;
|
||||
model.EloTag = elotag;
|
||||
model.Utonev = utonev;
|
||||
model.CsaladiNev = vezeteknev;
|
||||
if (!model.VisMajorIgeny)
|
||||
{
|
||||
model.VisMajorIndok = string.Empty;
|
||||
}
|
||||
new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).SaveKotvallItem(_kgrClient, KotvallModel.ConvertToCo(model));
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Data["IntezmenyBeszerzesHiba"] != null)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, null) { Json = ex.Data["IntezmenyBeszerzesHiba"], };
|
||||
}
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Visszavonas([FromBody] int id)
|
||||
{
|
||||
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
||||
var helper = new KotvallKezelesHelper(connectionType);
|
||||
var intezmenyGuid = ClaimData.IntezmenyGuid ?? throw new ApplicationException(ErrorResource.NincsAzIskolanakEgyediAzonositoja);
|
||||
var visszavonando = helper.GetKotvallItem(_kgrClient, intezmenyGuid, id);
|
||||
if (!new KotvallGridModel(visszavonando, ClaimData.FelhasznaloIdpEgyediAzonosito).IsDeleteEnabled)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.Forbidden, ErrorResource.NincsJogaAMuveletVegrehajtasahoz);
|
||||
}
|
||||
var (oktatasiAzonosito, emailCim, elotag, vezeteknev, utonev) = new FelhasznaloHelper(connectionType).GetUserDetailsForKotVall();
|
||||
var model = new KotvallVisszavonasModel
|
||||
{
|
||||
Id = id,
|
||||
IntezmenyEgyediAzonosito = intezmenyGuid,
|
||||
IdpEgyediAzonosito = ClaimData.FelhasznaloIdpEgyediAzonosito,
|
||||
CsaladiNev = vezeteknev,
|
||||
Utonev = utonev,
|
||||
EloTag = elotag,
|
||||
OktatasiAzonosito = oktatasiAzonosito,
|
||||
};
|
||||
try
|
||||
{
|
||||
helper.KotvallVisszavonas(_kgrClient, model.ConvertToCo());
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Data["IntezmenyBeszerzesHiba"] != null)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, null) { Json = ex.Data["IntezmenyBeszerzesHiba"], };
|
||||
}
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
177
KretaWeb/Areas/GRModul/ApiControllers/ProjektApiController.cs
Normal file
177
KretaWeb/Areas/GRModul/ApiControllers/ProjektApiController.cs
Normal file
|
@ -0,0 +1,177 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.KGR;
|
||||
using Kreta.Client.KGR.Request;
|
||||
using Kreta.Web.Areas.GRModul.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.GRModul.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Naplo.ClaimValue)]
|
||||
public class ProjektApiController : ApiController
|
||||
{
|
||||
private readonly IKGRClient kgrClient;
|
||||
|
||||
public ProjektApiController(IKGRClient kgrClient)
|
||||
{
|
||||
this.kgrClient = kgrClient ?? throw new ArgumentNullException(nameof(kgrClient));
|
||||
}
|
||||
|
||||
public DataSourceResult GetProjektGrid(string data, [System.Web.Http.ModelBinding.ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProjektSearchModel model = JsonConvert.DeserializeObject<ProjektSearchModel>(data);
|
||||
List<ProjektGridModel> LProjekt = new List<ProjektGridModel>();
|
||||
List<ProjektGridModel> LResult = new List<ProjektGridModel>();
|
||||
|
||||
var kozpontiResult = kgrClient.ProjektList(new ProjektHeaderRequest() { IntezmenyGuid = ClaimData.IntezmenyGuid.ToString(), AlkalmazottId = ClaimData.FelhasznaloId });
|
||||
if (kozpontiResult != null)
|
||||
{
|
||||
foreach (var item in kozpontiResult)
|
||||
{
|
||||
LProjekt.Add(new ProjektGridModel()
|
||||
{
|
||||
ID = item.Id.ToString(),
|
||||
ProjektAzonosito = item.Azonosito,
|
||||
ProjektNeve = item.Nev,
|
||||
ProjektKezdete = item.Kezdete,
|
||||
ProjektVege = item.Vege,
|
||||
TSZTOMegkotesDatum = item.TSZTOMegkotesDatum,
|
||||
HataridoKezdet = item.JelentkezesHataridoKezdet,
|
||||
HataridoVeg = item.JelentkezesHataridoVeg,
|
||||
IsVisszautasitott = item.IsVisszautasitott,
|
||||
IsJelentkezett = item.IsJelentkezett,
|
||||
IsElfogadott = item.IsElfogadott
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.SrcProjektAzonosito))
|
||||
LProjekt = LProjekt.Where(x => x.ProjektAzonosito.ToLower().Contains(model.SrcProjektAzonosito.ToLower())).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.SrcProjektNeve))
|
||||
LProjekt = LProjekt.Where(x => x.ProjektNeve.ToLower().Contains(model.SrcProjektNeve.ToLower())).ToList();
|
||||
|
||||
if (model.SrcProjektKezdete.HasValue)
|
||||
LProjekt = LProjekt.Where(x => x.ProjektKezdete.Value.Date >= model.SrcProjektKezdete.Value.Date).ToList();
|
||||
|
||||
if (model.SrcProjektVege.HasValue)
|
||||
LProjekt = LProjekt.Where(x => x.ProjektVege.Value.Date <= model.SrcProjektVege.Value.Date).ToList();
|
||||
|
||||
if (model.SrcTSZTOMegkotesDatum.HasValue)
|
||||
LProjekt = LProjekt.Where(x => x.TSZTOMegkotesDatum.Value.Date >= model.SrcTSZTOMegkotesDatum.Value.Date).ToList();
|
||||
|
||||
if (model.SrcJelentkezesiHataridoKezdete.HasValue)
|
||||
LProjekt = LProjekt.Where(x => x.HataridoKezdet.HasValue && x.HataridoKezdet.Value.Date >= model.SrcJelentkezesiHataridoKezdete.Value.Date).ToList();
|
||||
|
||||
if (model.SrcJelentkezesiHataridoVege.HasValue)
|
||||
LProjekt = LProjekt.Where(x => x.HataridoVeg.HasValue && x.HataridoVeg.Value.Date >= model.SrcJelentkezesiHataridoVege.Value.Date).ToList();
|
||||
|
||||
if (LProjekt.Count > 0)
|
||||
{
|
||||
if (request.Sorts.Count == 1)
|
||||
{
|
||||
var sort = request.Sorts[0];
|
||||
if (sort.Member == "ProjektAzonosito" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.ProjektAzonosito).ToList(); }
|
||||
if (sort.Member == "ProjektAzonosito" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.ProjektAzonosito).ToList(); }
|
||||
|
||||
if (sort.Member == "ProjektNeve" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.ProjektNeve).ToList(); }
|
||||
if (sort.Member == "ProjektNeve" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.ProjektNeve).ToList(); }
|
||||
|
||||
if (sort.Member == "ProjektKezdete" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.ProjektKezdete).ToList(); }
|
||||
if (sort.Member == "ProjektKezdete" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.ProjektKezdete).ToList(); }
|
||||
|
||||
if (sort.Member == "ProjektVege" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.ProjektVege).ToList(); }
|
||||
if (sort.Member == "ProjektVege" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.ProjektVege).ToList(); }
|
||||
|
||||
if (sort.Member == "TSZTOMegkotesDatum" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.TSZTOMegkotesDatum).ToList(); }
|
||||
if (sort.Member == "TSZTOMegkotesDatum" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.TSZTOMegkotesDatum).ToList(); }
|
||||
|
||||
if (sort.Member == "HataridoKezdet" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.HataridoKezdet).ToList(); }
|
||||
if (sort.Member == "HataridoKezdet" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.HataridoKezdet).ToList(); }
|
||||
|
||||
if (sort.Member == "HataridoVeg" && sort.SortDirection == ListSortDirection.Ascending)
|
||||
{ LResult = LProjekt.OrderBy(x => x.HataridoVeg).ToList(); }
|
||||
if (sort.Member == "HataridoVeg" && sort.SortDirection == ListSortDirection.Descending)
|
||||
{ LResult = LProjekt.OrderByDescending(x => x.HataridoVeg).ToList(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
LResult = LProjekt.ToList();
|
||||
}
|
||||
|
||||
var cnt = LResult.Count;
|
||||
var result = LResult.ToDataSourceResult();
|
||||
result.Total = cnt;
|
||||
result.Data = GetPage(LResult, request.Page, request.PageSize, cnt);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return new DataSourceResult();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new DataSourceResult();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage SaveJelentkezes([FromBody] int projektId)
|
||||
{
|
||||
var co = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetProjektFelhasznaloData();
|
||||
var kozpontiResult = kgrClient.ProjektJelentkezes(
|
||||
new Client.KGR.Model.ProjektJelentkezesModel()
|
||||
{
|
||||
IntezmenyId = ClaimData.IntezmenyGuid.Value,
|
||||
OktatasiAzonosito = co.OktatasiAzonosito,
|
||||
IdpEgyediazonosito = Guid.Parse(co.IdpEgyediAzonosito),
|
||||
AlkalmazottNev = co.NyomtatasiNev,
|
||||
ProjektId = projektId,
|
||||
AlkalmazottId = ClaimData.FelhasznaloId,
|
||||
IsJelentkezett = true,
|
||||
Retrieve = true
|
||||
}
|
||||
);
|
||||
|
||||
if (kozpontiResult != null)
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Hiba a jelentkezés során!");
|
||||
}
|
||||
|
||||
List<ProjektGridModel> GetPage(List<ProjektGridModel> list, int page, int pageSize, int fullCnt)
|
||||
{
|
||||
page--;
|
||||
return list.Skip(page * pageSize).Take(pageSize).ToList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.KGR;
|
||||
using Kreta.Client.KGR.Request;
|
||||
using Kreta.Core.KozpontiModels.TargyiEszkozModels;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.GRModul.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class TargyiEszkozokApiController : ApiController
|
||||
{
|
||||
private readonly IKGRClient kgrClient;
|
||||
|
||||
public TargyiEszkozokApiController(IKGRClient kgrClient)
|
||||
{
|
||||
this.kgrClient = kgrClient ?? throw new ArgumentNullException(nameof(kgrClient));
|
||||
}
|
||||
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var kozpontiResult = kgrClient.KGREszkozList(new EszkozHeaderRequest() { IntezmenyGuid = ClaimData.IntezmenyGuid.ToString(), IntezmenyAzonosito = ClaimData.IntezmenyAzonosito });
|
||||
|
||||
List<TargyiEszkozResponseModel> result = new List<TargyiEszkozResponseModel>();
|
||||
if (kozpontiResult != null)
|
||||
{
|
||||
var cnt = 0;
|
||||
foreach (var item in kozpontiResult)
|
||||
{
|
||||
result.Add(new TargyiEszkozResponseModel()
|
||||
{
|
||||
EszkozLeltarszam = item.Leltarszam,
|
||||
EszkozPenzugyiKozpontNev = "",
|
||||
EszkozLeltarkorzetNev = "",
|
||||
EszkozMennyisegNev = "",
|
||||
EszkozMennyiseg = 1,
|
||||
EszkozMuszakicsoportkodNev = "",
|
||||
EszkozMegnevezes3 = "",
|
||||
EszkozMegnevezes2 = "",
|
||||
EszkozGyariSzam = item.GyariSzam,
|
||||
EszkozMegnevezes = item.Megnevezes,
|
||||
SzuletesiHely = "",
|
||||
AdoAzonosito = "",
|
||||
OktatasiAzonosito = "",
|
||||
AlkalmazottNev = item.AlkalmazottNev,
|
||||
AlkalmazottId = item.AlkalmazottId,
|
||||
SzTSzAzonosito = item.SztszAzonosito,
|
||||
FunkcioTerulet = "",
|
||||
SorId = cnt,
|
||||
SzuletesiIdo = DateTime.Now,
|
||||
EszkozAktivalasDatum = item.AktivalasDatum.Value
|
||||
});
|
||||
cnt++;
|
||||
}
|
||||
return Request.CreateResponse(HttpStatusCode.OK, result.ToDataSourceResult(), Configuration.Formatters.JsonFormatter);
|
||||
}
|
||||
|
||||
throw new StatusError(Enums.ManualEnums.CustomHTTPStatusEnum.HibaMiattNincsMegjelenithetoAdat, GRModulResource.KozpontiSzerverNemElerheto);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core.KozpontiModels.UzletiTervezesModels;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.GRModul.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.GRModul.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.GazdasagiUgyintezo.ClaimValue)]
|
||||
public class UzletiTervezesApiController : ApiController
|
||||
{
|
||||
private readonly IKozpontiKretaHelper KozpontiKretaHelper;
|
||||
private readonly Dictionary<HonapokEnum, int> honapSorszamaByHonap = new Dictionary<HonapokEnum, int>
|
||||
{
|
||||
{ HonapokEnum.Januar, 1 },
|
||||
{ HonapokEnum.Februar, 2 },
|
||||
{ HonapokEnum.Marcius, 3 },
|
||||
{ HonapokEnum.Aprilis, 4 },
|
||||
{ HonapokEnum.Majus, 5 },
|
||||
{ HonapokEnum.Junius, 6 },
|
||||
{ HonapokEnum.Julius, 7 },
|
||||
{ HonapokEnum.Augusztus, 8 },
|
||||
{ HonapokEnum.Szeptember, 9 },
|
||||
{ HonapokEnum.Oktober, 10 },
|
||||
{ HonapokEnum.November, 11 },
|
||||
{ HonapokEnum.December, 12 }
|
||||
};
|
||||
|
||||
public UzletiTervezesApiController(IKozpontiKretaHelper kozpontiKretaHelper)
|
||||
{
|
||||
KozpontiKretaHelper = kozpontiKretaHelper ?? throw new ArgumentNullException(nameof(kozpontiKretaHelper));
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetUzletiTervek(string data)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<UzletiTervSearchModel>(data);
|
||||
TanevCO tanevCO;
|
||||
TanevHelper tanevHelper = new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
tanevCO = tanevHelper.GetTanevInfo();
|
||||
|
||||
DateTime idoszak = GetIdoszak(model.Honap, tanevCO.KezdoNap.Date.Year, tanevCO.UtolsoTanitasiNapVegzos.Date.Year);
|
||||
|
||||
var result = KozpontiKretaHelper.GetIntezmenyUzletiTerv(new UzletiTervezesIntezmenyRequestModel()
|
||||
{ IntezmenyAzonosito = ClaimData.IntezmenyAzonosito, Idoszak = idoszak });
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new StatusError(Enums.ManualEnums.CustomHTTPStatusEnum.HibaMiattNincsMegjelenithetoAdat, GRModulResource.KozpontiSzerverNemElerheto);
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK, result.ToDataSourceResult(), Configuration.Formatters.JsonFormatter);
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetAlkalmazottTenyAdatok(string data)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<UzletiTervSearchModel>(data);
|
||||
TanevCO tanevCO;
|
||||
TanevHelper tanevHelper = new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
tanevCO = tanevHelper.GetTanevInfo();
|
||||
|
||||
DateTime idoszak = GetIdoszak(model.Honap, tanevCO.KezdoNap.Date.Year, tanevCO.UtolsoTanitasiNapVegzos.Date.Year);
|
||||
|
||||
var result = KozpontiKretaHelper.GetIntezmenyUzletiTervAlkalmazottaknak(new UzletiTervezesAlkalmazottRequestModel()
|
||||
{ IntezmenyAzonosito = ClaimData.IntezmenyAzonosito, Idoszak = idoszak });
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new StatusError(Enums.ManualEnums.CustomHTTPStatusEnum.HibaMiattNincsMegjelenithetoAdat, GRModulResource.KozpontiSzerverNemElerheto);
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK, result.ToDataSourceResult(), Configuration.Formatters.JsonFormatter);
|
||||
}
|
||||
|
||||
private DateTime GetIdoszak(HonapokEnum honap, int kezdoNapEv, int utolsoTanitasaNapEv)
|
||||
{
|
||||
DateTime idoszak;
|
||||
switch (honap)
|
||||
{
|
||||
case HonapokEnum.Szeptember:
|
||||
case HonapokEnum.Oktober:
|
||||
case HonapokEnum.November:
|
||||
case HonapokEnum.December:
|
||||
idoszak = new DateTime(kezdoNapEv, honapSorszamaByHonap[honap], 1);
|
||||
break;
|
||||
default:
|
||||
idoszak = new DateTime(utolsoTanitasaNapEv, honapSorszamaByHonap[honap], 1);
|
||||
break;
|
||||
}
|
||||
|
||||
return idoszak;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue