kreta/Kreta.WebApi/eUgyintezes/Kreta.eUgyintezes.BusinessLogic/Service.cs
2024-03-13 00:33:46 +01:00

55 lines
1.4 KiB
C#

using System;
using Kreta.DataAccessManual;
using Kreta.Eugyintezes.BusinessLogic.Interface;
namespace Kreta.Eugyintezes.BusinessLogic
{
internal class Service
{
protected IServiceContext ServiceContext { get; }
private int tanevId;
private int intezmenyId;
protected int TanevId
{
get
{
if (tanevId <= 0)
{
tanevId = GetTanevId();
}
return tanevId;
}
}
protected int IntezmenyId
{
get
{
if (intezmenyId <= 0)
{
intezmenyId = GetIntezmenyId();
}
return intezmenyId;
}
}
private int GetTanevId()
{
return Dal.MobileConnection.Run(ServiceContext.IntezmenyAzonosito, null, h => h.TanevDal().GetAktivTanevId());
}
private int GetIntezmenyId()
{
var azonosito = ServiceContext.IntezmenyAzonosito;
return Dal.MobileConnection.Run(ServiceContext.IntezmenyAzonosito, null, h => h.IntezmenyDal().GetIntezmenyIdByAzonosito(azonosito).Value);
}
public Service(IServiceContext serviceContext)
{
this.ServiceContext = serviceContext ?? throw new ArgumentNullException(nameof(serviceContext));
}
}
}