Creating OOOTrainingReport scheduled job

This commit is contained in:
Chase Tucker
2023-09-18 09:21:41 -07:00
parent 9c5c938157
commit 167db67027
7 changed files with 137 additions and 73 deletions

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Fab2ApprovalSystem.Workers;
using Quartz.Impl;
using Quartz;
namespace Fab2ApprovalSystem.JobSchedules
{
public class OOOTrainingReportJobSchedule
{
public static void Start()
{
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
IScheduler scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();
scheduler.Start();
IJobDetail oooTrainingReportJob = JobBuilder.Create<OOOTrainingReportJob>()
.WithIdentity("oooTrainingReportJob", "trainingReportGroup")
.Build();
ITrigger oooTrainingReportTrigger = TriggerBuilder.Create()
.WithIdentity("oooTrainingReportTrigger", "trainingReportGroup")
.WithCronSchedule("0 0 12 ? * 2 *")
.ForJob(oooTrainingReportJob)
.Build();
scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger);
}
}
}