This commit is contained in:
2021-08-19 23:37:04 +00:00
parent 2387dc9d4a
commit 39b6fe4dbe
2 changed files with 20 additions and 2 deletions

View File

@@ -296,6 +296,18 @@ namespace AyaNova.Biz
if (o.ContractId != null)
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)
{
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}]");
bool isNew = currentObj == null;

View File

@@ -47,13 +47,19 @@ namespace AyaNova.Models
public bool OverrideModelWarranty { get; set; }
public int? WarrantyLength { get; set; }//MONTHS
public string WarrantyTerms { get; set; }
// public bool UsesBanking { get; set; }
public long? ContractId { get; set; }
[NotMapped]
public string ContractViz { get; set; }
public DateTime? ContractExpires { 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 string Text1 { get; set; }
public string Text2 { get; set; }