using BookingJieFeng.Job; using Quartz; using Quartz.Impl; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace BookingJieFeng { public static class JobScheduler { public static void Start() { IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler(); scheduler.Start(); IJobDetail job = JobBuilder.Create().Build(); ITrigger trigger = TriggerBuilder.Create() .WithSimpleSchedule(t => t.WithIntervalInSeconds(5) .RepeatForever()) .Build(); scheduler.ScheduleJob(job, trigger); //截港日期前3小时,发送提醒邮件 IJobDetail jobDeadline = JobBuilder.Create().Build(); ITrigger triggerDeadline = TriggerBuilder.Create() .WithSimpleSchedule(t => t.WithIntervalInHours(1) .RepeatForever()) .Build(); scheduler.ScheduleJob(jobDeadline, triggerDeadline); } } }