This commit is contained in:
@@ -6181,8 +6181,8 @@ namespace AyaNova.Biz
|
||||
private async Task UnitPopulateVizFields(WorkOrderItemUnit o, bool populateForReporting)
|
||||
{
|
||||
//see if it's in the cache already, populate the cache fully if not
|
||||
bool UnitHasModel=false;
|
||||
if (vc.Get("unitserial", o.UnitId) == null)
|
||||
bool UnitHasModel = false;
|
||||
if (!vc.Has("unitserial", o.UnitId))
|
||||
{
|
||||
//cache it
|
||||
var unitInfo = await ct.Unit.AsNoTracking()
|
||||
@@ -6201,12 +6201,12 @@ namespace AyaNova.Biz
|
||||
|
||||
if (unitInfo.UnitModelId != null)
|
||||
{
|
||||
UnitHasModel=true;
|
||||
UnitHasModel = true;
|
||||
//units model name cached? (if it is then the rest will be cached as well)
|
||||
if (vc.Get("unitsmodelname", o.UnitId) == null)
|
||||
if (!vc.Has("unitsmodelname", o.UnitId))
|
||||
{
|
||||
//nope, model name cached??
|
||||
if (vc.Get("unitmodelname", unitInfo.UnitModelId) == null)
|
||||
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();
|
||||
@@ -6245,8 +6245,6 @@ namespace AyaNova.Biz
|
||||
o.UnitViz = vc.Get("unitserial", o.UnitId);
|
||||
o.UnitDescriptionViz = vc.Get("unitdesc", o.UnitId);
|
||||
o.UnitMeteredViz = vc.GetAsBool("unitmetered", o.UnitId);
|
||||
o.UnitModelNameViz = vc.Get("unitsmodelname", o.UnitId);
|
||||
o.UnitModelVendorViz = vc.Get("unitsmodelvendorname", o.UnitId);
|
||||
if (populateForReporting)
|
||||
{
|
||||
o.AddressViz = vc.Get("unitaddr", o.UnitId);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
if (value == null) value = string.Empty;
|
||||
_vizCache[$"{key}{id}"] = value;
|
||||
System.Diagnostics.Debug.WriteLine($"ADD {key}{id} - {value}");
|
||||
// System.Diagnostics.Debug.WriteLine($"ADD {key}{id} - {value}");
|
||||
}
|
||||
internal string Get(string key, long? id = 0)
|
||||
{
|
||||
@@ -28,11 +28,16 @@ namespace AyaNova.Util
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"vizGet cache miss {key}{id}");
|
||||
//System.Diagnostics.Debug.WriteLine($"vizGet cache miss {key}{id}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool Has(string key, long? id = 0)
|
||||
{
|
||||
return _vizCache.ContainsKey($"{key}{id}");
|
||||
}
|
||||
|
||||
internal bool GetAsBool(string key, long? id = 0)
|
||||
{
|
||||
var s = Get(key, id);
|
||||
|
||||
Reference in New Issue
Block a user