init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
64
Kreta.BusinessLogic/Helpers/LicenceHelper.cs
Normal file
64
Kreta.BusinessLogic/Helpers/LicenceHelper.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
|
||||
namespace Kreta.BusinessLogic.Helpers
|
||||
{
|
||||
public static class LicenceHelper
|
||||
{
|
||||
private static DateTime LicenceLejaratiDatum(string licenceDatum)
|
||||
{
|
||||
return Convert.ToDateTime(licenceDatum);
|
||||
}
|
||||
|
||||
public static LicenceTipusaEnum LicenceLejaratAllapota(string licenceDatum)
|
||||
{
|
||||
DateTime datum = LicenceLejaratiDatum(licenceDatum);
|
||||
var now = DateTime.Now;
|
||||
|
||||
if (datum < now.AddYears(-1))
|
||||
{
|
||||
return LicenceTipusaEnum.EgyEveLejart;
|
||||
}
|
||||
|
||||
if (datum < now.AddMonths(-3))
|
||||
{
|
||||
return LicenceTipusaEnum.NegyedEveLejart;
|
||||
}
|
||||
|
||||
if (datum < now.AddMonths(-1))
|
||||
{
|
||||
return LicenceTipusaEnum.EgyHonapjaLejart;
|
||||
}
|
||||
|
||||
if (datum < now)
|
||||
{
|
||||
return LicenceTipusaEnum.Lejart;
|
||||
}
|
||||
|
||||
return LicenceTipusaEnum.Aktiv;
|
||||
}
|
||||
|
||||
private static int LicenceWaitTime(string licenceDatum)
|
||||
{
|
||||
var allapot = LicenceLejaratAllapota(licenceDatum);
|
||||
switch (allapot)
|
||||
{
|
||||
case LicenceTipusaEnum.EgyEveLejart:
|
||||
return 30;
|
||||
case LicenceTipusaEnum.NegyedEveLejart:
|
||||
return 10;
|
||||
case LicenceTipusaEnum.EgyHonapjaLejart:
|
||||
return 3;
|
||||
case LicenceTipusaEnum.Lejart:
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void LicenceWait(string licenceDatum)
|
||||
{
|
||||
Thread.Sleep(1000 * LicenceWaitTime(licenceDatum));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue