This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user