Esempio n. 1
0
        public async Task <JsonResult> ScheduleJob(ScheduleJobInput input)
        {
            var status = new OperateStatus();

            try
            {
                if (!input.ReplaceExists)
                {
                    //if (StdSchedulerManager.CheckExists(new TriggerKey(input.TriggerName, input.TriggerGroup)))
                    //{
                    //    status.Message = "指定的触发器已经存在,请重新指定名称";
                    //    return Json(status);
                    //}
                    if (await StdSchedulerManager.CheckExists(new JobKey(input.JobName, input.JobGroup)))
                    {
                        status.Message = "指定的作业名已经存在,请重新指定名称";
                        return(Json(status));
                    }
                }
                input.IsSave = true;
                await StdSchedulerManager.ScheduleJob(input);

                status.ResultSign = ResultSign.Successful;
                status.Message    = "保存调度作业成功";
            }
            catch (Exception ex)
            {
                status.Message = ex.Message;
            }
            return(Json(status));
        }