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