예제 #1
0
        public static ITrigger CreateTriggerForExistedJob(DateTime startDate, string description = "")
        {
            var triggerKey = TriggerPrefixName + startDate;
            var groupKey   = TriggersPrefixName + Repeat.Once;
            var jobKey     = QuartzJob.GetJobKey(Repeat.Once);

            return(TriggerBuilder.Create()
                   .WithIdentity(triggerKey, groupKey)
                   .WithDescription(description)
                   .ForJob(jobKey)
                   .Build());
        }
예제 #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());
        }