refactoring
This commit is contained in:
parent
d797c826bc
commit
55b61b39b5
3 changed files with 5 additions and 18 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Yavsc.Billing;
|
using Yavsc.Billing;
|
||||||
|
using Yavsc.Models.Billing;
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
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<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;
|
Sender = perfer.Performer.UserName;
|
||||||
Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
|
Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
|
||||||
estimate.Title,estimate.GetTotal());
|
estimate.Title,estimate.Bill.Addition());
|
||||||
}
|
}
|
||||||
ProviderClientInfo ProviderInfo { get; set; }
|
ProviderClientInfo ProviderInfo { get; set; }
|
||||||
Estimate Estimation { get; set; }
|
Estimate Estimation { get; set; }
|
||||||
|
|
@ -48,4 +48,4 @@ namespace Yavsc.Models.Messaging
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue