Creating OOOTrainingReport scheduled job
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user