Пример #1
0
        public ActionResult JobSave(JobModel savemodel)
        {
            var jobgroupList = JobGroupEnum.JobGroup1.ToSelectList();

            jobgroupList.Insert(0, new SelectListItem {
                Text = "请选择", Value = string.Empty
            });
            ViewData["JobGroupList"] = jobgroupList;
            var schedulerList = _job.GetListScheduler().ToSelectList(c => c.SCHED_NAME, c => c.SCHED_NAME);

            schedulerList.Insert(0, new SelectListItem {
                Text = "请选择", Value = string.Empty
            });
            ViewData["schedulerList"] = schedulerList;

            var model = _job.GetJob(savemodel.JOB_NAME);

            if (model == null)
            {
                if (ModelState.IsValid)
                {
                    model = new QRTZ_JOB_DETAILS
                    {
                        SCHED_NAME     = savemodel.SCHED_NAME,
                        JOB_NAME       = savemodel.JOB_NAME,
                        JOB_GROUP      = savemodel.JOB_GROUP,
                        JOB_CLASS_NAME = savemodel.JOB_CLASS_NAME,
                        DESCRIPTION    = savemodel.DESCRIPTION,
                        JOB_DATA       = new byte[0]
                    };
                    var result = _job.AddJob(model);
                    if (result.Ret == -1)
                    {
                        ModelState.AddModelError("JOB_NAME", result.Msg);
                        return(View(savemodel));
                    }
                    return(CloseParentBox("保存成功", "/Job/JobList"));
                }
            }
            else
            {
                model.JOB_CLASS_NAME = savemodel.JOB_CLASS_NAME;
                model.DESCRIPTION    = savemodel.DESCRIPTION;

                var result = _job.UpdateJob(model);
                if (result.Ret == -1)
                {
                    ModelState.AddModelError("JOB_NAME", result.Msg);
                    return(View(savemodel));
                }
                return(CloseParentBox("修改成功", "/Job/JobList"));
            }
            return(View(savemodel));
        }
Пример #2
0
 public RequestResultDto UpdateJob(QRTZ_JOB_DETAILS model)
 {
     try
     {
         _qrtz_job_details.UpdateJob(model);
         _result.Ret = 0;
         _result.Msg = "修改成功";
     }
     catch (Exception e)
     {
         _result.Msg = e.Message;
     }
     return(_result);
 }