protected void Button_Click1(object sender, EventArgs e) { string managerID = this.Session["ManagerID"].ToString(); ManagerBll managerBll = new ManagerBll(); ManagerEnitity managerEntity = new ManagerEnitity(); managerEntity.ManagerID = managerID; DataTable byID = managerBll.GetByID(managerEntity); if (this.MD5(this.TextBox1.Text.Trim()) != byID.Rows[0]["ManagerPwd"].ToString().Trim()) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('旧密码错误')</script>"); this.TextBox1.Text = ""; this.TextBox2.Text = ""; this.TextBox3.Text = ""; return; } managerEntity.ManagerID = managerID; managerEntity.ManagerPwd = this.MD5(this.TextBox3.Text.Trim()); if (managerBll.Update_Pwd(managerEntity)) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('密码修改成功')</script>"); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('密码修改失败')</script>"); } this.TextBox1.Text = ""; this.TextBox2.Text = ""; this.TextBox3.Text = ""; }
protected void upPwd_Click1(object sender, EventArgs e) { ManagerBll managerBll = new ManagerBll(); if (managerBll.Update_Pwd(new ManagerEnitity { ManagerID = this.upPwd.CommandArgument.Trim(), ManagerPwd = this.MD5(this.txtPwd.Text.Trim()) })) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('修改密码成功');</script>"); } this.add.Visible = true; this.edit.Visible = false; this.ChangePwd.Visible = false; this.txtPwd.Text = ""; this.LoadPage(); }