예제 #1
0
 protected void KTTKDaTonTai(object source, ServerValidateEventArgs args)
 {
     if (TaikhoanBUS.KTTKTonTai(txtTenTK.Text) == true)
     {
         args.IsValid = false;
     }
     else
     {
         args.IsValid = true;
     }
 }
예제 #2
0
        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            string tenTK = txtTenTK.Text;
            string mk    = txtMatKhau.Text;

            if (TaikhoanBUS.KTTKTonTai(tenTK))
            {
                if (TaikhoanBUS.KTMatKhau(tenTK, mk))
                {
                    if (TaikhoanBUS.KTTTTaiKhoan(tenTK))
                    {
                        HttpCookie cookie = new HttpCookie("TenTK");
                        cookie.Value = tenTK;
                        Response.Cookies.Add(cookie);

                        if (TaikhoanBUS.LayThongTinTaiKhoan(tenTK).LaAdmin == true)
                        {
                            Response.Redirect("admin/index.aspx");
                        }
                        else
                        {
                            Response.Redirect("index.aspx");
                        }
                    }
                    else
                    {
                        thongbao.Text = "Tài khoản đang bị khoá, vui lòng liên hệ Admin.";
                    }
                }
                else
                {
                    thongbao.Text = "Sai mật khẩu, vui lòng thử lại.";
                }
            }
            else
            {
                thongbao.Text = "Tài khoản không tồn tại, vui lòng thử lại.";
            }
        }