protected void btnDangKy_Click(object sender, EventArgs e) { if (ddlGioiTinh.Text.Equals("Nam/Nữ") || ddlNgay.Text.Equals("Ngày") || !ddlThang.Text.Equals("Tháng") || txtNam.Text.Equals("") || txtNam.Text.Length < 4) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Error!", "alert('" + "Register Failed" + "');", true); XoaTrangThongTin(); } else { ThanhVien tv = new ThanhVien(); tv.UserName = txtTenTK.Text.Trim(); tv.Password = txtMatKhau.Text.Trim(); tv.TenTV = txtHoTen.Text.Trim(); tv.GioiTinh = ddlGioiTinh.Text; tv.NgaySinh = DateTime.Parse(ddlNgay.Text + "/" + ddlThang.Text + "/" + txtNam.Text); tv.Email = txtEmail.Text.Trim(); ThanhVienBLL thanhVienBLL = new ThanhVienBLL(); bool kq = thanhVienBLL.DangKyThanhVien(tv); if (kq && chkboxDongYCacQuyDinhWeb.Checked) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Successed!", "alert('" + "Register Successed!" + "');", true); //XoaTrangThongTin(); Response.Redirect("Login.aspx"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Error!", "alert('" + "Register Failed" + "');", true); XoaTrangThongTin(); } } }
protected void btnGuiMatKhauMoi_Click(object sender, EventArgs e) { ThanhVien thanhVien = new ThanhVien(); thanhVien.Email = txtEmailQuenMatKhau.Text; ThanhVienBLL thanhVienBLL = new ThanhVienBLL(); bool kq = thanhVienBLL.QuenMatKhau(thanhVien); if (kq) { Session["KiemTraEmail"] = true; Response.Redirect("/Login.aspx"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "alert('" + "Email này ko tồn tại!" + "');", true); txtEmailQuenMatKhau.Text = ""; } }
protected void btnDangNhap_Click(object sender, EventArgs e) { ThanhVien tv = new ThanhVien(); tv.UserName = txtTenDN.Text; tv.Password = txtMatKhau.Text; ThanhVienBLL thanhVienBLL = new ThanhVienBLL(); tv = thanhVienBLL.DangNhap(tv); if (tv.MaTV != 0) { Session["IDThanhVien"] = tv.MaTV; Session["KiemTraAdmin"] = tv.ChkAdmin; Session["MatKhau"] = txtMatKhau.Text; Session["TenDangNhap"] = txtTenDN.Text; Session["KiemTra"] = true; Response.Redirect("TrangChuPhim.aspx"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "alert('" + "Username/Password chưa đúng!" + "');", true); XoaTrangDuLieu(); } }