This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,49 @@
using System.Net.Mime;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Resources;
using Kreta.Web.Areas.HRModul.Logic;
using Kreta.Web.Areas.HRModul.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.HRModul.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageAuthorize(KretaClaimPackages.TavolletIgenylo.ClaimValue)]
//[MvcFeatureMaintenance(Core.Constants.FeatureName.HRModul)]
//[MvcFeatureAuthorize(Core.Constants.FeatureName.HRModul)]
public class TavolletListaController : Controller
{
public ActionResult Index()
{
if (ClaimData.IsAdministrator || new HRModulHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).IsHrKezelo() || new TavolletjelentoLogic().HasSZTSZKOD(ClaimData.FelhasznaloId))
{
var model = new TavolletListaLogic().GetTavolletListaSearchModel();
return View("Index", model);
}
return View("~/Areas/HRModul/Views/Tavolletjelento/IndexError.cshtml");
}
[HttpPost]
[MvcValidateAjaxAntiForgeryToken]
public ActionResult Export(TavolletListaSearchModel model)
{
var helper = new HRModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var alkalmazottHelper = new AlkalmazottHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var (kozpontiResult, sztszAzonositok) = new TavolletListaLogic().GetTavolletBefogadottLista(model, helper, alkalmazottHelper);
using (var ms = helper.GetTavolletListaExport(kozpontiResult, sztszAzonositok, alkalmazottHelper))
{
return new FileContentResult(ms.ToArray(), MediaTypeNames.Application.Octet)
{
FileDownloadName = HttpUtility.UrlEncode(HRModulResource.SzamfejtettTavolletekExportFileName, Encoding.UTF8),
};
}
}
}
}

View file

@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Interfaces;
using Kreta.BusinessLogic.Security;
using Kreta.Client.Tavollet;
using Kreta.Core;
using Kreta.Core.Configuratiaton;
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
using Kreta.Enums;
using Kreta.Enums.ManualEnums;
using Kreta.Resources;
using Kreta.Web.Areas.HRModul.Logic;
using Kreta.Web.Areas.HRModul.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Helpers.Error;
using Kreta.Web.Models.EditorTemplates;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.HRModul.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageAuthorize(KretaClaimPackages.TavolletIgenylo.ClaimValue)]
//[MvcFeatureMaintenance(Core.Constants.FeatureName.HRModul)]
//[MvcFeatureAuthorize(Core.Constants.FeatureName.HRModul)]
public class TavolletjelentoController : Controller
{
private IIktatoRepositoryFactory IktatoRepositoryFactory { get; }
private IktatoServiceConfiguration IktatoServiceConfiguration { get; }
private IFileServiceHelper FileServiceHelper { get; }
public TavolletjelentoController(IIktatoRepositoryFactory iktatoServiceFactory, IktatoServiceConfiguration iktatoServiceConfiguration, IFileServiceHelper fileServiceHelper)
{
IktatoRepositoryFactory = iktatoServiceFactory ?? throw new ArgumentNullException(nameof(iktatoServiceFactory));
IktatoServiceConfiguration = iktatoServiceConfiguration ?? throw new ArgumentNullException(nameof(iktatoServiceConfiguration));
FileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
}
public ActionResult Index()
{
var logic = new TavolletjelentoLogic();
if (!logic.HasValidMunkaviszony(ClaimData.FelhasznaloId))
{
return View("IndexErrorMunkaviszony");
}
if (ClaimData.IsAdministrator || logic.HasSZTSZKOD(ClaimData.FelhasznaloId))
{
var model = logic.GetNewTavolletjelentoSearchModel(false);
return View("Index", model);
}
else
{
return View("IndexError");
}
}
public ActionResult Kezeles()
{
var helper = new HRModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
if (helper.IsLeader() || ClaimData.IsDefaultAdminUser || ClaimData.FelhasznaloSzerepkor == SzerepkorTipusEnum.Adminisztrator || helper.IsHrKezelo())
{
var logic = new TavolletjelentoLogic();
var model = logic.GetNewTavolletjelentoSearchModel(true);
return View("Index", model);
}
return View("~/Views/ErrorHandler/AccessDenied.cshtml");
}
public ActionResult FoglalkoztatottakAdatai()
{
var helper = new HRModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
if (helper.IsLeader() || ClaimData.IsDefaultAdminUser || ClaimData.FelhasznaloSzerepkor == SzerepkorTipusEnum.Adminisztrator || helper.IsHrKezelo())
{
var logic = new TavolletjelentoLogic();
var model = logic.GetNewTavolletjelentoSearchModel(true);
return View("FoglalkoztatottakAdatai", model);
}
return View("~/Views/ErrorHandler/AccessDenied.cshtml");
}
public ActionResult OpenTavolletjelentoDetailPopUp(int Id)
{
var model = new TavolletjelentoLogic().GetModifyTavolletjelentoModel(Id);
model.ViewType = TavolletjelentoViewTypeEnum.Detail;
var pm = new PopUpModel(model, "Tavolletjelento_Bevitel");
pm = pm.AddCancelBtn(pm, "TavolletjelentoHelper.CancelTavolletjelentoWindow");
return PartialView(Constants.General.PopupView, pm);
}
public ActionResult OpenTavolletjelentoNewPopUp(bool isKezeles)
{
var model = new TavolletjelentoLogic().GetNewTavolletjelentoModel(isKezeles);
var pm = new PopUpModel(model, "Tavolletjelento_Bevitel");
pm = pm.AddCancelBtn(pm, "TavolletjelentoHelper.CancelTavolletjelentoWindow");
pm = pm.AddBtn(pm, "saveBtn", HRModulResource.Feladas, "TavolletjelentoHelper.GetFilesToPost", containerCssClass: "BtnOk");
return PartialView(Constants.General.PopupView, pm);
}
public ActionResult OpenTavolletjelentoModifyPopUp(int Id, bool IsHianypotlas, WorkflowMuveletEnum Muvelet, Guid? eredetiRogzitoGuid)
{
var model = new TavolletjelentoLogic().GetModifyTavolletjelentoModel(Id, Muvelet);
var btnMsg = HRModulResource.Modositas;
if (model.IsHianypotlas && Muvelet == WorkflowMuveletEnum.CsakModositas)
{
btnMsg = HRModulResource.Ujrafeladás;
}
else if (model.Muvelet == WorkflowMuveletEnum.Hianypotlas && model.IsLeaderCall)
{
btnMsg = HRModulResource.HPVisszakuldes;
model.EredetiRogzitoGuid = eredetiRogzitoGuid;
}
var pm = new PopUpModel(model, "Tavolletjelento_Bevitel");
pm = pm.AddCancelBtn(pm, "TavolletjelentoHelper.CancelTavolletjelentoWindow");
pm = pm.AddBtn(pm, "ModifyBtn", btnMsg, "TavolletjelentoHelper.GetFilesToPost", containerCssClass: "BtnOk");
return PartialView(Constants.General.PopupView, pm);
}
public ActionResult OpenTobbesTavolletjelentoModifyPopUp(List<int> Ids, bool ElteroSorok = false)
{
var model = new TavolletjelentoLogic().GetTobbesModifyTavolletjelentoModel(Ids);
var btnMsg = HRModulResource.Modositasok;
var pm = new PopUpModel(model, "Tavolletjelento_TobbesBevitel");
pm = pm.AddCancelBtn(pm, "TavolletjelentoHelper.CancelTavolletjelentoWindow");
pm = pm.AddBtn(pm, "ModifyBtn", btnMsg, "TavolletjelentoHelper.saveTobbesTavollet", containerCssClass: "BtnOk");
return PartialView(Constants.General.PopupView, pm);
}
public ActionResult GetFile(int fileId, string isDokumentum)
{
try
{
var helper = new PoszeidonHelper(ConnectionTypeExtensions.GetSessionConnectionType(), IktatoRepositoryFactory, IktatoServiceConfiguration);
var (fajlnev, tartalom) = (isDokumentum == "T") ? helper.Lekeres(fileId.ToString()) : helper.LekeresCsatolmany(FileServiceHelper, fileId.ToString());
return new FileStreamResult(new MemoryStream(tartalom), "application/octet-stream")
{
FileDownloadName = fajlnev
};
}
catch (Exception ex)
{
throw new StatusError(HttpStatusCode.BadRequest, ex.Message, ex);
}
}
[HttpPost]
[MvcValidateAjaxAntiForgeryToken]
public ActionResult Export(TavolletjelentoSearchModel model)
{
var helper = new HRModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var kozpontiResult = new TavolletjelentoLogic().GetTavolletjelentoLista(model, helper);
using (var ms = helper.GetTavolletjelentoExport(kozpontiResult))
{
return new FileContentResult(ms.ToArray(), MediaTypeNames.Application.Octet)
{
FileDownloadName = HttpUtility.UrlEncode(HRModulResource.TavolletIgenyekExportFileName, Encoding.UTF8),
};
}
}
public ActionResult ExportAlkalmazottakAdatai(TavolletjelentoSearchModel model)
{
var helper = new HRModulHelper(ConnectionTypeExtensions.GetSessionConnectionType());
if (helper.IsLeader() || ClaimData.IsDefaultAdminUser || ClaimData.FelhasznaloSzerepkor == SzerepkorTipusEnum.Adminisztrator || helper.IsHrKezelo())
{
var tanev = new TanevHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var tanevCo = tanev.GetTanevInfo();
var kozpontiKreta = (KozpontiKretaConfiguration)ConfigurationManager.GetSection("KozpontiKretaConfig");
var client = new TavolletClient(kozpontiKreta.KgrUrl, kozpontiKreta.ApiKey);
var kozpontiResult = client.GetTavolletAlkalmazottakAdatai(model.ConvertToTavolletAdatokRequestModel(tanevCo.Sorszam));
using (var ms = helper.GetTavolletAlkalmazottakAdataiExport(kozpontiResult))
{
return new FileContentResult(ms.ToArray(), MediaTypeNames.Application.Octet)
{
FileDownloadName = HttpUtility.UrlEncode(HRModulResource.AlkalmazottakAdataiExportFileName, Encoding.UTF8),
};
}
}
// Megfelelő jog nélkül nem lehet exportálni!
throw new StatusError((int)HttpStatusCode.InternalServerError, HRModulResource.NincsJogosultsagaALetolteshez);
}
}
}