Exemple #1
0
 public IActionResult TaskAdd()
 {
     if (Mid > 0)
     {
         scheMod = scheBll.GetModel(Mid);
     }
     return(View(scheMod));
 }
 private void MyBind()
 {
     if (Mid > 0)
     {
         scheMod            = scheBll.GetModel(Mid);
         TaskName_T.Text    = scheMod.TaskName;
         TaskContent_T.Text = scheMod.TaskContent;
         if (scheMod.ExecuteType == (int)M_Content_ScheTask.ExecuteTypeEnum.JustOnce)
         {
             ExecuteTime_T1.Text = scheMod.ExecuteTime.ToString();
         }
         if (scheMod.ExecuteType == (int)M_Content_ScheTask.ExecuteTypeEnum.EveryDay)
         {
             ExecuteTime_T2.Text = scheMod.ExecuteTime.ToString();
         }
         Interval_T.Text = scheMod.Interval > 0 ? scheMod.Interval.ToString() : "";
         Remind_T.Text   = scheMod.Remind;
         Save_Btn.Text   = "修改任务";
         function.Script(this, "SetRadVal('taskType_rad','" + scheMod.TaskType + "');");
         function.Script(this, "DisTaskTypeRad();");
         function.Script(this, "SetRadVal('executeType_rad','" + scheMod.ExecuteType + "');");
         function.Script(this, "SetRadVal('status_rad','" + scheMod.Status + "');");
     }
 }
        /// <summary>
        /// 根据判断,增加自动审核|过期任务
        /// </summary>
        /// <param name="CData">当前内容模型</param>
        /// <param name="taskInfo">任务信息</param>
        /// <param name="name">audit|expire</param>
        /// <param name="timeStr">日期时间字符串</param>
        /// <returns></returns>
        private JObject AddContentTask(M_CommonData CData, JObject taskInfo, string name, string timeStr)
        {
            //audit
            if (taskInfo[name] == null)
            {
                taskInfo.Add(name, 0);
                taskInfo.Add(name + "_time", "");
            }
            int taskId = DataConvert.CLng(taskInfo[name]);

            //如果未设置任务,并且指定了时间字符串,则新建
            if (taskId == 0 && !string.IsNullOrEmpty(timeStr))
            {
                DateTime time = DateTime.Now;
                if (DateTime.TryParse(timeStr, out time))
                {
                    taskInfo[name]           = AddTask(CData.GeneralID.ToString(), name, time);
                    taskInfo[name + "_time"] = timeStr;
                }
            }
            //对比时间是否修改,如果修改,则创建任务
            else if (taskId > 0)
            {
                string             taskTimeStr = taskInfo[name + "_time"].ToString();
                M_Content_ScheTask taskMod     = taskBll.GetModel(taskId);
                //不匹配则修改
                if (!taskTimeStr.Equals(timeStr))
                {
                    if (string.IsNullOrEmpty(timeStr))
                    {
                        taskInfo[name]           = 0;
                        taskInfo[name + "_time"] = "";
                        taskBll.DelByID(taskId.ToString());
                    }
                    else
                    {
                        taskMod.ExecuteTime = timeStr;
                        taskBll.Update(taskMod);
                        taskInfo[name + "_time"] = timeStr;
                    }
                }
            }
            return(taskInfo);
        }