This commit is contained in:
@@ -105,9 +105,11 @@ namespace AyaNova.PickList
|
|||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
var c = ct.Contract
|
var c = ct.Contract
|
||||||
.AsNoTracking()
|
.Include(z => z.ServiceRateItems)
|
||||||
.Where(z => z.Id == contractId)
|
.AsNoTracking()
|
||||||
.FirstOrDefault();
|
.Where(z => z.Id == contractId)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (c == null)
|
if (c == null)
|
||||||
return defaultNoContractRatesCriteria;
|
return defaultNoContractRatesCriteria;
|
||||||
|
|
||||||
@@ -117,13 +119,13 @@ namespace AyaNova.PickList
|
|||||||
|
|
||||||
//contract allows any items plus contract items if exist
|
//contract allows any items plus contract items if exist
|
||||||
//If no service rate items in contract then short circuit to regular list
|
//If no service rate items in contract then short circuit to regular list
|
||||||
if (c.ServiceRateItems.Count == 0)
|
if (c.ServiceRateItems.Count == 0)
|
||||||
return defaultNoContractRatesCriteria;
|
return defaultNoContractRatesCriteria;
|
||||||
|
|
||||||
//Ok, a bit more complex then, all non contract rates plus a select few contract rates
|
//Ok, a bit more complex then, all non contract rates plus a select few contract rates
|
||||||
return $"(aservicerate.contractonly=false) or (aservicerate.id in ({string.Join(",", c.ServiceRateItems.Select(z => z.ServiceRateId).ToArray())}))";
|
return $"(aservicerate.contractonly=false) or (aservicerate.id in ({string.Join(",", c.ServiceRateItems.Select(z => z.ServiceRateId).ToArray())}))";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultNoContractRatesCriteria;
|
return defaultNoContractRatesCriteria;
|
||||||
|
|||||||
@@ -104,23 +104,24 @@ namespace AyaNova.PickList
|
|||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
var c = ct.Contract
|
var c = ct.Contract
|
||||||
.AsNoTracking()
|
.Include(z => z.TravelRateItems)
|
||||||
.Where(z => z.Id == contractId)
|
.AsNoTracking()
|
||||||
.FirstOrDefault();
|
.Where(z => z.Id == contractId)
|
||||||
|
.FirstOrDefault();
|
||||||
if (c == null)
|
if (c == null)
|
||||||
return defaultNoContractRatesCriteria;
|
return defaultNoContractRatesCriteria;
|
||||||
|
|
||||||
//only fetch items that are in the contract rates
|
//only fetch items that are in the contract rates
|
||||||
if (c.ContractServiceRatesOnly)
|
if (c.ContractServiceRatesOnly)
|
||||||
return $"atravelrate.id in ({string.Join(",", c.ServiceRateItems.Select(z => z.ServiceRateId).ToArray())})";
|
return $"atravelrate.id in ({string.Join(",", c.TravelRateItems.Select(z => z.TravelRateId).ToArray())})";
|
||||||
|
|
||||||
//contract allows any items plus contract items if exist
|
//contract allows any items plus contract items if exist
|
||||||
//If no service rate items in contract then short circuit to regular list
|
//If no travel rate items in contract then short circuit to regular list
|
||||||
if (c.ServiceRateItems.Count == 0)
|
if (c.TravelRateItems.Count == 0)
|
||||||
return defaultNoContractRatesCriteria;
|
return defaultNoContractRatesCriteria;
|
||||||
|
|
||||||
//Ok, a bit more complex then, all non contract rates plus a select few contract rates
|
//Ok, a bit more complex then, all non contract rates plus a select few contract rates
|
||||||
return $"(atravelrate.contractonly=false) or (atravelrate.id in ({string.Join(",", c.ServiceRateItems.Select(z => z.ServiceRateId).ToArray())}))";
|
return $"(atravelrate.contractonly=false) or (atravelrate.id in ({string.Join(",", c.TravelRateItems.Select(z => z.TravelRateId).ToArray())}))";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user