Esempio n. 1
0
        public JsonResult UpdateUserAction(MesWeb.Model.T_User user)
        {
            var retData = new VM_Result_Data();
            var bllUser = new MesWeb.BLL.T_User();

            retData.Content = "更新用户失败";
            if (user != null)
            {
                var oldUser = bllUser.GetModel(user.UserID);
                if (oldUser != null)
                {
                    //如果用户没有输入密码,则使用原来的密码
                    if (string.IsNullOrEmpty(user.Password))
                    {
                        user.Password = oldUser.Password;
                    }
                    else
                    {
                        //对用户的密码进行第二次加密
                        user.Password = SecurityHelper.encryptMD5Pwd(user.Password);
                    }
                    try {
                        if (bllUser.Update(user))
                        {
                            retData.Code    = RESULT_CODE.OK;
                            retData.Content = "更新用户成功";
                        }
                    } catch (Exception e) {
                        log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                        log.Error("更新用户失败!", e);
                    }
                }
            }
            return(Json(retData));
        }
Esempio n. 2
0
        public JsonResult GetSelEmployeeAction(int Id)
        {
            var bllUser = new MesWeb.BLL.T_User();
            var user    = bllUser.GetModel(Id);

            if (user != null)
            {
                var bllEmp = new MesWeb.BLL.T_Employee();
                var empId  = bllEmp.GetModel(user.EmployeeID.Value).EmployeeID;
                if (empId > 0)
                {
                    return(new BasicDataController().GetSelEmployeeAction(empId));
                }
            }
            log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
            log.Error("获取员工信息失败!");
            return(null);
        }
Esempio n. 3
0
        public JsonResult GetUserPasswdAction(int userId)
        {
            var retData = new VM_Result_Data();
            var bllUser = new MesWeb.BLL.T_User();
            var user    = bllUser.GetModel(userId);

            if (user != null)
            {
                retData.Appendix = user;
                user.Password    = "";
                retData.Code     = RESULT_CODE.OK;
                retData.Content  = "加载账号密码成功";
            }
            else
            {
                retData.Content = "加载账号密码失败";
                log             = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name);
                log.Error("加载账号密码失败!");
            }
            return(Json(retData));
        }
Esempio n. 4
0
        public JsonResult GetSelUserValidAction(int Id)
        {
            var vmCscDropList = new List <VM_CscDrop>();
            var bllUser       = new MesWeb.BLL.T_User();
            var user          = bllUser.GetModel(Id);

            vmCscDropList.Add(new VM_CscDrop {
                label = "是", value = "1"
            });
            vmCscDropList.Add(new VM_CscDrop {
                label = "否", value = "0"
            });
            if (user.IsValidate)
            {
                vmCscDropList[0].selected = true;
            }
            else
            {
                vmCscDropList[1].selected = true;
            }
            return(Json(vmCscDropList));
        }