namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic { using System; using System.Collections.Generic; using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Felmentes; using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum; using Kreta.Core.Exceptions; public static class TanuloLogic { public static bool CalculateIsNowFelmentett(List felmentesek, DateTime examinedDate, int intezmenyId, string intezmenyAzonosito, int tanevId, FelmentesType felmentesTypeFilter = FelmentesType.None) { foreach (var felmentes in felmentesek) { if (FelmentesLogic.CalculateIsNowFelmentettByDatum(examinedDate, felmentes.KezdetDatuma, felmentes.VegDatuma)) { switch (felmentesTypeFilter) { case FelmentesType.None: return felmentes.IsOralatogatasAlolFelmentett || felmentes.IsErtekelesAlolFelmentett; case FelmentesType.OralatogatasAlol: return felmentes.IsOralatogatasAlolFelmentett; case FelmentesType.ErtekelesAlol: return felmentes.IsErtekelesAlolFelmentett; case FelmentesType.OralatogatasEsErtekelesAlol: return felmentes.IsOralatogatasAlolFelmentett && felmentes.IsErtekelesAlolFelmentett; default: throw new BlException($"{nameof(FelmentesType)} does not exist!"); } } } return false; } public static bool CalculateIsNowMagantanulo(bool isMagantanulo, DateTime? maganTanulosagKezdetDatuma, DateTime? maganTanulosagVegeDatuma, DateTime oraDatuma) => isMagantanulo && (!maganTanulosagKezdetDatuma.HasValue || maganTanulosagKezdetDatuma.Value <= oraDatuma) && (!maganTanulosagVegeDatuma.HasValue || maganTanulosagVegeDatuma.Value >= oraDatuma); } }