Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            VPBLL.Vendor.VenderHelper vhelp = new VPBLL.Vendor.VenderHelper();
            List<VPBLL.Vendor.ABiVendor> vendorList = vhelp.getABiVendor(this.vendorName.Value, this.taxNumber.Value);
            if (vendorList != null && vendorList.Count > 0)
            {
                VPBLL.Vendor.ABiVendor vendor = vendorList[0];
                VPBLL.Users.UsersHelper uhelp = new VPBLL.Users.UsersHelper();
                List<VPBLL.Users.ABiAdminUsers>userList=uhelp.getUsers(vendor.VendorCode);
                if (userList != null && userList.Count > 0)
                {
                    VPBLL.Users.ABiAdminUsers user = VPBLL.Users.ABiAdminUsers.FromABiVendor(vendor);
                    VPBLL.Users.ABiAdminUsers user1 = userList[0];
                    user.ABi_Admin_Users_ID = user1.ABi_Admin_Users_ID;
                    user.Password = user.Password.Substring(user.Password.Length - 6, 6);
                    user.PwdLastChanged = user.PwdLastChanged.AddDays(-91);
                    uhelp.updateUsersPassWord(user, true);
                    ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('密码初始化成功,请尽快修改密码');</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('该供应商未开设帐号');</script>");

                }

            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('无相关信息');</script>");
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string NewPassword = this.newPassWord.Value;
            if (NewPassword.Length < 8)
            {
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('新密码必须大于8位')</script>");
                return;
            }
            else if (this.newPassWord.Value != this.newPassWord2.Value)
            {
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('二次密码输入不相同')</script>");
                return;
            }
            VPBLL.Users.UsersHelper uhelper = new VPBLL.Users.UsersHelper();
            List<VPBLL.Users.ABiAdminUsers> uList = uhelper.getUsersByID(this.UserID);

            if (uList != null && uList.Count > 0)
            {
                VPBLL.Users.ABiAdminUsers users=uList[0];
                if (users.Password != uhelper.getMd5Hash(this.oldPassWord.Value))
                {
                    ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>setResult('原密码错误');</script>");
                    return;
                }
                users.Password = this.newPassWord.Value;
                users.PwdLastChanged = DateTime.Now;
                uhelper.updateUsersPassWord(users, false);

                if (Response.Cookies["NeedResetPwd"] != null)
                    Response.Cookies["NeedResetPwd"].Value = "false";
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('密码修改成功');closeForm();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alertpwd", "<script>alert('用户已实效')</script>");
                return;
            }
        }