public void ReLoadRoomData() { this.dgvListRoom.DataSource = RoomBUS.GetRoomList(); if (dgvListRoom.Rows.Count > 0) { this.btnDelRoom.Enabled = this.btnEditRoom.Enabled = true; } else { this.btnDelRoom.Enabled = this.btnEditRoom.Enabled = false; this.tbListRoomID.Text = this.tbListRoomPrice.Text = this.tbListRoomStatus.Text = this.tbListRoomType.Text = this.rtbListRoomNote.Text = null; } }
// Tab 03: Room Search public void ReLoadFindRoom() { DataTable dt = RoomBUS.GetRoomList(); Dictionary <string, string> id = new Dictionary <string, string>() { { "Tất cả phòng", null } }; foreach (DataRow dr in dt.Rows) { var key = dr["MaPhong"].ToString(); var value = key; id.Add(key, value); } this.cbFindRoomID.DataSource = new BindingSource(id, null); this.cbFindRoomID.DisplayMember = "Key"; this.cbFindRoomID.ValueMember = "Value"; dt = RoomTypeBUS.GetRoomTypeList(); Dictionary <string, string> type = new Dictionary <string, string>() { { "Tất cả loại phòng", null } }; foreach (DataRow dr in dt.Rows) { var key = dr["MaLoaiPhong"].ToString(); var value = key; type.Add(key, value); } this.cbFindRoomType.DataSource = new BindingSource(type, null); this.cbFindRoomType.DisplayMember = "Key"; this.cbFindRoomType.ValueMember = "Value"; dt = RoomTypeBUS.GetRoomPriceList(); Dictionary <string, Int64> price = new Dictionary <string, Int64>() { { "Tất cả đơn giá", -1 } }; foreach (DataRow dr in dt.Rows) { var key = Convert.ToInt64(dr["DonGia"]).ToString("N0") + " VND"; var value = Int64.Parse(key.Split()[0].Replace(",", "")); price.Add(key, value); } this.cbFindRoomPrice.DataSource = new BindingSource(price, null); this.cbFindRoomPrice.DisplayMember = "Key"; this.cbFindRoomPrice.ValueMember = "Value"; dt = RoomStatusBUS.GetRoomStatusList(); Dictionary <string, string> status = new Dictionary <string, string>() { { "Tất cả tình trạng", null } }; foreach (DataRow dr in dt.Rows) { var key = dr["TenTinhTrang"].ToString(); var value = dr["MaTinhTrang"].ToString(); status.Add(key, value); } this.cbFindRoomStatus.DataSource = new BindingSource(status, null); this.cbFindRoomStatus.DisplayMember = "Key"; this.cbFindRoomStatus.ValueMember = "Value"; }