/// <summary> /// Every n month(s), selected week(s), 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> /// <param name="monthlyInterval">Week numbers. E.g., first week, second week, every week, second and third week, etc.</param> public MonthTE(int monthIntervals, DateTime firstDateTime, DayOfWeekEnum dayOfWeek, MonthlyIntervalEnum monthlyInterval) { _monthIntervals = monthIntervals; _firstDateTime = firstDateTime.Date; _dayOfWeek = TEHelpers.GetDayOfWeekValue(dayOfWeek); _monthlyInterval = TEHelpers.GetMonthlyIntervalValue(monthlyInterval); _monthIntervalType = eMonthIntervalType.SelectedWeekSelectedWeekDays; }
public DayInQuarterTE( QuarterEnum quarter, QuarterlyIntervalEnum quarterInterval, MonthlyIntervalEnum monthInterval, DayOfWeekEnum dayOfWeek) { _quarter = GetQuarterValue(quarter); _dayOfWeek = TEHelpers.GetDayOfWeekValue(dayOfWeek); _monthInterval = TEHelpers.GetMonthlyIntervalValue(monthInterval); _quarterInterval = GetQuarterIntervalValue(quarterInterval); }
internal static int GetMonthlyIntervalValue(MonthlyIntervalEnum monthlyIntervalOption) { switch (monthlyIntervalOption) { case MonthlyIntervalEnum.First: return 1; case MonthlyIntervalEnum.Second: return 2; case MonthlyIntervalEnum.Third: return 3; case MonthlyIntervalEnum.Fourth: return 4; case MonthlyIntervalEnum.Last: return -1; default: return 0; } }
/// <summary> /// The holiday month, day, and count where the holiday falls on a different /// date every year, e.g., first Monday of September (Labor Day): /// /// var laborDay = new FloatingHolidayTE(9, 1, 1); /// </summary> /// <param name="month"></param> /// <param name="dayOfWeekOption"></param> /// <param name="monthlyIntervalOption"></param> public FloatingHolidayTE(int month, DayOfWeekEnum dayOfWeekOption, MonthlyIntervalEnum monthlyIntervalOption) : base(dayOfWeekOption, monthlyIntervalOption) { _month = month; }
/// <summary> /// Creates a temporal expression using day of the week 0 to 6 and day /// of week in a month which can be positive (counting from the beginning /// of the month) or negative (counting from the end of the month). /// /// var example1 = new DayInMonthTE(4, 2); // "second Tues of the month" /// var example2 = new DayInMonthTE(32, 16); // "last Friday of the month" /// /// </summary> /// <param name="dayOfWeekOption">day of week</param> /// <param name="monthlyIntervalOption"></param> public DayInMonthTE(DayOfWeekEnum dayOfWeekOption, MonthlyIntervalEnum monthlyIntervalOption) : base(1, DateTime.MinValue, dayOfWeekOption, monthlyIntervalOption) { }
/// <summary> /// Creates a temporaral expression using day of the week 0 to 6 and day /// of week in a month which can be positive (counting from the beginning /// of the month) or negative (counting from the end of the month). /// /// var example1 = new DayInMonthTE(4, 2); // "second Tues of the month" /// var example2 = new DayInMonthTE(32, 16); // "last Friday of the month" /// /// </summary> /// <param name="dayOfWeekOption">day of week</param> /// <param name="monthlyIntervalOption"></param> public DayInMonthTE(DayOfWeekEnum dayOfWeekOption, MonthlyIntervalEnum monthlyIntervalOption) { _dayOfWeek = GetDayOfWeekValue(dayOfWeekOption); _monthlyInterval = GetMonthlyIntervalValue(monthlyIntervalOption); _ignoreWeek = false; }