public static DateTime CalculateTransitInWorkingDays(DateTime eta, int transitTime) { for (; transitTime > 0; --transitTime) { eta = ShippingCalculator.SkipWeekends(eta).AddDays(1.0); } return(ShippingCalculator.SkipWeekends(eta)); }
private string EmitTransitDetails(FilmDetails film) { TransitTime transitTime1 = Enumerable.SingleOrDefault <TransitTime>((IEnumerable <TransitTime>) this._transitTable, (Func <TransitTime, bool>)(t => t.Origin == film.OriginatingRegion)); int transitTime2 = 99; if (transitTime1 != null) { transitTime2 = transitTime1.DaysInTransit + transitTime1.ExpectedDelay; } DateTime dateTime = ShippingCalculator.CalculateTransitInWorkingDays(film.Leaving, transitTime2); return(string.Format("\"{0}\",{1},{2}", (object)film.Title, (object)transitTime2, (object)dateTime.ToString("dd/MM/yyyy"))); }