public void RefreshDataBinding() { gridControl.DataSource = danhSachPhong = DAL.PhongDAL.LayTatCaPhong_TinhTrangPhong_LoaiPhong_KhaDung(); //Tính giờ listPhongDangThue = BUS.ThuePhongBUS.LayThongTinCacPhongDangDuocThue(); tileAll.Elements[1].Text = danhSachPhong.Rows.Count.ToString(); tileAvailable.Elements[1].Text = PhongBUS.DemSoLuongPhong(0).ToString(); tileRented.Elements[1].Text = PhongBUS.DemSoLuongPhong(1).ToString(); tileSapDat.Elements[1].Text = (PhongBUS.DemSoLuongPhong(4) + PhongBUS.DemSoLuongPhong(6)).ToString(); tileDonDep.Elements[1].Text = (PhongBUS.DemSoLuongPhong(5) + PhongBUS.DemSoLuongPhong(6)).ToString(); dtLoaiPhong = BUS.LoaiPhongBUS.LayTatCaLoaiPhong_DataTable_GroupByName(); if (dtLoaiPhong.Rows.Count == grpLoaiPhong.Items.Count) { bool flagSame = true; for (int i = 0; i < grpLoaiPhong.Items.Count; i++) { if (dtLoaiPhong.Rows[i]["TenLoaiPhong"].ToString() != grpLoaiPhong.Items[i].Name) { flagSame = false; break; } } if (!flagSame) { grpLoaiPhong.Items.Clear(); foreach (DataRow row in BUS.LoaiPhongBUS.LayTatCaLoaiPhong_DataTable_GroupByName().Rows) { grpLoaiPhong.Items.Add(NewTileItem(row["TenLoaiPhong"].ToString())); } } } else { grpLoaiPhong.Items.Clear(); foreach (DataRow row in BUS.LoaiPhongBUS.LayTatCaLoaiPhong_DataTable_GroupByName().Rows) { grpLoaiPhong.Items.Add(NewTileItem(row["TenLoaiPhong"].ToString())); } } List <String> listLoaiPhongChecked = new List <string>(); foreach (TileItem i in grpLoaiPhong.Items) { if (i.Checked) { listLoaiPhongChecked.Add(i.Name); } } if (listLoaiPhongChecked.Count != 0) { strFilterLoaiPhong = BUS.TinhTrangPhongBUS.GetFilterString_LoaiPhong(listLoaiPhongChecked); } else { strFilterLoaiPhong = "[TenLoaiPhong] = null"; } //strFilterLoaiPhong = BUS.TinhTrangPhongBUS.GetFilterString_LoaiPhong(listLoaiPhongChecked); DisplayBottomButtonWithSelectedTile(); listPhongSapDuocDat = new Dictionary <int, PhongDTO>(); listDanhSachPhongDangDat = PhongBUS.LayCacPhongDangDuocDat(); listThoiGianDat = new Dictionary <int, DateTime>(); foreach (PhongDTO phong in listDanhSachPhongDangDat.Values) { DatPhongDTO datPhong = DatPhongBUS.LayThongTinThuePhongCuaPhongDangDat(phong.MaPhong, DateTime.Now); if (datPhong != null) { listThoiGianDat.Add(phong.MaPhong, datPhong.ThoiGianDatPhong); } } }