Esempio n. 1
0
 protected void Update_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         //trường hợp adin reset pass
         // trả về Request Id và request cookie admin
         if (Request.QueryString ["Id"] != null && Request.Cookies["Admin"].Value == "1")
         {
             string           Id      = Request.QueryString["Id"].ToString();
             string           Passnew = txtPassNew.Text;
             List <Data.User> list    = UserBUS.User_GetById(Id);
             if (list.Count > 0)
             {
                 if (txtPassOld.Text == list[0].Password)
                 {
                     Data.SqlDataProvider sql = new Data.SqlDataProvider();
                     sql.ExecuteNonQuery("Update [Users] set Password='******'  Where Id='" + Id + "'");
                     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Update thành công mật khẩu mới');", true);
                 }
                 else
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Update không thành công');", true);
                 }
             }
             list.Clear();
             list = null;
         }
         else
         {
             List <Data.User> list = UserBUS.User_GetById(IdUser);
             if (list.Count > 0)
             {
                 if (txtPassOld.Text == list[0].Password)
                 {
                     Data.SqlDataProvider sql = new Data.SqlDataProvider();
                     sql.ExecuteNonQuery("Update [Users] set Password='******'  Where Id='" + IdUser + "'");
                     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Update thành công mật khẩu mới');", true);
                 }
                 else
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Update không thành công');", true);
                 }
             }
             list.Clear();
             list = null;
         }
     }
 }
Esempio n. 2
0
 protected void lbtReset_Click(object sender, EventArgs e)
 {
     Data.SqlDataProvider sql = new Data.SqlDataProvider();
     sql.ExecuteNonQuery("Update [Users] set Password='******'  Where Id='" + Request.QueryString["Id"] + "'");
     ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Reset mật khẩu mới thành 12345679');", true);
 }