public ResTaskBase AddTask([FromBody] TASKBASE task)
        {
            ResTaskBase retValue = new ResTaskBase();

            using (var db = DbContext.GetInstance("T_TASK"))
            {
                try
                {
                    //规范日期格式
                    db.SerializerDateFormat = "yyyy-mm-dd";
                    //设置时间
                    task.createTime   = DateTime.Now;
                    task.lastEditTime = DateTime.Now;
                    //设置最近编辑人信息
                    task.lastEditUserCode = task.createUserCode;
                    task.lastEditUserName = task.createUserName;

                    var res = db.Insert(task);
                    retValue.SuccessDefalut("添加任务成功", 1);
                    LogWirter.Record(LogType.Personal, OpType.Add, task.taskTitle + "]", "创建任务 [", Convert.ToInt32(res), task.createUserCode, task.createUserName);
                }
                catch (Exception ex)
                {
                    retValue.FailDefalut(ex);
                }
            }
            return(retValue);
        }
        public ResTaskBase UpdateTask([FromBody] ReqTaskBase task)
        {
            ResTaskBase retValue = new ResTaskBase();

            using (var db = DbContext.GetInstance("T_TASK"))
            {
                try
                {
                    bool isIDExist = db.Queryable <TASKBASE>()
                                     .Any(s => s.ID == task.ID);
                    if (isIDExist)
                    {
                        // 设置禁止更新列
                        db.AddDisableUpdateColumns("create_time");

                        //规范日期格式
                        db.SerializerDateFormat = "yyyy-mm-dd";

                        //设置时间
                        task.lastEditTime = DateTime.Now;

                        //设置最近编辑人
                        task.lastEditUserCode = task.createUserCode;
                        task.lastEditUserName = task.createUserName;

                        var taskModel = new TASKBASE();

                        //只更新需要更新的部分
                        db.Update <TASKBASE>(
                            new
                        {
                            taskTitle        = task.taskTitle,
                            endTime          = task.endTime,
                            taskDescription  = task.taskDescription,
                            isDone           = task.isDone,
                            lastEditUserName = task.lastEditUserName,
                            lastEditUserCode = task.lastEditUserCode
                        },
                            it => it.ID == task.ID
                            );

                        retValue.SuccessDefalut("编辑任务成功", 1);
                        LogWirter.Record(LogType.Personal, OpType.Update, task.taskTitle + "]", "编辑任务 [", task.ID, task.createUserCode, task.createUserName);
                    }
                    else
                    {
                        retValue.FailDefalut("不存在该任务ID");
                    }
                }
                catch (Exception ex)
                {
                    retValue.FailDefalut(ex);
                }
            }
            return(retValue);
        }