This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -48,7 +48,7 @@
|
||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_REPORT_RENDERING_TIMEOUT":"8",
|
||||
"AYANOVA_REPORT_RENDERING_TIMEOUT":"7",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "large",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
||||
},
|
||||
|
||||
@@ -58,7 +58,9 @@ namespace AyaNova.Biz
|
||||
AuthorizationRoles.BizAdmin,
|
||||
UserType.NotService);//picked not service arbitrarily, probably a non-factor
|
||||
}
|
||||
|
||||
//request cache for viz fields
|
||||
private VizCache vc = new VizCache();
|
||||
private ObjectCache oc = new ObjectCache();
|
||||
|
||||
/*
|
||||
██████╗ ███╗ ███╗
|
||||
@@ -880,36 +882,67 @@ namespace AyaNova.Biz
|
||||
|
||||
//Alert notes
|
||||
//Customer notes first then others below
|
||||
var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.AlertNotes, x.TechNotes, x.Name, x.Phone1, x.Phone2, x.Phone3, x.Phone4, x.Phone5, x.EmailAddress }).FirstOrDefaultAsync();
|
||||
if (!string.IsNullOrWhiteSpace(custInfo.AlertNotes))
|
||||
{
|
||||
o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertNotes}\n\n";
|
||||
if (vc.Get("wocustname", o.CustomerId) == null)//will always be present so no need to check other values
|
||||
{
|
||||
var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.AlertNotes, x.TechNotes, x.Name, x.Phone1, x.Phone2, x.Phone3, x.Phone4, x.Phone5, x.EmailAddress }).FirstOrDefaultAsync();
|
||||
vc.Add(custInfo.Name, "wocustname", o.CustomerId);
|
||||
if (!string.IsNullOrWhiteSpace(custInfo.AlertNotes))
|
||||
{
|
||||
vc.Add($"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertNotes}\n\n", "woalert", o.CustomerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
vc.Add(string.Empty, "woalert", o.CustomerId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(custInfo.TechNotes))
|
||||
{
|
||||
vc.Add($"{await Translate("CustomerTechNotes")}\n{custInfo.TechNotes}\n\n", "custtechnotes", o.CustomerId);
|
||||
}
|
||||
|
||||
vc.Add(custInfo.Phone1, "custphone1", o.CustomerId);
|
||||
vc.Add(custInfo.Phone2, "custphone2", o.CustomerId);
|
||||
vc.Add(custInfo.Phone3, "custphone3", o.CustomerId);
|
||||
vc.Add(custInfo.Phone4, "custphone4", o.CustomerId);
|
||||
vc.Add(custInfo.Phone5, "custphone5", o.CustomerId);
|
||||
vc.Add(custInfo.EmailAddress, "custemail", o.CustomerId);
|
||||
}
|
||||
o.CustomerViz = vc.Get("wocustname", o.CustomerId);
|
||||
o.AlertViz = vc.Get("woalert", o.CustomerId);
|
||||
o.CustomerTechNotesViz = vc.Get("custtechnotes", o.CustomerId);
|
||||
o.CustomerPhone1Viz = vc.Get("custphone1", o.CustomerId);
|
||||
o.CustomerPhone2Viz = vc.Get("custphone2", o.CustomerId);
|
||||
o.CustomerPhone3Viz = vc.Get("custphone3", o.CustomerId);
|
||||
o.CustomerPhone4Viz = vc.Get("custphone4", o.CustomerId);
|
||||
o.CustomerPhone5Viz = vc.Get("custphone5", o.CustomerId);
|
||||
o.CustomerEmailAddressViz = vc.Get("custemail", o.CustomerId);
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(custInfo.TechNotes))
|
||||
{
|
||||
o.CustomerTechNotesViz = $"{await Translate("CustomerTechNotes")}\n{custInfo.TechNotes}\n\n";
|
||||
}
|
||||
|
||||
o.CustomerViz = custInfo.Name;
|
||||
o.CustomerPhone1Viz = custInfo.Phone1;
|
||||
o.CustomerPhone2Viz = custInfo.Phone2;
|
||||
o.CustomerPhone3Viz = custInfo.Phone3;
|
||||
o.CustomerPhone4Viz = custInfo.Phone4;
|
||||
o.CustomerPhone5Viz = custInfo.Phone5;
|
||||
o.CustomerEmailAddressViz = custInfo.EmailAddress;
|
||||
|
||||
if (o.ProjectId != null)
|
||||
o.ProjectViz = await ct.Project.AsNoTracking().Where(x => x.Id == o.ProjectId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
{
|
||||
string value = vc.Get("projname", o.ProjectId);
|
||||
if (value == null)
|
||||
{
|
||||
value = await ct.Project.AsNoTracking().Where(x => x.Id == o.ProjectId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
vc.Add(value, "projname", o.ProjectId);
|
||||
}
|
||||
o.ProjectViz = value;
|
||||
}
|
||||
|
||||
if (o.ContractId != null)
|
||||
{
|
||||
var contractVizFields = await ct.Contract.AsNoTracking().Where(x => x.Id == o.ContractId).Select(x => new { Name = x.Name, AlertNotes = x.AlertNotes }).FirstOrDefaultAsync();
|
||||
o.ContractViz = contractVizFields.Name;
|
||||
if (!string.IsNullOrWhiteSpace(contractVizFields.AlertNotes))
|
||||
if (vc.Get("ctrctname", o.ContractId) == null)
|
||||
{
|
||||
o.AlertViz += $"{await Translate("Contract")}\n{contractVizFields.AlertNotes}\n\n";
|
||||
var contractVizFields = await ct.Contract.AsNoTracking().Where(x => x.Id == o.ContractId).Select(x => new { Name = x.Name, AlertNotes = x.AlertNotes }).FirstOrDefaultAsync();
|
||||
vc.Add(contractVizFields.Name, "ctrctname", o.ContractId);
|
||||
vc.Add(contractVizFields.AlertNotes, "ctrctalrt", o.ContractId);
|
||||
}
|
||||
o.ContractViz = vc.Get("ctrctname", o.ContractId);//contractVizFields.Name;
|
||||
var alrtNotes = vc.Get("ctrctalrt", o.ContractId);
|
||||
if (!string.IsNullOrWhiteSpace(alrtNotes))
|
||||
{
|
||||
o.AlertViz += $"{await Translate("Contract")}\n{alrtNotes}\n\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1352,16 +1385,41 @@ namespace AyaNova.Biz
|
||||
{
|
||||
if (o.WorkOrderItemStatusId != null)
|
||||
{
|
||||
var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId);
|
||||
o.WorkOrderItemStatusNameViz = StatusInfo.Name;
|
||||
o.WorkOrderItemStatusColorViz = StatusInfo.Color;
|
||||
string value = vc.Get("woistatname", o.WorkOrderItemStatusId);
|
||||
if (value == null)
|
||||
{
|
||||
var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId);
|
||||
|
||||
vc.Add(StatusInfo.Name, "woistatname", o.WorkOrderItemStatusId);
|
||||
vc.Add(StatusInfo.Color, "woistatcolor", o.WorkOrderItemStatusId);
|
||||
o.WorkOrderItemStatusNameViz = StatusInfo.Name;
|
||||
o.WorkOrderItemStatusColorViz = StatusInfo.Color;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.WorkOrderItemStatusNameViz = value;
|
||||
o.WorkOrderItemStatusColorViz = vc.Get("woistatcolor", o.WorkOrderItemStatusId);
|
||||
}
|
||||
}
|
||||
|
||||
if (o.WorkOrderItemPriorityId != null)
|
||||
{
|
||||
var PriorityInfo = await ct.WorkOrderItemPriority.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemPriorityId);
|
||||
o.WorkOrderItemPriorityNameViz = PriorityInfo.Name;
|
||||
o.WorkOrderItemPriorityColorViz = PriorityInfo.Color;
|
||||
string value = vc.Get("woipriorityname", o.WorkOrderItemPriorityId);
|
||||
if (value == null)
|
||||
{
|
||||
var PriorityInfo = await ct.WorkOrderItemPriority.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemPriorityId);
|
||||
vc.Add(PriorityInfo.Name, "woipriorityname", o.WorkOrderItemPriorityId);
|
||||
vc.Add(PriorityInfo.Color, "woiprioritycolor", o.WorkOrderItemPriorityId);
|
||||
|
||||
o.WorkOrderItemPriorityNameViz = PriorityInfo.Name;
|
||||
o.WorkOrderItemPriorityColorViz = PriorityInfo.Color;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.WorkOrderItemPriorityNameViz = value;
|
||||
o.WorkOrderItemPriorityColorViz = vc.Get("woiprioritycolor", o.WorkOrderItemPriorityId);
|
||||
|
||||
}
|
||||
}
|
||||
foreach (var v in o.Expenses)
|
||||
await ExpensePopulateVizFields(v);
|
||||
@@ -1635,11 +1693,26 @@ namespace AyaNova.Biz
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("user", o.UserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||
}
|
||||
o.UserViz = vc.Get("user", o.UserId);
|
||||
}
|
||||
}
|
||||
TaxCode Tax = null;
|
||||
if (o.ChargeTaxCodeId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ChargeTaxCodeId);
|
||||
{
|
||||
if (!oc.Has("tax", o.ChargeTaxCodeId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ChargeTaxCodeId);
|
||||
oc.Add(Tax, "tax", o.ChargeTaxCodeId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.ChargeTaxCodeId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -1653,17 +1726,17 @@ namespace AyaNova.Biz
|
||||
{
|
||||
if (Tax.TaxAPct != 0)
|
||||
{
|
||||
o.TaxAViz = o.ChargeAmount * (Tax.TaxAPct / 100);
|
||||
o.TaxAViz = MoneyUtil.Round(o.ChargeAmount * (Tax.TaxAPct / 100));
|
||||
}
|
||||
if (Tax.TaxBPct != 0)
|
||||
{
|
||||
if (Tax.TaxOnTax)
|
||||
{
|
||||
o.TaxBViz = (o.ChargeAmount + o.TaxAViz) * (Tax.TaxBPct / 100);
|
||||
o.TaxBViz = MoneyUtil.Round((o.ChargeAmount + o.TaxAViz) * (Tax.TaxBPct / 100));
|
||||
}
|
||||
else
|
||||
{
|
||||
o.TaxBViz = o.ChargeAmount * (Tax.TaxBPct / 100);
|
||||
o.TaxBViz = MoneyUtil.Round(o.ChargeAmount * (Tax.TaxBPct / 100));
|
||||
}
|
||||
}
|
||||
o.LineTotalViz = o.ChargeAmount + o.TaxAViz + o.TaxBViz;
|
||||
@@ -1979,17 +2052,40 @@ namespace AyaNova.Biz
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("user", o.UserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||
}
|
||||
o.UserViz = vc.Get("user", o.UserId);
|
||||
}
|
||||
}
|
||||
ServiceRate Rate = null;
|
||||
if (o.ServiceRateId != null)
|
||||
{
|
||||
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
||||
if (!oc.Has("servicerate", o.ServiceRateId))
|
||||
{
|
||||
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
||||
oc.Add(Rate, "servicerate", o.ServiceRateId);
|
||||
}
|
||||
else
|
||||
Rate = (ServiceRate)oc.Get("servicerate", o.ServiceRateId);
|
||||
o.ServiceRateViz = Rate.Name;
|
||||
}
|
||||
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeSaleId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeSaleId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeSaleId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeSaleId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -2348,7 +2444,7 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VIZ POPULATE
|
||||
//
|
||||
private async Task LoanPopulateVizFields(PMItemLoan o, List<NameIdItem> loanUnitRateEnumList = null, bool calculateTotalsOnly = false)
|
||||
private async Task LoanPopulateVizFields(PMItemLoan o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
@@ -2360,16 +2456,27 @@ namespace AyaNova.Biz
|
||||
o.UnitOfMeasureViz = loanUnitRateEnumList.Where(x => x.Id == (long)o.Rate).Select(x => x.Name).First();
|
||||
}
|
||||
|
||||
LoanUnit loanUnit = await ct.LoanUnit.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.LoanUnitId);
|
||||
o.LoanUnitViz = loanUnit.Name;
|
||||
if (!vc.Has("loanunit", o.LoanUnitId))
|
||||
vc.Add(await ct.LoanUnit.AsNoTracking().Where(x => x.Id == o.LoanUnitId).Select(x => x.Name).FirstOrDefaultAsync(), "loanunit", o.LoanUnitId);
|
||||
o.LoanUnitViz = vc.Get("loanunit", o.LoanUnitId);
|
||||
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||
}
|
||||
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
|
||||
//manual price overrides anything
|
||||
o.PriceViz = o.ListPrice;
|
||||
if (o.PriceOverride != null)
|
||||
@@ -2406,8 +2513,8 @@ namespace AyaNova.Biz
|
||||
//RESTRICTED COST FIELD??
|
||||
if (!UserCanViewLoanerCosts)
|
||||
o.Cost = 0;//cost already used in calcs and will not be updated on any update operation so this ensures the cost isn't sent over the wire
|
||||
|
||||
}
|
||||
private List<NameIdItem> loanUnitRateEnumList = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//BIZ ACTIONS
|
||||
@@ -2743,16 +2850,39 @@ namespace AyaNova.Biz
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UnitId != 0)
|
||||
o.UnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("unitserial", o.UnitId))
|
||||
vc.Add(await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync(), "unitserial", o.UnitId);
|
||||
o.UnitViz = vc.Get("unitserial", o.UnitId);
|
||||
}
|
||||
|
||||
if (o.VendorSentToId != null)
|
||||
o.VendorSentToViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.VendorSentToId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentToId);
|
||||
o.VendorSentToViz = vc.Get("vendorname", o.VendorSentToId);
|
||||
}
|
||||
|
||||
if (o.VendorSentViaId != null)
|
||||
o.VendorSentViaViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.VendorSentViaId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentViaId);
|
||||
o.VendorSentViaViz = vc.Get("vendorname", o.VendorSentViaId);
|
||||
}
|
||||
}
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -3072,21 +3202,42 @@ namespace AyaNova.Biz
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.PartWarehouseId != 0)
|
||||
o.PartWarehouseViz = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == o.PartWarehouseId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("partwarehouse", o.PartWarehouseId))
|
||||
vc.Add(await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == o.PartWarehouseId).Select(x => x.Name).FirstOrDefaultAsync(), "partwarehouse", o.PartWarehouseId);
|
||||
o.PartWarehouseViz = vc.Get("partwarehouse", o.PartWarehouseId);
|
||||
}
|
||||
}
|
||||
Part part = null;
|
||||
if (o.PartId != 0)
|
||||
part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId);
|
||||
{
|
||||
if (!oc.Has("part", o.PartId))
|
||||
{
|
||||
part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId);
|
||||
oc.Add(part, "part", o.PartId);
|
||||
}
|
||||
else
|
||||
part = (Part)oc.Get("part", o.PartId);
|
||||
}
|
||||
else
|
||||
return;//this should never happen but this is insurance in case it does
|
||||
|
||||
o.PartDescriptionViz = part.Description;
|
||||
o.PartNameViz = part.Name;
|
||||
o.UpcViz = part.UPC;
|
||||
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxPartSaleId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxPartSaleId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxPartSaleId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxPartSaleId);
|
||||
oc.Add(Tax, "tax", o.TaxPartSaleId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxPartSaleId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
|
||||
@@ -1154,7 +1154,7 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task StatePopulateVizFields(QuoteState o)
|
||||
{
|
||||
// o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
// o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
if (o.UserId != 0)
|
||||
{
|
||||
@@ -1638,20 +1638,7 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task ItemPopulateVizFields(QuoteItem o, bool populateForReporting)
|
||||
{
|
||||
// if (o.WorkOrderItemStatusId != null)
|
||||
// {
|
||||
// var StatusInfo = await ct.WorkOrderItemStatus.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemStatusId);
|
||||
// o.WorkOrderItemStatusNameViz = StatusInfo.Name;
|
||||
// o.WorkOrderItemStatusColorViz = StatusInfo.Color;
|
||||
// }
|
||||
|
||||
// if (o.WorkOrderItemPriorityId != null)
|
||||
// {
|
||||
// var PriorityInfo = await ct.WorkOrderItemPriority.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.WorkOrderItemPriorityId);
|
||||
// o.WorkOrderItemPriorityNameViz = PriorityInfo.Name;
|
||||
// o.WorkOrderItemPriorityColorViz = PriorityInfo.Color;
|
||||
// }
|
||||
|
||||
|
||||
if (o.WorkOrderItemStatusId != null)
|
||||
{
|
||||
string value = vc.Get("woistatname", o.WorkOrderItemStatusId);
|
||||
@@ -1690,7 +1677,7 @@ namespace AyaNova.Biz
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var v in o.Expenses)
|
||||
await ExpensePopulateVizFields(v);
|
||||
foreach (var v in o.Labors)
|
||||
@@ -1970,18 +1957,8 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task ExpensePopulateVizFields(QuoteItemExpense o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
// if (calculateTotalsOnly == false)
|
||||
// {
|
||||
// if (o.UserId != null)
|
||||
// o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
// }
|
||||
// TaxCode Tax = null;
|
||||
// if (o.ChargeTaxCodeId != null)
|
||||
// Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ChargeTaxCodeId);
|
||||
// if (Tax != null)
|
||||
// o.TaxCodeViz = Tax.Name;
|
||||
|
||||
if (calculateTotalsOnly == false)
|
||||
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
{
|
||||
@@ -2360,20 +2337,43 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task LaborPopulateVizFields(QuoteItemLabor o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("user", o.UserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||
}
|
||||
o.UserViz = vc.Get("user", o.UserId);
|
||||
}
|
||||
}
|
||||
ServiceRate Rate = null;
|
||||
if (o.ServiceRateId != null)
|
||||
{
|
||||
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
||||
if (!oc.Has("servicerate", o.ServiceRateId))
|
||||
{
|
||||
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
||||
oc.Add(Rate, "servicerate", o.ServiceRateId);
|
||||
}
|
||||
else
|
||||
Rate = (ServiceRate)oc.Get("servicerate", o.ServiceRateId);
|
||||
o.ServiceRateViz = Rate.Name;
|
||||
}
|
||||
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeSaleId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeSaleId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeSaleId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeSaleId);
|
||||
}
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -2746,7 +2746,7 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VIZ POPULATE
|
||||
//
|
||||
private async Task LoanPopulateVizFields(QuoteItemLoan o, List<NameIdItem> loanUnitRateEnumList = null, bool calculateTotalsOnly = false)
|
||||
private async Task LoanPopulateVizFields(QuoteItemLoan o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
@@ -2758,16 +2758,25 @@ namespace AyaNova.Biz
|
||||
o.UnitOfMeasureViz = loanUnitRateEnumList.Where(x => x.Id == (long)o.Rate).Select(x => x.Name).First();
|
||||
}
|
||||
|
||||
LoanUnit loanUnit = await ct.LoanUnit.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.LoanUnitId);
|
||||
o.LoanUnitViz = loanUnit.Name;
|
||||
if (!vc.Has("loanunit", o.LoanUnitId))
|
||||
vc.Add(await ct.LoanUnit.AsNoTracking().Where(x => x.Id == o.LoanUnitId).Select(x => x.Name).FirstOrDefaultAsync(), "loanunit", o.LoanUnitId);
|
||||
o.LoanUnitViz = vc.Get("loanunit", o.LoanUnitId);
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
|
||||
//manual price overrides anything
|
||||
o.PriceViz = o.ListPrice;
|
||||
if (o.PriceOverride != null)
|
||||
@@ -2804,8 +2813,8 @@ namespace AyaNova.Biz
|
||||
//RESTRICTED COST FIELD??
|
||||
if (!UserCanViewLoanerCosts)
|
||||
o.Cost = 0;//cost already used in calcs and will not be updated on any update operation so this ensures the cost isn't sent over the wire
|
||||
|
||||
}
|
||||
private List<NameIdItem> loanUnitRateEnumList = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//BIZ ACTIONS
|
||||
@@ -3146,18 +3155,42 @@ namespace AyaNova.Biz
|
||||
private async Task OutsideServicePopulateVizFields(QuoteItemOutsideService o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
{
|
||||
if (o.UnitId != 0)
|
||||
o.UnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("unitserial", o.UnitId))
|
||||
vc.Add(await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync(), "unitserial", o.UnitId);
|
||||
o.UnitViz = vc.Get("unitserial", o.UnitId);
|
||||
}
|
||||
|
||||
if (o.VendorSentToId != null)
|
||||
o.VendorSentToViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.VendorSentToId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentToId);
|
||||
o.VendorSentToViz = vc.Get("vendorname", o.VendorSentToId);
|
||||
}
|
||||
|
||||
if (o.VendorSentViaId != null)
|
||||
o.VendorSentViaViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.VendorSentViaId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentViaId);
|
||||
o.VendorSentViaViz = vc.Get("vendorname", o.VendorSentViaId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||
}
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -3484,11 +3517,23 @@ namespace AyaNova.Biz
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.PartWarehouseId != 0)
|
||||
o.PartWarehouseViz = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == o.PartWarehouseId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("partwarehouse", o.PartWarehouseId))
|
||||
vc.Add(await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == o.PartWarehouseId).Select(x => x.Name).FirstOrDefaultAsync(), "partwarehouse", o.PartWarehouseId);
|
||||
o.PartWarehouseViz = vc.Get("partwarehouse", o.PartWarehouseId);
|
||||
}
|
||||
}
|
||||
Part part = null;
|
||||
if (o.PartId != 0)
|
||||
part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId);
|
||||
{
|
||||
if (!oc.Has("part", o.PartId))
|
||||
{
|
||||
part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId);
|
||||
oc.Add(part, "part", o.PartId);
|
||||
}
|
||||
else
|
||||
part = (Part)oc.Get("part", o.PartId);
|
||||
}
|
||||
else
|
||||
return;//this should never happen but this is insurance in case it does
|
||||
|
||||
@@ -3498,7 +3543,15 @@ namespace AyaNova.Biz
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxPartSaleId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxPartSaleId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxPartSaleId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxPartSaleId);
|
||||
oc.Add(Tax, "tax", o.TaxPartSaleId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxPartSaleId);
|
||||
}
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -3879,10 +3932,23 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task ScheduledUserPopulateVizFields(QuoteItemScheduledUser o)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.UserId != null)
|
||||
{
|
||||
if (!vc.Has("user", o.UserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||
}
|
||||
o.UserViz = vc.Get("user", o.UserId);
|
||||
}
|
||||
|
||||
if (o.ServiceRateId != null)
|
||||
o.ServiceRateViz = await ct.ServiceRate.AsNoTracking().Where(x => x.Id == o.ServiceRateId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("servicerate", o.ServiceRateId))
|
||||
{
|
||||
vc.Add(await ct.ServiceRate.AsNoTracking().Where(x => x.Id == o.ServiceRateId).Select(x => x.Name).FirstOrDefaultAsync(), "servicerate", o.ServiceRateId);
|
||||
}
|
||||
o.ServiceRateViz = vc.Get("servicerate", o.ServiceRateId);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -4146,18 +4212,26 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VIZ POPULATE
|
||||
//
|
||||
private async Task TaskPopulateVizFields(QuoteItemTask o, List<NameIdItem> taskCompletionTypeEnumList = null)
|
||||
private async Task TaskPopulateVizFields(QuoteItemTask o)
|
||||
{
|
||||
if (o.CompletedByUserId != null)
|
||||
o.CompletedByUserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.CompletedByUserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("user", o.CompletedByUserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.CompletedByUserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.CompletedByUserId);
|
||||
}
|
||||
o.CompletedByUserViz = vc.Get("user", o.CompletedByUserId);
|
||||
}
|
||||
|
||||
if (taskCompletionTypeEnumList == null)
|
||||
taskCompletionTypeEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(
|
||||
StringUtil.TrimTypeName(typeof(WorkOrderItemTaskCompletionType).ToString()),
|
||||
UserTranslationId,
|
||||
CurrentUserRoles);
|
||||
|
||||
o.StatusViz = taskCompletionTypeEnumList.Where(x => x.Id == (long)o.Status).Select(x => x.Name).First();
|
||||
}
|
||||
private List<NameIdItem> taskCompletionTypeEnumList = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VALIDATION
|
||||
@@ -4427,20 +4501,43 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task TravelPopulateVizFields(QuoteItemTravel o, bool calculateTotalsOnly = false)
|
||||
{
|
||||
if (calculateTotalsOnly == false)
|
||||
if (calculateTotalsOnly == false)
|
||||
{
|
||||
if (o.UserId != null)
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("user", o.UserId))
|
||||
{
|
||||
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||
}
|
||||
o.UserViz = vc.Get("user", o.UserId);
|
||||
}
|
||||
|
||||
}
|
||||
TravelRate Rate = null;
|
||||
if (o.TravelRateId != null)
|
||||
{
|
||||
Rate = await ct.TravelRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.TravelRateId);
|
||||
if (!oc.Has("travelrate", o.TravelRateId))
|
||||
{
|
||||
Rate = await ct.TravelRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.TravelRateId);
|
||||
oc.Add(Rate, "travelrate", o.TravelRateId);
|
||||
}
|
||||
else
|
||||
Rate = (TravelRate)oc.Get("travelrate", o.TravelRateId);
|
||||
|
||||
o.TravelRateViz = Rate.Name;
|
||||
}
|
||||
|
||||
TaxCode Tax = null;
|
||||
if (o.TaxCodeSaleId != null)
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
{
|
||||
if (!oc.Has("tax", o.TaxCodeSaleId))
|
||||
{
|
||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||
oc.Add(Tax, "tax", o.TaxCodeSaleId);
|
||||
}
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeSaleId);
|
||||
}
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
@@ -4805,31 +4902,79 @@ namespace AyaNova.Biz
|
||||
//
|
||||
private async Task UnitPopulateVizFields(QuoteItemUnit o, bool populateForReporting)
|
||||
{
|
||||
var unitInfo = await ct.Unit.AsNoTracking()
|
||||
.Where(x => x.Id == o.UnitId)
|
||||
.Select(x => new { x.Serial, x.Description, x.UnitModelId, x.Address, x.City, x.Region, x.Country, x.Latitude, x.Longitude })
|
||||
.FirstOrDefaultAsync();
|
||||
o.UnitViz = unitInfo.Serial;
|
||||
o.UnitDescriptionViz = unitInfo.Description;
|
||||
//see if it's in the cache already, populate the cache fully if not
|
||||
bool UnitHasModel = false;
|
||||
if (!vc.Has("unitserial", o.UnitId))
|
||||
{
|
||||
//cache it
|
||||
var unitInfo = await ct.Unit.AsNoTracking()
|
||||
.Where(x => x.Id == o.UnitId)
|
||||
.Select(x => new { x.Serial, x.Description, x.UnitModelId, x.Address, x.City, x.Region, x.Country, x.Latitude, x.Longitude, x.Metered })
|
||||
.FirstOrDefaultAsync();
|
||||
vc.Add(unitInfo.Serial, "unitserial", o.UnitId);
|
||||
vc.Add(unitInfo.Description, "unitdesc", o.UnitId);
|
||||
vc.Add(unitInfo.Address, "unitaddr", o.UnitId);
|
||||
vc.Add(unitInfo.City, "unitcity", o.UnitId);
|
||||
vc.Add(unitInfo.Region, "unitregion", o.UnitId);
|
||||
vc.Add(unitInfo.Country, "unitcountry", o.UnitId);
|
||||
vc.Add(unitInfo.Latitude.ToString(), "unitlat", o.UnitId);
|
||||
vc.Add(unitInfo.Longitude.ToString(), "unitlong", o.UnitId);
|
||||
vc.Add(unitInfo.Metered.ToString(), "unitmetered", o.UnitId);
|
||||
|
||||
if (unitInfo.UnitModelId != null)
|
||||
{
|
||||
UnitHasModel = true;
|
||||
//units model name cached? (if it is then the rest will be cached as well)
|
||||
if (!vc.Has("unitsmodelname", o.UnitId))
|
||||
{
|
||||
//nope, model name cached??
|
||||
if (!vc.Has("unitmodelname", unitInfo.UnitModelId))
|
||||
{
|
||||
//nope, so cache it all
|
||||
var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId }).FirstOrDefaultAsync();
|
||||
vc.Add(unitModelInfo.Name, "unitmodelname", unitInfo.UnitModelId);
|
||||
vc.Add(unitModelInfo.Name, "unitsmodelname", o.UnitId);
|
||||
|
||||
if (unitModelInfo.VendorId != null)
|
||||
{
|
||||
var ModelVendorName = vc.Get("unitsmodelvendorname", o.UnitId);
|
||||
if (ModelVendorName == null)
|
||||
{
|
||||
ModelVendorName = vc.Get("vendorname", unitModelInfo.VendorId);
|
||||
if (ModelVendorName == null)
|
||||
{
|
||||
ModelVendorName = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
vc.Add(ModelVendorName, "vendorname", unitModelInfo.VendorId);
|
||||
vc.Add(ModelVendorName, "unitsmodelvendorname", o.UnitId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//cached under vendor so reuse here
|
||||
vc.Add(ModelVendorName, "unitsmodelvendorname", o.UnitId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//populate all fields from cache
|
||||
if (UnitHasModel)
|
||||
{
|
||||
o.UnitModelNameViz = vc.Get("unitsmodelname", o.UnitId);
|
||||
o.UnitModelVendorViz = vc.Get("unitsmodelvendorname", o.UnitId);
|
||||
}
|
||||
o.UnitViz = vc.Get("unitserial", o.UnitId);
|
||||
o.UnitDescriptionViz = vc.Get("unitdesc", o.UnitId);
|
||||
// o.UnitMeteredViz = vc.GetAsBool("unitmetered", o.UnitId);
|
||||
if (populateForReporting)
|
||||
{
|
||||
o.AddressViz = unitInfo.Address;
|
||||
o.CityViz = unitInfo.City;
|
||||
o.RegionViz = unitInfo.Region;
|
||||
o.CountryViz = unitInfo.Country;
|
||||
o.LatitudeViz = unitInfo.Latitude;
|
||||
o.LongitudeViz = unitInfo.Longitude;
|
||||
}
|
||||
|
||||
if (unitInfo.UnitModelId != null)
|
||||
{
|
||||
var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId }).FirstOrDefaultAsync();
|
||||
o.UnitModelNameViz = unitModelInfo.Name;
|
||||
|
||||
|
||||
if (unitModelInfo.VendorId != null)
|
||||
o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.AddressViz = vc.Get("unitaddr", o.UnitId);
|
||||
o.CityViz = vc.Get("unitcity", o.UnitId);
|
||||
o.RegionViz = vc.Get("unitregion", o.UnitId);
|
||||
o.CountryViz = vc.Get("unitcountry", o.UnitId);
|
||||
o.LatitudeViz = vc.GetAsDecimal("unitlat", o.UnitId);
|
||||
o.LongitudeViz = vc.GetAsDecimal("unitlong", o.UnitId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3274,6 +3274,8 @@ namespace AyaNova.Biz
|
||||
else
|
||||
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||
}
|
||||
|
||||
|
||||
if (Tax != null)
|
||||
o.TaxCodeViz = Tax.Name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user