Exemplo n.º 1
0
        /// <summary>
        /// 获取作业任务
        /// </summary>
        /// <returns></returns>
        public JsonResult GetJobInfo()
        {
            List <JobPager> joblist = new List <JobPager>();

            try
            {
                joblist = JobInfoDb.GetJobPager();
                joblist.ForEach(f =>
                {
                    string nowtime   = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    f.NEXT_FIRE_TIME = f.NEXT_FIRE_TIME == null ? nowtime : new DateTime(Convert.ToInt64(f.NEXT_FIRE_TIME)).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
                    f.PREV_FIRE_TIME = f.PREV_FIRE_TIME == null ? nowtime : new DateTime(Convert.ToInt64(f.PREV_FIRE_TIME)).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
                    f.START_TIME     = f.START_TIME == null ? nowtime : new DateTime(Convert.ToInt64(f.START_TIME)).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
                });
                return(Json(new AjaxResult
                {
                    Result = true,
                    Data = joblist,
                    ErrorMsg = null
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new AjaxResult
                {
                    Result = false,
                    ErrorMsg = ex.ToString()
                }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更换版本
 /// </summary>
 /// <param name="jobInfo"></param>
 /// <returns></returns>
 public bool Upgrade(JobInfo jobInfo)
 {
     try
     {
         return(JobInfoDb.UpdateJobInfo(jobInfo) > 0);
     }
     catch (Exception ex)
     {
         // LogService.WriteLog(ex, "Upgrade 失败");
     }
     return(false);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Delete(int id)
        {
            bool res = false;

            try
            {
                if (id > 0)
                {
                    res = JobInfoDb.DeleteJobInfo(new JobInfo {
                        IsDeleted = 1, Id = id
                    }) > 0;
                }
            }
            catch (Exception ex)
            {
                //LogService.WriteLog(ex, "Delete 失败");
            }
            return(res);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 添加作业任务
        /// </summary>
        /// <param name="jobInfo"></param>
        /// <returns></returns>
        public JsonResult AddJobInfo(JobInfo jobInfo)
        {
            AjaxResult Res = new AjaxResult();

            try
            {
                jobInfo.JobGroup = jobInfo.SchedName;
                int res = JobInfoDb.AddJobInfo(jobInfo);
                if (res > 0)
                {
                    Res.Result = true;
                }
                else
                {
                    Res.Result = false;
                }
            }
            catch (Exception ex)
            {
                Res.Result   = false;
                Res.ErrorMsg = ex.ToString();
            }
            return(Json(Res, JsonRequestBehavior.AllowGet));
        }