Ejemplo n.º 1
0
        //Xử lý đăng nhập
        private void XuLyDangNhap()
        {
            ConnectDatabase DAO = new ConnectDatabase();

            if (txtPass.Text != "" && txtPass.Text != "")
            {
                string    userName = txtUserName.Text;
                string    pass     = txtPass.Text;
                DataTable dtQuanLy = DAO.getTable("SELECT * FROM dbo.QUANLY WHERE TAIKHOAN = '" + userName + "' and MATKHAU = '" + pass + "'");
                if (dtQuanLy.Rows.Count > 0)
                {
                    Session["TAIKHOAN"] = userName;
                    if (dtQuanLy.Rows[0]["PHANQUYEN"].ToString() == "1")
                    {
                        Response.Redirect("/Admin.aspx?modul=GioiThieu");
                    }
                    else
                    {
                        // Session["TAIKHOAN"] = userName;
                        Response.Redirect("TrangNhanVien.aspx");
                    }
                }
                else
                {
                    lbThongbao.Text = "Sai tài khoản hoặc mật khẩu";
                }
            }
            else
            {
                lbThongbao.Text = "Vui lòng điền đầy đủ thông tin";
            }
        }