Example #1
0
        protected void btnmodallogin_Click(object sender, EventArgs e)
        {
            string   TaiKhoan = txttaikhoan.Text;
            string   MatKhau  = txtmatkhau.Text;
            string   alert    = "";
            TaiKhoan tk       = new TaiKhoan();

            if (TaiKhoan == "" && MatKhau == "")
            {
                alert = "Bạn chưa nhập tài khoản hoặc mật khẩu.";
            }
            else
            {
                if (tkc.checkTaiKhoan(TaiKhoan, MatKhau) == 3)
                {
                    alert = "Sai tài khoản, mật khẩu.";
                }
                if (tkc.checkTaiKhoan(TaiKhoan, MatKhau) == 0)
                {
                    tk            = tkc.getTaiKhoan(TaiKhoan);
                    Session["tk"] = tk;
                    Response.Redirect("HomePage.aspx");
                }
                if (tkc.checkTaiKhoan(TaiKhoan, MatKhau) == 1)
                {
                    tk            = tkc.getTaiKhoan(TaiKhoan);
                    Session["tk"] = tk;
                    //Page_Load(sender, e);
                    Response.Redirect("HomePage.aspx");
                }
                if (tkc.checkTaiKhoan(TaiKhoan, MatKhau) == 2)
                {
                    tk            = tkc.getTaiKhoan(TaiKhoan);
                    Session["tk"] = tk;
                    Response.Redirect("HomePage.aspx");
                }
            }
            Response.Write("<script>alert('" + alert + "')</script>");
        }