Пример #1
0
        private static ICronTrigger CreateTrigger(DepotSchedule depotSchedule, Depot depot, JobKey jobKey)
        {
            var expression = CronExpressionConverter.ConvertToCronExpression(depotSchedule.DaysOfTheWeek, depotSchedule.Hour, depotSchedule.Minutes);
            //This is for debugging purposes
            //var result = CronExpression.IsValidExpression(expression);

            var timezone = TimeZoneInfo.GetSystemTimeZones().Single(tz => tz.Id == depot.TimeZoneId);

            var cronScheduleBuilder = CronScheduleBuilder.CronSchedule(expression).InTimeZone(timezone).WithMisfireHandlingInstructionFireAndProceed();
            return (ICronTrigger) TriggerBuilder.Create().ForJob(jobKey).WithSchedule(cronScheduleBuilder).Build();
        }
Пример #2
0
        private static ICronTrigger CreateTrigger(DepotSchedule depotSchedule, Depot depot, JobKey jobKey)
        {
            var expression = CronExpressionConverter.ConvertToCronExpression(depotSchedule.DaysOfTheWeek, depotSchedule.Hour, depotSchedule.Minutes);
            //This is for debugging purposes
            //var result = CronExpression.IsValidExpression(expression);

            var timezone = TimeZoneInfo.GetSystemTimeZones().Single(tz => tz.Id == depot.TimeZoneId);

            var cronScheduleBuilder = CronScheduleBuilder.CronSchedule(expression).InTimeZone(timezone).WithMisfireHandlingInstructionFireAndProceed();

            return((ICronTrigger)TriggerBuilder.Create().ForJob(jobKey).WithSchedule(cronScheduleBuilder).Build());
        }