public ResNoticeBase AddNotice([FromBody] NOTICEBOARDBASE notice)
        {
            ResNoticeBase retValue = new ResNoticeBase();

            using (var db = DbContext.GetInstance("T_NOTICE_BOARD"))
            {
                try
                {
                    //设置时间
                    notice.createTime   = DateTime.Now;
                    notice.lastEditTime = DateTime.Now;
                    //设置最近编辑人信息
                    notice.lastEditUserCode = notice.createUserCode;
                    notice.lastEditUserName = notice.createUserName;

                    var res = db.Insert(notice);
                    retValue.SuccessDefalut("发布成功", 1);
                    LogWirter.Record(LogType.Admin, OpType.Add, notice.mainTitle + "]", "添加公告 [", Convert.ToInt32(res), notice.createUserCode, notice.createUserName);
                }
                catch (Exception ex)
                {
                    retValue.FailDefalut(ex);
                }
            }
            return(retValue);
        }
        public ResNoticeBase UpdateNotice([FromBody] ReqNoticeBase notice)
        {
            ResNoticeBase retValue = new ResNoticeBase();

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

                        //设置时间
                        notice.lastEditTime = DateTime.Now;
                        //设置最近编辑人信息
                        notice.lastEditUserCode = notice.createUserCode;
                        notice.lastEditUserName = notice.createUserName;

                        var noticeModel = new NOTICEBOARDBASE();

                        db.Update <NOTICEBOARDBASE>(
                            new
                        {
                            mainTitle        = notice.mainTitle,
                            subHead          = notice.subHead,
                            content          = notice.content,
                            formatType       = notice.formatType,
                            contentType      = notice.contentType,
                            isTop            = notice.isTop,
                            lastEditUserName = notice.lastEditUserName,
                            lastEditUserCode = notice.lastEditUserCode
                        },
                            it => it.ID == notice.ID
                            );


                        retValue.SuccessDefalut("修改公告成功!", 1);
                        LogWirter.Record(LogType.Admin, OpType.Update, notice.mainTitle + "]", "修改公告 [", notice.ID, notice.createUserCode, notice.createUserName);
                    }
                    else
                    {
                        retValue.FailDefalut("不存在该公告ID");
                    }
                }
                catch (Exception ex)
                {
                    retValue.FailDefalut(ex);
                }
            }
            return(retValue);
        }