Exemplo n.º 1
0
        public static ITrigger CreateTrigger(Repeat repeatType, string description = "")
        {
            var cronExpression = CronJob.GetCronExpression(repeatType, default);
            var triggerKey     = TriggerPrefixName + repeatType;
            var trigger        = TriggerBuilder.Create()
                                 .WithIdentity(triggerKey)
                                 .WithCronSchedule(cronExpression)
                                 .WithDescription(description)
                                 .StartNow()
                                 .Build();

            return(trigger);
        }
Exemplo n.º 2
0
        public static ITrigger CreateTriggerForExistedJob(DateTime startDate, Repeat repeatType, string description = "")
        {
            if (repeatType == Repeat.Once)
            {
                return(CreateTriggerForExistedJob(startDate, description));
            }
            var cronExpression   = CronJob.GetCronExpression(repeatType, startDate);
            var triggerKey       = TriggerPrefixName + startDate;
            var triggersGroupKey = TriggersPrefixName + repeatType;
            var jobKey           = QuartzJob.GetJobKey(repeatType);

            return(TriggerBuilder.Create()
                   .WithIdentity(triggerKey, triggersGroupKey)
                   .WithCronSchedule(cronExpression)
                   .WithDescription(description)
                   .ForJob(jobKey)
                   .Build());
        }
Exemplo n.º 3
0
        public static ITrigger CreateTrigger(DateTime startDate, Repeat repeatType, string description)
        {
            ITrigger trigger;

            if (repeatType == Repeat.Once)
            {
                trigger = CreateTrigger(startDate, description);
            }
            else
            {
                var cronExpression = CronJob.GetCronExpression(repeatType, startDate);
                var triggerKey     = TriggerPrefixName + startDate;
                var groupKey       = TriggersPrefixName + repeatType;
                trigger = TriggerBuilder.Create()
                          .WithIdentity(triggerKey, groupKey)
                          .WithCronSchedule(cronExpression)
                          .WithDescription(description)
                          .Build();
            }
            return(trigger);
        }