/// <summary> /// Add a value of time units to dateTime by calendar information. /// </summary> /// <param name="dateTime">Calendar time.</param> /// <param name="timeUnit">Time unit.</param> /// <param name="value">Value.</param> /// <returns>Calendar time.</returns> public DateTime Add(DateTime dateTime, int value) { if (value <= 0) { return(dateTime); } IEnumerable <ICalendarDay> days = _calendar.GetDays(_countTerm, dateTime, value); return(_countTerm.Calculate(days, value)); }
public DateTime Add(DateTime dateTime, CalendarTimeUnit timeUnit, int value) { if (value <= 0) { return(dateTime); } var factory = ClassFactory.Get <CalendarCountTermFactory>(); BaseCountTerm countTerm = factory.GetCountTerm(timeUnit); IEnumerable <ICalendarDay> days = GetDays(countTerm, dateTime, value); return(countTerm.Calculate(days, value)); }