public void Apply(TriggerBuilder builder, TriggerPropertiesViewModel model) { builder.WithCronSchedule(Expression, x => { if (!string.IsNullOrEmpty(TimeZone)) { x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(TimeZone)); } switch (model.MisfireInstruction) { case InstructionNotSet: break; case IgnoreMisfirePolicy: x.WithMisfireHandlingInstructionIgnoreMisfires(); break; case CronTrigger.DoNothing: x.WithMisfireHandlingInstructionDoNothing(); break; case CronTrigger.FireOnceNow: x.WithMisfireHandlingInstructionFireAndProceed(); break; default: throw new ArgumentException("Invalid value: " + model.MisfireInstruction, nameof(model.MisfireInstruction)); } }); }
public void Apply(TriggerBuilder builder, TriggerPropertiesViewModel model) { builder.WithCalendarIntervalSchedule(x => { if (!string.IsNullOrEmpty(TimeZone)) { x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(TimeZone)); } x.WithInterval(RepeatInterval.Value, RepeatUnit); x.PreserveHourOfDayAcrossDaylightSavings(PreserveHourAcrossDst); x.SkipDayIfHourDoesNotExist(SkipDayIfHourDoesNotExist); switch (model.MisfireInstruction) { case InstructionNotSet: break; case IgnoreMisfirePolicy: x.WithMisfireHandlingInstructionIgnoreMisfires(); break; case CalendarIntervalTrigger.DoNothing: x.WithMisfireHandlingInstructionDoNothing(); break; case CalendarIntervalTrigger.FireOnceNow: x.WithMisfireHandlingInstructionFireAndProceed(); break; default: throw new ArgumentException("Invalid value: " + model.MisfireInstruction, nameof(model.MisfireInstruction)); } }); }
public void Apply(TriggerBuilder builder, TriggerPropertiesViewModel model) { builder.WithSimpleSchedule(x => { x.WithInterval(GetRepeatIntervalTimeSpan()); if (RepeatForever) { x.RepeatForever(); } else { x.WithRepeatCount(RepeatCount.Value); } switch (model.MisfireInstruction) { case InstructionNotSet: break; case IgnoreMisfirePolicy: x.WithMisfireHandlingInstructionIgnoreMisfires(); break; case SimpleTrigger.FireNow: x.WithMisfireHandlingInstructionFireNow(); break; case SimpleTrigger.RescheduleNowWithExistingRepeatCount: x.WithMisfireHandlingInstructionNowWithExistingCount(); break; case SimpleTrigger.RescheduleNowWithRemainingRepeatCount: x.WithMisfireHandlingInstructionNowWithRemainingCount(); break; case SimpleTrigger.RescheduleNextWithRemainingCount: x.WithMisfireHandlingInstructionNextWithExistingCount(); break; default: throw new ArgumentException("Invalid value: " + model.MisfireInstruction, nameof(model.MisfireInstruction)); } }); }
public void Apply(TriggerBuilder builder, TriggerPropertiesViewModel model) { builder.WithDailyTimeIntervalSchedule(x => { if (!string.IsNullOrEmpty(TimeZone)) { x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(TimeZone)); } if (!RepeatForever) { x.WithRepeatCount(RepeatCount.Value); } x.WithInterval(RepeatInterval.Value, RepeatUnit); x.StartingDailyAt(StartTime.Value.ToTimeOfDay()); x.EndingDailyAt(EndTime.Value.ToTimeOfDay()); x.OnDaysOfTheWeek(DaysOfWeek.GetSelected().ToArray()); switch (model.MisfireInstruction) { case InstructionNotSet: break; case IgnoreMisfirePolicy: x.WithMisfireHandlingInstructionIgnoreMisfires(); break; case DailyTimeIntervalTrigger.DoNothing: x.WithMisfireHandlingInstructionDoNothing(); break; case DailyTimeIntervalTrigger.FireOnceNow: x.WithMisfireHandlingInstructionFireAndProceed(); break; default: throw new ArgumentException("Invalid value: " + model.MisfireInstruction, nameof(model.MisfireInstruction)); } }); }