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.
DS7/BookingWeb/App_Start/JobScheduler.cs

28 lines
702 B
C#

3 years ago

using BookingWeb.Job;
using Quartz;
using Quartz.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BookingWeb
{
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);
}
}
}