1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using cuidian.Common;
- using Quartz;
- using Quartz.Impl;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TaskSchedule;
- namespace TimeSchedule
- {
- public class Time_U8_to_Wang
- {
- public static void GoU8_to_Wang()
- {
- ISchedulerFactory sf = new StdSchedulerFactory();
- IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- //创建任务实例
- IJobDetail job = JobBuilder.Create<U8_to_Wang>().WithIdentity(new JobKey("job1")).Build();
- //创建触发器实例
- ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("U8_To_Wang")).Build();
- scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- scheduler.Start(); //启动监控
- }
- //public static void GoEndU8_to_Wang()
- //{
- // ISchedulerFactory sf = new StdSchedulerFactory();
- // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- // 创建任务实例
- // IJobDetail job = JobBuilder.Create<EndU8_to_Wang>().WithIdentity(new JobKey("job2")).Build();
- // 创建触发器实例
- // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("U8_To_Wang")).Build();
- // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- // scheduler.Start(); //启动监控
- //}
- public static void GoWang_to_U8()
- {
- ISchedulerFactory sf = new StdSchedulerFactory();
- IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- IJobDetail job = JobBuilder.Create<Wang_to_U8>().WithIdentity(new JobKey("job2")).Build();
- //创建触发器实例"0 0 10 * * ? "
- ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("Wang_To_U8")).Build();
- scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- scheduler.Start(); //启动监控
-
- }
- //public static void GoWang_to_U8Two()
- //{
- // ISchedulerFactory sf = new StdSchedulerFactory();
- // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- // IJobDetail job = JobBuilder.Create<Wang_to_U8Two>().WithIdentity(new JobKey("job3")).Build();
- // //创建触发器实例"0 0 10 * * ? "
- // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule("0 0 2 * * ? ").Build();
- // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- // scheduler.Start(); //启动监控
- //}
- //public static void GoWang_to_U8Three()
- //{
- // ISchedulerFactory sf = new StdSchedulerFactory();
- // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- // IJobDetail job = JobBuilder.Create<Wang_to_U8>().WithIdentity(new JobKey("job2")).Build();
- // //创建触发器实例"0 0 10 * * ? "
- // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule("0 0 4 * * ? ").Build();
- // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- // scheduler.Start(); //启动监控
- //}
- //public static void GoEndWang_to_U8()
- //{
- // ISchedulerFactory sf = new StdSchedulerFactory();
- // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- // //创建任务实例
- // IJobDetail job = JobBuilder.Create<EndWang_to_U8>().WithIdentity(new JobKey("job4")).Build();
- // //创建触发器实例"0 0 0/4 * * ?"
- // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("Wang_To_U8")).Build();
- // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- // scheduler.Start(); //启动监控
- //}
- }
- }
|