public List <PHIEUDATBAN> LoadOrderListUC() { List <PHIEUDATBAN> orderList = new List <PHIEUDATBAN>(); string query = "SELECT MaPDB, MaB, PDB.MaKH, SDT_KH, NgayDat, GioDat FROM PHIEUDATBAN AS PDB, KHACHHANG AS KH WHERE TinhTrang='false' AND PDB.MAKH=KH.MAKH"; DataTable data = provider.ExecuteQuery(query); foreach (DataRow item in data.Rows) { PHIEUDATBAN pdb = new PHIEUDATBAN(item); orderList.Add(pdb); } return(orderList); }
public List <PHIEUDATBAN> TimPhieuDatBan(string noidung) { List <PHIEUDATBAN> orderList = new List <PHIEUDATBAN>(); string query = "SELECT DISTINCT MaPDB, MaB, PDB.MaKH, SDT_KH, NgayDat, GioDat FROM PHIEUDATBAN AS PDB, KHACHHANG AS KH" + " WHERE TinhTrang = 'false' AND MaPDB LIKE '%" + noidung + "%' AND PDB.MaKH = KH.MaKH OR MaB LIKE '%" + noidung + "%' AND PDB.MaKH = KH.MaKH OR PDB.MaKH LIKE '%" + noidung + "%' AND PDB.MaKH = KH.MaKH" + " OR TinhTrang = 'false' AND NgayDat LIKE '%" + noidung.Replace('/', '-') + "%' AND PDB.MaKH = KH.MaKH OR TinhTrang = 'false' AND GioDat LIKE '%" + noidung + "%'" + " AND PDB.MaKH = KH.MaKH OR TinhTrang = 'false' AND SDT_KH LIKE '%" + noidung + "%' AND PDB.MaKH = KH.MaKH"; DataTable data = provider.ExecuteQuery(query); foreach (DataRow item in data.Rows) { PHIEUDATBAN pdb = new PHIEUDATBAN(item); orderList.Add(pdb); } return(orderList); }