예제 #1
0
 protected void Submit_Click(object sender, EventArgs e)
 {
     if (OriginalPassword.Text.Trim() == "" || NewPassword.Text.Trim() == "" || RepeatPassword.Text.Trim() == "")
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('输入不能为空');</script>");
         return;
     }
     else if (NewPassword.Text.Trim() == RepeatPassword.Text.Trim())
     {
         bool flag = bll.CheckUser(user.UID, OriginalPassword.Text.Trim());
         if (flag)
         {
             int result = bll.UpdatePassword(user.ID, NewPassword.Text.Trim());
             if (result == 0)
             {
                 Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改失败!');</script>");
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('修改成功!');location.href='BaseInfo.aspx';</script>");
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('原始密码错误!');</script>");
         }
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('两次输入不一致!');</script>");
     }
 }