protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == true) { if (Request["btnLogin"] != null) { try { StudentInfo.StudentInfoWS service = new StudentInfo.StudentInfoWS(); string taiKhoan = Request["txt_RecordID"].ToString(); string matKhau = Request["txt_Pass"].ToString(); if (service.checkLogin(taiKhoan, matKhau)) { Session["RecordID"] = taiKhoan; Response.Redirect("Default.aspx"); } else { divNotification.Visible = true; divNotification.InnerHtml = "Đăng nhập thất bại"; return; } } catch { divNotification.Visible = true; divNotification.InnerHtml = "Đăng nhập thất bại"; return; } } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == true) { if (Request["btnChangePass"] != null) { try { if (Session["RecordID"] != null) // nếu đăng nhập thì hiển thị thông tin sinh viên { StudentInfo.StudentInfoWS service = new StudentInfo.StudentInfoWS(); string taiKhoan = (string)Session["RecordID"]; string matKhauCu = Request["txt_OldPass"].ToString(); string matKhauMoi = Request["txt_NewPass"].ToString(); string xacNhanMatKhauMoi = Request["txt_ConfirmNewPass"].ToString(); if (matKhauMoi.Equals(xacNhanMatKhauMoi)) { if (service.checkLogin(taiKhoan, matKhauCu)) { if (service.changePassword(taiKhoan, matKhauMoi)) { divNotification.Visible = true; divNotification.InnerHtml = "Đổi mật khẩu thành công."; Session["RecordID"] = null; return; } else { divNotification.Visible = true; divNotification.InnerHtml = "Đổi mật khẩu thất bại."; return; } } else { divNotification.Visible = true; divNotification.InnerHtml = "Mật khẩu sai."; return; } } else { divNotification.Visible = true; divNotification.InnerHtml = "Mật khẩu không khớp."; return; } } } catch { divNotification.Visible = true; divNotification.InnerHtml = "Đăng nhập thất bại"; return; } } } }