You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Quartz;
|
|
|
|
|
using Quartz.Impl;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Job.InsuranceTask
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.Title = "保险调度服务程序";
|
|
|
|
|
LoggerManager log = new LoggerManager();
|
|
|
|
|
log.Write("监测程序正在运行,自动执行“保险回执调度”");
|
|
|
|
|
|
|
|
|
|
//实例化Quartz调度器工厂
|
|
|
|
|
ISchedulerFactory sf = new StdSchedulerFactory();
|
|
|
|
|
IScheduler sched = sf.GetScheduler();
|
|
|
|
|
IJobDetail job = new JobDetailImpl("AutoExecute", "Insurance_AutoExecute", typeof(InsuranceTaskJob));
|
|
|
|
|
var tim=ConfigurationManager.AppSettings.GetValues("interval");
|
|
|
|
|
int gap=1800;
|
|
|
|
|
if (tim.Length>0)
|
|
|
|
|
{
|
|
|
|
|
gap =Convert.ToInt32(tim[0]);
|
|
|
|
|
}
|
|
|
|
|
ITrigger t = TriggerBuilder.Create()
|
|
|
|
|
.WithIdentity("InsuranceExecute_JobTrigger1").ForJob(job)
|
|
|
|
|
.WithDailyTimeIntervalSchedule(p =>
|
|
|
|
|
p.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
|
|
|
|
|
.EndingDailyAt(TimeOfDay.HourAndMinuteOfDay(23, 59))
|
|
|
|
|
.WithIntervalInSeconds(gap).OnEveryDay()
|
|
|
|
|
).Build();
|
|
|
|
|
sched.ScheduleJob(job, t);
|
|
|
|
|
sched.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|