123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using LeaRun.Application.Web.QuartzJob;
- using Quartz;
- using Quartz.Impl;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace LeaRun.Application.Web.Common
- {
- public class NBHistoryJobRunning
- {
- static IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
- public static void JobRunning()
- {
-
- IJobDetail job = JobBuilder.Create<NBHistotyUploadJob>()
- .WithIdentity("nbHis", "group1")
- .Build();
- ITrigger trigger = TriggerBuilder.Create()
- .WithIdentity("nbHis", "group1")
- .StartNow()
- .WithSimpleSchedule(x => x
- .WithIntervalInSeconds(7200)
- .RepeatForever())
- .Build();
- scheduler.ScheduleJob(job, trigger);
- scheduler.Start();
- }
- public static void JobEndding()
- {
- if (scheduler.IsStarted)
- {
- scheduler.Shutdown(false);
- }
- }
- }
- }
|