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

@ -1,6 +1,9 @@
using System.Web.Http;
using Fab2ApprovalSystem.Workers;
using Microsoft.Owin;
using Owin;
using Quartz;
using Quartz.Impl;
[assembly: OwinStartupAttribute(typeof(Fab2ApprovalSystem.Startup))]
namespace Fab2ApprovalSystem
@ -10,6 +13,22 @@ namespace Fab2ApprovalSystem
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
IScheduler scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();
IJobDetail oooTrainingReportJob = JobBuilder.Create<OOOTrainingReportJob>()
.WithIdentity("oooTrainingReportJob", "trainingReportGroup")
.Build();
ITrigger oooTrainingReportTrigger = TriggerBuilder.Create()
.WithIdentity("oooTrainingReportTrigger", "trainingReportGroup")
.WithCronSchedule("15 13 * * MON")
.ForJob(oooTrainingReportJob)
.Build();
scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger);
}
public void Configuration(IAppBuilder app)
{