/// <summary> /// Every n month(s), every week, selected week day(s) /// </summary> /// <param name="monthIntervals">Month interval. E.g., Every 1 month, every 2 months, .... , every n months.</param> /// <param name="firstDateTime">Used when monthIntervals > 1 to check a month that comes under expected month interval.</param> /// <param name="dayOfWeek">Day(s) of the week</param> public MonthTE(int monthIntervals, DateTime firstDateTime, DayOfWeekEnum dayOfWeek) { _monthIntervals = monthIntervals; _firstDateTime = firstDateTime.Date; _dayOfWeek = TEHelpers.GetDayOfWeekValue(dayOfWeek); _monthIntervalType = eMonthIntervalType.EachWeekSelectedWeekDays; }
public DayInQuarterTE( QuarterEnum quarter, QuarterlyIntervalEnum quarterInterval, MonthlyIntervalEnum monthInterval, DayOfWeekEnum dayOfWeek) { _quarter = GetQuarterValue(quarter); _dayOfWeek = TEHelpers.GetDayOfWeekValue(dayOfWeek); _monthInterval = TEHelpers.GetMonthlyIntervalValue(monthInterval); _quarterInterval = GetQuarterIntervalValue(quarterInterval); }
public override bool Includes(DateTime aDate) { var quarterMonthArray = BuildMonthQuarterMatrix(); int ourMonth = (int)quarterMonthArray.GetValue(_quarter, _quarterInterval) + 1; // since our months are zero-based if (aDate.Month == ourMonth) { // we have a match on Month! Now just need to check day ... return(TEHelpers.DayOfWeekMatches(aDate, _dayOfWeek) && TEHelpers.WeekMatches(aDate, _monthInterval)); } return(false); }
public override bool Includes(DateTime aDate) { if (_monthIntervalType == eMonthIntervalType.EachWeekSelectedWeekDays) { return(IntervalMatches(aDate) && TEHelpers.DayOfWeekMatches(aDate, _dayOfWeek)); } else if (_monthIntervalType == eMonthIntervalType.SelectedDate) { return(IntervalMatches(aDate) && TEHelpers.DayMatches(aDate, _date)); } else { return(IntervalMatches(aDate) && TEHelpers.DayOfWeekMatches(aDate, _dayOfWeek) && TEHelpers.WeekMatches(aDate, _monthlyInterval)); } }
/// <summary> /// Returns true if the date falls on a holiday /// </summary> /// <param name="aDate"></param> /// <returns></returns> public override bool Includes(DateTime aDate) { return(MonthMatches(aDate) && TEHelpers.DayOfWeekMatches(aDate, _dayOfWeek) && TEHelpers.WeekMatches(aDate, _monthlyInterval)); }