From 3416f9103160c4076a1a56c487104789112aaea2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 5 Nov 2021 15:27:14 +0000 Subject: [PATCH] case 4015 --- server/AyaNova/biz/PMBiz.cs | 18 ++++++++++++------ server/AyaNova/biz/QuoteBiz.cs | 18 ++++++++++++------ server/AyaNova/biz/WorkOrderBiz.cs | 16 +++++++++++----- server/AyaNova/models/PM.cs | 17 ++++++++++++++--- server/AyaNova/models/Quote.cs | 14 +++++++++++++- server/AyaNova/models/WorkOrder.cs | 12 ++++++++++++ 6 files changed, 74 insertions(+), 21 deletions(-) diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 6c770624..e6179279 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -875,10 +875,10 @@ namespace AyaNova.Biz //Alert notes //Customer notes first then others below - var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { AlertViz = x.AlertNotes, x.TechNotes, CustomerViz = x.Name }).FirstOrDefaultAsync(); - if (!string.IsNullOrWhiteSpace(custInfo.AlertViz)) + var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.AlertNotes, x.TechNotes, x.Name, x.Phone1, x.Phone2, x.Phone3, x.Phone4, x.Phone5, x.EmailAddress }).FirstOrDefaultAsync(); + if (!string.IsNullOrWhiteSpace(custInfo.AlertNotes)) { - o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertViz}\n\n"; + o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertNotes}\n\n"; } if (!string.IsNullOrWhiteSpace(custInfo.TechNotes)) @@ -886,7 +886,13 @@ namespace AyaNova.Biz o.CustomerTechNotesViz = $"{await Translate("CustomerTechNotes")}\n{custInfo.TechNotes}\n\n"; } - o.CustomerViz = custInfo.CustomerViz; + o.CustomerViz = custInfo.Name; + o.CustomerPhone1Viz = custInfo.Phone1; + o.CustomerPhone2Viz = custInfo.Phone2; + o.CustomerPhone3Viz = custInfo.Phone3; + o.CustomerPhone4Viz = custInfo.Phone4; + o.CustomerPhone5Viz = custInfo.Phone5; + o.CustomerEmailAddressViz = custInfo.EmailAddress; if (o.ProjectId != null) o.ProjectViz = await ct.Project.AsNoTracking().Where(x => x.Id == o.ProjectId).Select(x => x.Name).FirstOrDefaultAsync(); @@ -4339,7 +4345,7 @@ namespace AyaNova.Biz { 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(); @@ -4491,7 +4497,7 @@ namespace AyaNova.Biz if (o is PM) { PM dto = new PM(); - CopyObject.Copy(o, dto,"Name"); + CopyObject.Copy(o, dto, "Name"); return await PMPutAsync((PM)dto); } return await PMPutAsync((PM)o) as ICoreBizObjectModel; diff --git a/server/AyaNova/biz/QuoteBiz.cs b/server/AyaNova/biz/QuoteBiz.cs index 320d77c6..504a0812 100644 --- a/server/AyaNova/biz/QuoteBiz.cs +++ b/server/AyaNova/biz/QuoteBiz.cs @@ -854,10 +854,10 @@ namespace AyaNova.Biz //Alert notes //Customer notes first then others below - var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { AlertViz = x.AlertNotes, x.TechNotes, CustomerViz = x.Name }).FirstOrDefaultAsync(); - if (!string.IsNullOrWhiteSpace(custInfo.AlertViz)) + var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.AlertNotes, x.TechNotes, x.Name, x.Phone1, x.Phone2, x.Phone3, x.Phone4, x.Phone5, x.EmailAddress }).FirstOrDefaultAsync(); + if (!string.IsNullOrWhiteSpace(custInfo.AlertNotes)) { - o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertViz}\n\n"; + o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertNotes}\n\n"; } if (!string.IsNullOrWhiteSpace(custInfo.TechNotes)) @@ -865,7 +865,13 @@ namespace AyaNova.Biz o.CustomerTechNotesViz = $"{await Translate("CustomerTechNotes")}\n{custInfo.TechNotes}\n\n"; } - o.CustomerViz = custInfo.CustomerViz; + o.CustomerViz = custInfo.Name; + o.CustomerPhone1Viz = custInfo.Phone1; + o.CustomerPhone2Viz = custInfo.Phone2; + o.CustomerPhone3Viz = custInfo.Phone3; + o.CustomerPhone4Viz = custInfo.Phone4; + o.CustomerPhone5Viz = custInfo.Phone5; + o.CustomerEmailAddressViz = custInfo.EmailAddress; if (o.ProjectId != null) o.ProjectViz = await ct.Project.AsNoTracking().Where(x => x.Id == o.ProjectId).Select(x => x.Name).FirstOrDefaultAsync(); @@ -4654,7 +4660,7 @@ namespace AyaNova.Biz { 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(); @@ -4814,7 +4820,7 @@ namespace AyaNova.Biz if (o is Quote) { Quote dto = new Quote(); - CopyObject.Copy(o, dto,"Name"); + CopyObject.Copy(o, dto, "Name"); return await QuotePutAsync((Quote)dto); } return await QuotePutAsync((Quote)o) as ICoreBizObjectModel; diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 0b6098f3..2fc94c1f 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -968,10 +968,10 @@ namespace AyaNova.Biz //Alert notes //Customer notes first then others below - var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { AlertViz = x.AlertNotes, x.TechNotes, CustomerViz = x.Name }).FirstOrDefaultAsync(); - if (!string.IsNullOrWhiteSpace(custInfo.AlertViz)) + var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.AlertNotes, x.TechNotes, x.Name, x.Phone1, x.Phone2, x.Phone3, x.Phone4, x.Phone5, x.EmailAddress }).FirstOrDefaultAsync(); + if (!string.IsNullOrWhiteSpace(custInfo.AlertNotes)) { - o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertViz}\n\n"; + o.AlertViz = $"{await Translate("Customer")} - {await Translate("AlertNotes")}\n{custInfo.AlertNotes}\n\n"; } if (!string.IsNullOrWhiteSpace(custInfo.TechNotes)) @@ -979,7 +979,13 @@ namespace AyaNova.Biz o.CustomerTechNotesViz = $"{await Translate("CustomerTechNotes")}\n{custInfo.TechNotes}\n\n"; } - o.CustomerViz = custInfo.CustomerViz; + o.CustomerViz = custInfo.Name; + o.CustomerPhone1Viz = custInfo.Phone1; + o.CustomerPhone2Viz = custInfo.Phone2; + o.CustomerPhone3Viz = custInfo.Phone3; + o.CustomerPhone4Viz = custInfo.Phone4; + o.CustomerPhone5Viz = custInfo.Phone5; + o.CustomerEmailAddressViz = custInfo.EmailAddress; if (o.ProjectId != null) o.ProjectViz = await ct.Project.AsNoTracking().Where(x => x.Id == o.ProjectId).Select(x => x.Name).FirstOrDefaultAsync(); @@ -6064,7 +6070,7 @@ namespace AyaNova.Biz 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; + 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(); diff --git a/server/AyaNova/models/PM.cs b/server/AyaNova/models/PM.cs index 38c3885e..acb215d3 100644 --- a/server/AyaNova/models/PM.cs +++ b/server/AyaNova/models/PM.cs @@ -29,7 +29,7 @@ namespace AyaNova.Models public DateTime? StopGeneratingDate { get; set; } [Required] public AyaDaysOfWeek ExcludeDaysOfWeek { get; set; }//bit field flags set - [Required] + [Required] public bool Active { get; set; } [Required] public DateTime NextServiceDate { get; set; } @@ -49,9 +49,20 @@ namespace AyaNova.Models public long CustomerId { get; set; } [NotMapped] public string CustomerViz { get; set; } - [NotMapped] public string CustomerTechNotesViz { get; set; } + [NotMapped] + public string CustomerPhone1Viz { get; set; } + [NotMapped] + public string CustomerPhone2Viz { get; set; } + [NotMapped] + public string CustomerPhone3Viz { get; set; } + [NotMapped] + public string CustomerPhone4Viz { get; set; } + [NotMapped] + public string CustomerPhone5Viz { get; set; } + [NotMapped] + public string CustomerEmailAddressViz { get; set; } public long? ProjectId { get; set; } [NotMapped] @@ -116,7 +127,7 @@ namespace AyaNova.Models [NotMapped, JsonIgnore] public AyaType AyaType { get => AyaType.PM; } - //workaround for notification + //workaround for notification [NotMapped, JsonIgnore] public string Name { diff --git a/server/AyaNova/models/Quote.cs b/server/AyaNova/models/Quote.cs index efc51dd2..2830de5b 100644 --- a/server/AyaNova/models/Quote.cs +++ b/server/AyaNova/models/Quote.cs @@ -40,6 +40,18 @@ namespace AyaNova.Models [NotMapped] public string CustomerTechNotesViz { get; set; } + [NotMapped] + public string CustomerPhone1Viz { get; set; } + [NotMapped] + public string CustomerPhone2Viz { get; set; } + [NotMapped] + public string CustomerPhone3Viz { get; set; } + [NotMapped] + public string CustomerPhone4Viz { get; set; } + [NotMapped] + public string CustomerPhone5Viz { get; set; } + [NotMapped] + public string CustomerEmailAddressViz { get; set; } public long? ProjectId { get; set; } [NotMapped] @@ -110,7 +122,7 @@ namespace AyaNova.Models [NotMapped, JsonIgnore] public AyaType AyaType { get => AyaType.Quote; } - //workaround for notification + //workaround for notification [NotMapped, JsonIgnore] public string Name { diff --git a/server/AyaNova/models/WorkOrder.cs b/server/AyaNova/models/WorkOrder.cs index cc40f402..82611cae 100644 --- a/server/AyaNova/models/WorkOrder.cs +++ b/server/AyaNova/models/WorkOrder.cs @@ -27,6 +27,18 @@ namespace AyaNova.Models [NotMapped] public string CustomerTechNotesViz { get; set; } + [NotMapped] + public string CustomerPhone1Viz { get; set; } + [NotMapped] + public string CustomerPhone2Viz { get; set; } + [NotMapped] + public string CustomerPhone3Viz { get; set; } + [NotMapped] + public string CustomerPhone4Viz { get; set; } + [NotMapped] + public string CustomerPhone5Viz { get; set; } + [NotMapped] + public string CustomerEmailAddressViz { get; set; } public long? ProjectId { get; set; } [NotMapped]