You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
|
|
|
|
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<SendMailJob>().Build();
|
|
|
|
|
ITrigger trigger = TriggerBuilder.Create()
|
|
|
|
|
.WithSimpleSchedule(t =>
|
|
|
|
|
t.WithIntervalInSeconds(5)
|
|
|
|
|
.RepeatForever())
|
|
|
|
|
.Build();
|
|
|
|
|
scheduler.ScheduleJob(job, trigger);
|
|
|
|
|
|
|
|
|
|
//截港日期前3小时,发送提醒邮件
|
|
|
|
|
IJobDetail jobDeadline = JobBuilder.Create<DeadlineJob>().Build();
|
|
|
|
|
ITrigger triggerDeadline = TriggerBuilder.Create()
|
|
|
|
|
.WithSimpleSchedule(t =>
|
|
|
|
|
t.WithIntervalInHours(1)
|
|
|
|
|
.RepeatForever())
|
|
|
|
|
.Build();
|
|
|
|
|
scheduler.ScheduleJob(jobDeadline, triggerDeadline);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|