This commit is contained in:
@@ -4402,24 +4402,30 @@ namespace AyaNova.Biz
|
||||
|
||||
internal async Task<Contract> GetCurrentWorkOrderContractFromRelatedAsync(AyaType ayaType, long id)
|
||||
{
|
||||
//instantiated method to save adding the context
|
||||
if (mFetchedContractAlready == false)
|
||||
{
|
||||
mContractInEffect = await GetCurrentWorkOrderContractFromRelatedAsync(ayaType, id, ct);
|
||||
mFetchedContractAlready = true;
|
||||
long WoId = await GetWorkOrderIdFromRelativeAsync(ayaType, id, ct);
|
||||
var WoContractId = await ct.WorkOrder.AsNoTracking().Where(z => z.Id == WoId).Select(z => z.ContractId).FirstOrDefaultAsync();
|
||||
await GetCurrentContractFromContractIdAsync(WoContractId);
|
||||
}
|
||||
return mContractInEffect;
|
||||
}
|
||||
internal static async Task<Contract> GetCurrentWorkOrderContractFromRelatedAsync(AyaType ayaType, long id, AyContext ct)
|
||||
|
||||
|
||||
internal async Task<Contract> GetCurrentContractFromContractIdAsync(long? id)
|
||||
{
|
||||
//static method
|
||||
long WoId = await GetWorkOrderIdFromRelativeAsync(ayaType, id, ct);
|
||||
var WoContractId = await ct.WorkOrder.AsNoTracking().Where(z => z.Id == WoId).Select(z => z.ContractId).FirstOrDefaultAsync();
|
||||
if (WoContractId == null)
|
||||
if (id == null) return null;
|
||||
if (mFetchedContractAlready == false)
|
||||
{
|
||||
return null;
|
||||
mContractInEffect = await ct.Contract.AsNoTracking()
|
||||
.Include(c => c.ServiceRateItems)
|
||||
.Include(c => c.TravelRateItems)
|
||||
.Include(c => c.ContractPartOverrideItems)
|
||||
.Include(c => c.ContractTravelRateOverrideItems)
|
||||
.Include(c => c.ContractServiceRateOverrideItems)
|
||||
.FirstOrDefaultAsync(z => z.Id == id);
|
||||
}
|
||||
return await ct.Contract.AsNoTracking().FirstOrDefaultAsync(z => z.Id == WoContractId);
|
||||
return mContractInEffect;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user