public JsonResult UpdateState(string GroupName, string JobName, int State) { var result = new ResponseResult(); try { switch (State) { //0-等待 1-暂停 2-正常执行 3-阻塞 4-错误 case 0: QuartzHelper.StartJob(JobName, GroupName).GetAwaiter(); break; case 1: QuartzHelper.ResumeJob(JobName, GroupName).GetAwaiter(); break; case 2: QuartzHelper.PauseJob(JobName, GroupName).GetAwaiter(); break; } result.success = true; } catch (Exception ex) { result.success = false; result.message = ex.Message; } return(Json(result)); }
static async void HisTask(int minute, int repeatCount) { var triggle = QuartzHelper.CreateTimeIntervalTriggle(minute, repeatCount); triggle.JobDataMap.Add("date1", "2019-01-01"); triggle.JobDataMap.Add("date2", "2020-01-01"); await QuartzHelper.StartJob <PatientInfoJob>(nameof(HisTask), triggle, nameof(PatientInfoJob), nameof(HisTask)); }
private void LoadQuartz(IServiceProvider serviceProvider) { // Drawing lottery job var scheduler = serviceProvider.GetScheduler <IScheduler, ILotteryDrawingFactory>(); var drawingTime = DateTime.Parse(((SettingService)serviceProvider.GetService(typeof(ISettingService))).Queryable().FirstOrDefault(x => x.Name == CPLConstant.LotteryGameDrawingInHourOfDay).Value); QuartzHelper.StartJob <LotteryDrawingJob>(scheduler, drawingTime); }