This commit is contained in:
@@ -388,13 +388,13 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//CONTRACT AUTO SET
|
//CONTRACT AUTO SET
|
||||||
//failsafe
|
//failsafe
|
||||||
newObj.ContractId = null;
|
newObj.ContractId = null;
|
||||||
|
|
||||||
if (newObj.CustomerId != 0)
|
if (newObj.CustomerId != 0)
|
||||||
{
|
{
|
||||||
//precedence: unit->customer->headoffice
|
//precedence: unit->customer->headoffice
|
||||||
var cust = await ct.Customer.AsNoTracking().Where(z => z.Id == newObj.CustomerId).Select(z => new { headofficeId = z.HeadOfficeId, contractId = z.ContractId, contractExpires = z.ContractExpires }).FirstOrDefaultAsync();
|
var cust = await ct.Customer.AsNoTracking().Where(z => z.Id == newObj.CustomerId).Select(z => new { headofficeId = z.HeadOfficeId, contractId = z.ContractId, contractExpires = z.ContractExpires }).FirstOrDefaultAsync();
|
||||||
//var testCust = await ct.Customer.AsNoTracking().FirstOrDefaultAsync(z=>z.Id==newObj.CustomerId);
|
|
||||||
//first set it to the customer one if available in case the ho one has expired then set the ho if applicable
|
//first set it to the customer one if available in case the ho one has expired then set the ho if applicable
|
||||||
if (cust.contractId != null && cust.contractExpires > DateTime.UtcNow)
|
if (cust.contractId != null && cust.contractExpires > DateTime.UtcNow)
|
||||||
newObj.ContractId = cust.contractId;
|
newObj.ContractId = cust.contractId;
|
||||||
|
|||||||
Reference in New Issue
Block a user