Ejemplo n.º 1
0
        /// <summary>
        /// 修改字典
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        public bool UpdateDict(WXQ.Enties.Dict model)
        {
            DictManager DictManager = new DictManager();

            model.UpdateUser = this.OpUserId.ToString();
            return(DictManager.Db.Updateable(model).Where(m => m.DictId == model.DictId).ExecuteCommand() > 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加字典
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertDict(WXQ.Enties.Dict model)
        {
            DictManager DictManager = new DictManager();

            model.AddUser = this.OpUserId.ToString();
            return(DictManager.Insert(model));
        }
Ejemplo n.º 3
0
        public JsonResult UpdateDict([FromForm]  WXQ.InOutPutEntites.Input.configmanager.Dict.UpdateDictInput model)
        {
            ResponseResult result = new ResponseResult();

            UpdateDictInputModelValidation validator = new UpdateDictInputModelValidation();
            ValidationResult vr = validator.Validate(model);

            if (!vr.IsValid)
            {
                result.Code   = ResponseResultMessageDefine.ParaError;
                result.Errors = vr.Errors.Select(e => e.ErrorMessage).ToList();
            }
            else
            {
                int userId = WebApi.Common.HelpOp.UserOp.GetUserId(this.User);
                WXQ.BusinessCore.CommonManager.DictOp op = new WXQ.BusinessCore.CommonManager.DictOp(userId);

                WXQ.Enties.Dict r = new WXQ.Enties.Dict
                {
                    DictId         = model.DictId,
                    Description    = model.Description,
                    DictKey        = model.DictKey,
                    DictValue      = model.DictValue,
                    DictType       = model.DictType,
                    OrderBy        = model.OrderBy,
                    GroupName      = model.GroupName,
                    UpdateDateTime = DateTime.Now,
                    UpdateUser     = this.User.Identity.Name
                };

                bool rv = op.UpdateDict(r);

                if (!rv)
                {
                    result.Code = ResponseResultMessageDefine.OpLost;
                    result.Errors.Add(ResponseResultMessageDefine.OpLostMessage);
                }
            }

            return(Json(result));
        }