This commit is contained in:
@@ -296,6 +296,18 @@ namespace AyaNova.Biz
|
|||||||
if (o.ContractId != null)
|
if (o.ContractId != null)
|
||||||
o.ContractViz = await ct.Contract.AsNoTracking().Where(x => x.Id == o.ContractId).Select(x => x.Name).FirstOrDefaultAsync();
|
o.ContractViz = await ct.Contract.AsNoTracking().Where(x => x.Id == o.ContractId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (o.Metered)
|
||||||
|
{
|
||||||
|
|
||||||
|
var lastMeter = await ct.UnitMeterReading.AsNoTracking().OrderByDescending(m => m.MeterDate).FirstOrDefaultAsync(x => x.UnitId == o.Id);
|
||||||
|
if (lastMeter != null)
|
||||||
|
{
|
||||||
|
o.LastMeterViz = lastMeter.Meter;
|
||||||
|
o.LastMeterDateViz = lastMeter.MeterDate;
|
||||||
|
o.LastMeterNotesViz = lastMeter.Notes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -434,7 +446,7 @@ namespace AyaNova.Biz
|
|||||||
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||||
{
|
{
|
||||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UnitBiz>();
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<UnitBiz>();
|
||||||
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
|
||||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ namespace AyaNova.Models
|
|||||||
public string ContractViz { get; set; }
|
public string ContractViz { get; set; }
|
||||||
public DateTime? ContractExpires { get; set; }
|
public DateTime? ContractExpires { get; set; }
|
||||||
public bool Metered { get; set; }
|
public bool Metered { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public long LastMeterViz { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public DateTime? LastMeterDateViz { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string LastMeterNotesViz { get; set; }
|
||||||
public bool LifeTimeWarranty { get; set; }
|
public bool LifeTimeWarranty { get; set; }
|
||||||
public string Text1 { get; set; }
|
public string Text1 { get; set; }
|
||||||
public string Text2 { get; set; }
|
public string Text2 { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user