diff --git a/Yavsc/Helpers/BillingHelpers.cs b/Yavsc/Helpers/BillingHelpers.cs index 73f9225b..83df40cf 100644 --- a/Yavsc/Helpers/BillingHelpers.cs +++ b/Yavsc/Helpers/BillingHelpers.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using Yavsc.Billing; +using Yavsc.Models.Billing; namespace Yavsc.Helpers { @@ -8,5 +9,7 @@ namespace Yavsc.Helpers { public static decimal Addition(this List items) => items.Aggregate(0m, (t, l) => t + l.Count * l.UnitaryCost); + public static decimal Addition(this List items) => items.Select(i=>((IBillItem)i)).ToList().Addition(); + } } diff --git a/Yavsc/Helpers/EstimateHelpers.cs b/Yavsc/Helpers/EstimateHelpers.cs deleted file mode 100644 index 5976cff4..00000000 --- a/Yavsc/Helpers/EstimateHelpers.cs +++ /dev/null @@ -1,16 +0,0 @@ - -using Yavsc.Models.Billing; - -namespace Yavsc.Helpers -{ - public static class EstimateHelpers { - public static decimal GetTotal(this Estimate estimate) - { - decimal result = 0; - foreach (var l in estimate.Bill) - result += l.Count*l.UnitaryCost; - return result; - } - } - -} \ No newline at end of file diff --git a/Yavsc/Models/Messaging/EstimationEvent.cs b/Yavsc/Models/Messaging/EstimationEvent.cs index 3266e03a..d856af3e 100644 --- a/Yavsc/Models/Messaging/EstimationEvent.cs +++ b/Yavsc/Models/Messaging/EstimationEvent.cs @@ -28,7 +28,7 @@ namespace Yavsc.Models.Messaging }; Sender = perfer.Performer.UserName; Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName, - estimate.Title,estimate.GetTotal()); + estimate.Title,estimate.Bill.Addition()); } ProviderClientInfo ProviderInfo { get; set; } Estimate Estimation { get; set; } @@ -48,4 +48,4 @@ namespace Yavsc.Models.Messaging get; set; } } -} \ No newline at end of file +}