예제 #1
0
        protected void Btn_Edit_Click(object sender, EventArgs e)
        {
            string id     = txt_ID.Text.Trim();
            string oldPwd = txt_Opwd.Text.Trim();
            string newPwd = txt_Npwd.Text.Trim();

            //查询旧密码是否正确
            UserInfo OuserInfo = new UserInfo
            {
                Uid  = id,
                UPwd = oldPwd
            };

            if (userInfoManager.Login(OuserInfo) != null)
            {
                UserInfo userInfo = new UserInfo
                {
                    Uid  = id,
                    UPwd = newPwd
                };
                if (userInfoManager.EditPwd(userInfo))
                {
                    Response.Write("<script>alert('修改成功,请重新登录');</script>");
                    Response.Write("<script>top.location.href='Login.aspx?logout=-1'</script>");
                }
                else
                {
                    Response.Write("<script>alert('修改失败,请联系管理员');</script>");
                }
            }
        }