public Schedule Add(Schedule schedule) { Schedule.Add(schedule); return schedule; }
/// <summary> /// Given a Date, will determine if the Date matches the STRING that was provided /// as the DAYS of the week that the process can RUN on. /// </summary> /// <param name="currentDateTime">The current date time.</param> /// <param name="schedule">The schedule.</param> /// <returns></returns> private static bool CheckDayOfWeek(DateTime currentDateTime, Schedule schedule) { if (!string.IsNullOrEmpty(schedule.DayOfWeek)) { if (schedule.DayOfWeek.ToUpper().Equals("WEEKEND")) { return IsDayAMatch(currentDateTime, new[] {"Saturday", "Sunday"}); } if (schedule.DayOfWeek.ToUpper().Equals("WEEK") || schedule.DayOfWeek.ToUpper().Equals("WEEKDAY")) { return !IsDayAMatch(currentDateTime, new[] {"Saturday", "Sunday"}); } if (schedule.DayOfWeek.Contains(",")) { return IsDayAMatch(currentDateTime, schedule.DayOfWeek.Split(',')); } return IsDayAMatch(currentDateTime, new[] {schedule.DayOfWeek}); } return true; }