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) 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;
}
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -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; }