Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace Impeltech.EDS.Helper
- {
- public class SumHelper
- {
- private List<double> ListSum { get; set; }
- public double CalculateSum(DateTime start, DateTime end, double coefficient, double Sum)
- {
- var date = start;
- ListSum = new List<double>();
- while (date < end)
- {
- var nextDate =DateHelper.GetNextDate(date, end);
- var price = (nextDate - date).TotalDays / DateHelper.GetDaysInYear(date) * coefficient * 0.01 * Sum;
- ListSum.Add(price);
- date = nextDate;
- }
- return Math.Round(ListSum.Sum(), 2);
- }
- }
- }
Add Comment
Please, Sign In to add comment