示例#1
0
        public static PauseAwareCronScheduleBuilder WeeklyOnDayAndHourAndMinute(DayOfWeek dayOfWeek, int hour, int minute)
        {
            DateBuilder.ValidateHour(hour);
            DateBuilder.ValidateMinute(minute);
            string presumedValidCronExpression = string.Format("0 {0} {1} ? * {2}", minute, hour, (int)(dayOfWeek + 1));

            return(PauseAwareCronScheduleBuilder.CronScheduleNoParseException(presumedValidCronExpression));
        }
示例#2
0
        public static PauseAwareCronScheduleBuilder DailyAtHourAndMinute(int hour, int minute)
        {
            DateBuilder.ValidateHour(hour);
            DateBuilder.ValidateMinute(minute);
            string presumedValidCronExpression = string.Format("0 {0} {1} ? * *", minute, hour);

            return(PauseAwareCronScheduleBuilder.CronScheduleNoParseException(presumedValidCronExpression));
        }
示例#3
0
        public static PauseAwareCronScheduleBuilder MonthlyOnDayAndHourAndMinute(int dayOfMonth, int hour, int minute)
        {
            DateBuilder.ValidateDayOfMonth(dayOfMonth);
            DateBuilder.ValidateHour(hour);
            DateBuilder.ValidateMinute(minute);
            string presumedValidCronExpression = string.Format("0 {0} {1} {2} * ?", minute, hour, dayOfMonth);

            return(PauseAwareCronScheduleBuilder.CronScheduleNoParseException(presumedValidCronExpression));
        }
示例#4
0
        private static PauseAwareCronScheduleBuilder CronScheduleNoParseException(string presumedValidCronExpression)
        {
            PauseAwareCronScheduleBuilder result;

            try
            {
                result = PauseAwareCronScheduleBuilder.CronSchedule(new CronExpression(presumedValidCronExpression));
            }
            catch (FormatException innerException)
            {
                throw new Exception("CronExpression '" + presumedValidCronExpression + "' is invalid, which should not be possible, please report bug to Quartz developers.", innerException);
            }
            return(result);
        }
示例#5
0
        public static PauseAwareCronScheduleBuilder AtHourAndMinuteOnGivenDaysOfWeek(int hour, int minute, params DayOfWeek[] daysOfWeek)
        {
            if (daysOfWeek == null || daysOfWeek.Length == 0)
            {
                throw new ArgumentException("You must specify at least one day of week.");
            }
            DateBuilder.ValidateHour(hour);
            DateBuilder.ValidateMinute(minute);
            string text = string.Format("0 {0} {1} ? * {2}", minute, hour, (int)(daysOfWeek[0] + 1));

            for (int i = 1; i < daysOfWeek.Length; i++)
            {
                text = text + "," + (int)(daysOfWeek[i] + 1);
            }
            return(PauseAwareCronScheduleBuilder.CronScheduleNoParseException(text));
        }
示例#6
0
 public static PauseAwareCronScheduleBuilder CronSchedule(string cronExpression)
 {
     CronExpression.ValidateExpression(cronExpression);
     return(PauseAwareCronScheduleBuilder.CronScheduleNoParseException(cronExpression));
 }