kreta/Kreta.WebApi/Ellenorzo/Kreta.Ellenorzo.BL/VN/Intezmeny/Rendszermodul/RendszermodulSubqueries.cs
2024-03-13 00:33:46 +01:00

63 lines
3.2 KiB
C#

using System.Collections.Generic;
using Kreta.BusinessLogic.Helpers;
using Kreta.Core.ConnectionType;
using Kreta.DataAccessManual.Util;
using Kreta.Ellenorzo.Domain.VN.Common;
using Kreta.Ellenorzo.Domain.VN.Intezmeny.Rendszermodul;
using Kreta.Ellenorzo.Enums.VN;
using Kreta.Enums;
using Kreta.Enums.ManualEnums;
using Kreta.KretaServer.SystemSettings;
namespace Kreta.Ellenorzo.BL.VN.Intezmeny.Rendszermodul
{
internal static class RendszermodulSubqueries
{
internal static HashSet<RendszermodulListResponse> ListRendszermodul(DefaultConnectionParameters dcp)
{
var helper = new IntezmenyConfigHelper(new DalHandlerConnectionType(new MobileConnectionType(dcp.FelhasznaloId, dcp.IntezmenyId, dcp.IntezmenyAzonosito, dcp.TanevId), dcp.DalHandler));
var isEugyintezesEnabled = helper.GetIntezmenyConfig<bool>(IntezmenyConfigModulEnum.Eugyintezes, IntezmenyConfigTipusEnum.IsEnabled);
var isLepEnabled = SystemSettingsManager.GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Lazar_Ervin_Program_kezelese, dcp.IntezmenyAzonosito, dcp.TanevId);
var feltarAszfUrl = helper.GetIntezmenyConfig<string>(IntezmenyConfigModulEnum.FeltarASZFGondviselo, IntezmenyConfigTipusEnum.Url);
var isFeltarGondviseloEnabled = IsFeltarGondviseloEnabled(dcp, helper);
var response = new HashSet<RendszermodulListResponse>(new RendszermodulListResponse())
{
new RendszermodulListResponse
{
Tipus = RendszermodulTipus.Eugyintezes,
IsAktiv = isEugyintezesEnabled
},
new RendszermodulListResponse
{
Tipus = RendszermodulTipus.LEP,
IsAktiv = isLepEnabled
},
new RendszermodulListResponse
{
Tipus = RendszermodulTipus.FeltarGondviselo,
IsAktiv = isFeltarGondviseloEnabled
},
new RendszermodulListResponse
{
Tipus = RendszermodulTipus.FeltarAszf,
IsAktiv = isFeltarGondviseloEnabled,
Url = feltarAszfUrl //A FeltarGondviselobe kell athelyezni
}
};
return response;
}
private static bool IsFeltarGondviseloEnabled(DefaultConnectionParameters dcp, IntezmenyConfigHelper helper)
{
if (!helper.GetIntezmenyConfig<bool>(IntezmenyConfigModulEnum.FeltarGondviselo, IntezmenyConfigTipusEnum.IsEnabled))
{
return false;
}
return dcp.GondviseloId.HasValue
? new GondviseloHelper(new DalHandlerConnectionType(new MobileConnectionType(dcp.FelhasznaloId, dcp.IntezmenyId, dcp.IntezmenyAzonosito, dcp.TanevId), dcp.DalHandler)).IsGondviseloTanuloinakEvfolyamTipusaLetezik(dcp.GondviseloId.Value, Core.Constants.FeltarEvfolyamList)
: new TanuloHelper(new DalHandlerConnectionType(new MobileConnectionType(dcp.FelhasznaloId, dcp.IntezmenyId, dcp.IntezmenyAzonosito, dcp.TanevId), dcp.DalHandler)).IsTanuloFeltarEvfolyamos();
}
}
}