Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string method = Utils.GetQueryStringValue("method");

            userName = MasterUserInfo.UserName;
            if (!CheckMasterGrant(YuYingPermission.帐户管理_管理该栏目, YuYingPermission.帐户管理_修改密码))
            {
                Utils.ResponseNoPermit(YuYingPermission.帐户管理_修改密码, true);
                return;
            }
            if (!CheckMasterGrant(YuYingPermission.帐户管理_管理该栏目, YuYingPermission.帐户管理_修改密码))
            {
                haveUpdate = false;
            }

            if (method == "update")
            {
                if (!haveUpdate)
                {
                    Utils.ResponseMeg(false, "对不起,你没有修改密码的权限!");
                    return;
                }
                string oldPass  = Utils.GetQueryStringValue("oldpass");
                string newPass1 = Utils.GetQueryStringValue("newpass1");
                string newPass2 = Utils.GetQueryStringValue("newpass2");
                if (oldPass == "" || newPass1 == "" || newPass2 == "")
                {
                    Utils.ResponseMegNoComplete();
                    return;
                }
                if (newPass1 != newPass2)
                {
                    Utils.ResponseMeg(false, "前后两次密码不匹配!");
                    return;
                }
                EyouSoft.IBLL.SystemStructure.ISystemUser userBll   = EyouSoft.BLL.SystemStructure.SystemUser.CreateInstance();
                EyouSoft.Model.SystemStructure.SystemUser userModel = userBll.GetSystemUserModel(MasterUserInfo.ID);
                if (userModel != null && userModel.PassWordInfo.NoEncryptPassword == oldPass)
                {
                    if (userBll.UpdateUserPassWord(MasterUserInfo.ID, newPass1) > 0)
                    {
                        Utils.ResponseMeg(true, "密码已修改,请妥善保管!");
                    }
                    else
                    {
                        Utils.ResponseMegError();
                    }
                }
                else
                {
                    Utils.ResponseMeg(false, "原密码不正确!");
                }
            }
        }
Beispiel #2
0
        protected void UpdateUser(int userId)
        {
            string userName = Utils.GetFormValue(us_txtUserName1.UniqueID, 16);
            string pass1    = Utils.GetFormValue(us_txtPass1.UniqueID);
            string pass2    = Utils.GetFormValue(us_txtPass2.UniqueID);
            string realName = Utils.GetFormValue(us_txtRealName.UniqueID, 16);
            string userTel  = Utils.GetFormValue(us_txtTel.UniqueID);

            if (userName == "" || realName == "" || userTel == "")
            {
                MessageBox.Show(this, "数据请填写完整!");
                return;
            }
            if (pass1 != pass2)
            {
                MessageBox.Show(this, "两次密码不一致!");
                return;
            }
            EyouSoft.Model.SystemStructure.SystemUser userModel = userBll.GetSystemUserModel(userId);
            if (userModel != null)
            {
                string areaIds = Utils.GetFormValue("ckSellCity");
                if (areaIds != "")
                {
                    userModel.AreaId = areaIds.Split(',').Select(i => Utils.GetInt(i)).ToList <int>();
                }
                userModel.UserName       = userName;
                userModel.ContactFax     = Utils.GetFormValue(us_txtFax.UniqueID, 30);
                userModel.ContactMobile  = Utils.GetFormValue(us_txtMoible.UniqueID);
                userModel.ContactTel     = userTel;
                userModel.ContactName    = realName;
                userModel.PermissionList = Utils.GetFormValue("chk_Permit");
                //获取绑定的用户类型
                IList <int> custTypeList = Utils.GetFormValues("chkCustType").Select(i => int.Parse(i)).ToList();
                userModel.CustomerTypeIds = custTypeList;

                if (pass1 != "")
                {
                    userBll.UpdateUserPassWord(userModel.ID, pass1);
                }
            }
            if (userBll.UpdateSystemUser(userModel) > 0)
            {
                MessageBox.ShowAndRedirect(this, "保存成功!", "UserListManage.aspx");
            }
            else
            {
                MessageBox.Show(this, "保存失败!");
            }
        }