private static string zCronDayOfWeekValue(MonthlySchedule schedule, WeekdayPosition?weekdayPosition, DayOfWeek?weekDay) { if (schedule.MonthlyRecurrenceType == MonthlyRecurrenceType.Weekdays) { if (weekdayPosition.HasValue && weekDay.HasValue) { if (weekdayPosition.Value == WeekdayPosition.Last) { return(String.Format("{0}L", (int)weekDay.Value + 1)); } else { return(String.Format("{0}#{1}", (int)weekDay.Value + 1, weekdayPosition.Value + 1)); } } else if (schedule.Weekdays.Count == 7) { return("*"); } else { return(DescriptionUtils.BuildDescriptiveList(schedule.Weekdays, false, false, wd => ((int)wd + 1).ToString())); } } else { return("?"); } }
private static string zCronMonthValue(MonthlySchedule schedule) { if (schedule.MonthlyRecurrence.Count == 12) { return("*"); } else { return(DescriptionUtils.BuildDescriptiveList(schedule.MonthlyRecurrence, false, false, m => ((int)m + 1).ToString())); } }
private static string zCronDayOfMonthValue(MonthlySchedule schedule) { if (schedule.MonthlyRecurrenceType == MonthlyRecurrenceType.OrdinalDays) { if ((schedule.OrdinalDays.Count == 31 && !schedule.OrdinalDays.Contains(-1)) || schedule.OrdinalDays.Count == 32) { return("*"); } else { //The documentation says that using L with a list could cause unexpected results. If this doesn't work, find other way to do this. return(DescriptionUtils.BuildDescriptiveList(schedule.OrdinalDays, false, false, od => od > -1 ? ((int)od + 1).ToString() : "L")); } } else { return("?"); } }