public DataTable getallinfo() {
     string query = string.Format("SELECT * FROM ban");
     try {
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.executeSelectQuery(query);
 }
 public Boolean setinfo(string _tenban, string _tinhtrang, string _khuvuc) {
     string query = string.Format("INSERT INTO ban (tenban, tinhtrang, khuvuc) VALUES ('"+_tenban+"', "+_tinhtrang+", "+_khuvuc+")");
     try{
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.executeQuery(query);
 }
 public Boolean updatetinhtranban(string _tinhtrang, string _maban) {
     string query = string.Format("UPDATE ban SET tinhtrang=" + _tinhtrang + " WHERE maban="+ _maban);
     try
     {
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.executeQuery(query);
 }
 public SqlDataReader getinfoban(string _id) {
     string query = string.Format("SELECT * FROM ban WHERE maban='"+_id+"'");
     try
     {
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.MyReader(query);
 }
 public DataTable getfilterinfo(String _Condition)
 {
     string query = string.Format("SELECT * FROM ban WHERE "+_Condition);
     try
     {
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.executeSelectQuery(query);
 }
        public Boolean setinfo(string _tenban, string _tinhtrang, string _khuvuc)
        {
            string query = string.Format("INSERT INTO ban (tenban, tinhtrang, khuvuc) VALUES ('" + _tenban + "', " + _tinhtrang + ", " + _khuvuc + ")");

            try{
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeQuery(query));
        }
        public DataTable getallinfo()
        {
            string query = string.Format("SELECT * FROM ban");

            try {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeSelectQuery(query));
        }
 public DataTable getallthucdon()
 {
     string query = string.Format("SELECT thucdon.mamon, thucdon.tenmon, thucdon.gia, loaithucdon.tenloai, thucdon.donvi, thucdon.tinhtrang, thucdon.mota FROM thucdon INNER JOIN loaithucdon ON thucdon.maloai = loaithucdon.maloai");
     try
     {
         con = new DbConnection();
         con.openConnection();
     }
     catch (SqlException e) { }
     return con.executeSelectQuery(query);
 }
        public Boolean deletecthoadon(string _id)
        {
            string query = string.Format("delete from chitiethoadon where mahoadon = " + _id);

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeQuery(query));
        }
        public Boolean inserthoadon(string _mahoadon, string _maban, string _tinhtrang, string _ngaylap)
        {
            string query = string.Format("INSERT INTO hoadon (mahoadon, maban, tinhtrang, ngaylap) VALUES ('" + _mahoadon + "', " + _maban + ", " + _tinhtrang + ", '" + _ngaylap + "')");

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeQuery(query));
        }
        public SqlDataReader getmahoadon(string maban, string tinhtrang)
        {
            string query = string.Format("SELECT * FROM hoadon WHERE maban=" + maban + " and tinhtrang=" + tinhtrang);

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.MyReader(query));
        }
        public DataTable getallinfo(string a, string b)
        {
            string query = string.Format("select hoadon.mahoadon,thucdon.tenmon,chitiethoadon.soluong,chitiethoadon.thanhtien, hoadon.ngaylap FROM hoadon inner join chitiethoadon ON hoadon.mahoadon = chitiethoadon.mahoadon inner join thucdon ON chitiethoadon.mamon = thucdon.mamon WHERE hoadon.maban = " + a + " and hoadon.tinhtrang = " + b);

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeSelectQuery(query));
        }
        public DataTable getallthucdon()
        {
            string query = string.Format("SELECT thucdon.mamon, thucdon.tenmon, thucdon.gia, loaithucdon.tenloai, thucdon.donvi, thucdon.tinhtrang, thucdon.mota FROM thucdon INNER JOIN loaithucdon ON thucdon.maloai = loaithucdon.maloai");

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeSelectQuery(query));
        }
        public Boolean updatetinhtranban(string _tinhtrang, string _maban)
        {
            string query = string.Format("UPDATE ban SET tinhtrang=" + _tinhtrang + " WHERE maban=" + _maban);

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeQuery(query));
        }
        public SqlDataReader getinfoban(string _id)
        {
            string query = string.Format("SELECT * FROM ban WHERE maban='" + _id + "'");

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.MyReader(query));
        }
        public DataTable getfilterinfo(String _Condition)
        {
            string query = string.Format("SELECT * FROM ban WHERE " + _Condition);

            try
            {
                con = new DbConnection();
                con.openConnection();
            }
            catch (SqlException e) { }
            return(con.executeSelectQuery(query));
        }