//获取传递过来的stuid
int id = Convert.ToInt32(User.Identity.Name);
Students student = StudentsBLL.getall(id);
string pwd = student.Password;
//判断当前stuid是否为空值
if (this.txt_pass.Text != pwd)
{
Response.Write("<Script>alert('旧密码输入不正确')</Script>");
return;
}
else if (this.txt_pass.Text == this.txt_stupass.Text)
{
Response.Write("<Script>alert('旧密码不能与新密码相同')</Script>");
return;
}
else if (this.txt_stupass.Text != this.txt_xinstupass.Text)
{
Response.Write("<Script>alert('两次密码输入不相同')</Script>");
return;
}
else
{
//定义一个model对象
Students stu = new Students();
//获取id
stu.StuId = Convert.ToInt32(User.Identity.Name);
//给password赋值
stu.Password = this.txt_stupass.Text;
if (StudentsBLL.updatepass(stu) > 0)
{
Response.Write("<Script>alert('修改成功')</Script>");
}
}