refactoring
This commit is contained in:
@ -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<IBillItem> items) => items.Aggregate<IBillItem, decimal>(0m, (t, l) => t + l.Count * l.UnitaryCost);
|
||||
|
||||
public static decimal Addition(this List<CommandLine> items) => items.Select(i=>((IBillItem)i)).ToList().Addition();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user