private DateTime GetNextEndTime(TariffMetro tariff, TariffMetroCommandCalculateInterval currentCommand, ref DateTime dtEstimatedDate) { //TimeSpan t1 = currentCommand.StartTime; //t1 = t_интN TariffMetroCommandCalculateInterval nextCommand = tariff.Next(currentCommand); //U_к = U_к + 1 //TimeSpan t2 = nextCommand.StartTime; //t2 = t_интN+1 var endTime = dtEstimatedDate.Add(nextCommand.StartTime); //t_интNкон = t_опл/дата + t_интN+1 if (nextCommand.StartTime > currentCommand.StartTime) { return(endTime); } endTime += TimeSpan.FromDays(1); //t_интNкон = t_интNкон + 24ч dtEstimatedDate += TimeSpan.FromDays(1); //t_опл/дата = t_опл/дата + 24ч return(endTime); }