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.

37 lines
1.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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);
}
}
}