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)); } } }