// Getting free rooms in data private void SearchButton_Click(object sender, EventArgs e) { // RoomLB.Items.Clear(); // jesli data jest inna niz na rezerwacji i jesli jest to opcja edytowania DateTime checkIn; DateTime CheckOut; checkIn = TimePickerStart.Value; CheckOut = TimePickerEnd.Value; ClearAll(); if (AddOrEdit == 1) { List <Rooms> freeRooms = ListManager.LoadSampleRooms(checkIn, CheckOut, 1); foreach (Rooms item in freeRooms) { RoomLB.Items.Add(item.RoomName.ToString()); } } else if (AddOrEdit == 2) { // czy jestes pewny ze chcesz wszystko wycofac List <Rooms> freeRooms = ListManager.LoadSampleRooms(checkIn, CheckOut, ReseravtionID); foreach (Rooms item in freeRooms) { RoomLB.Items.Add(item.RoomName.ToString()); } } }
void LoadRooms() { List <Rooms> freeRooms; ClearAll(); if (task == 0) { freeRooms = ListManager.LoadSampleRooms(timePickerStart.Value, timePickerEnd.Value, 1); } else { freeRooms = ListManager.LoadSampleRooms(timePickerStart.Value, timePickerEnd.Value, reservationId); } for (int i = 0; i < freeRooms.Count; i++) { roomsListbox.Items.Add(freeRooms[i].RoomName.ToString()); } }
// data loading public void RefreshData() { allReservations = ListManager.LoadSampleReservation(); table.Rows.Clear(); for (int i = 0; i < allReservations.Count; i++) { table.Rows.Add( allReservations[i].Id, allReservations[i].StartDate, allReservations[i].EndDate, allReservations[i].TotalPrice, allReservations[i].LastName, allReservations[i].WorkerId ); } DGView.DataSource = table; DGView.Columns[0].Visible = false; categoryCombobox.SelectedIndex = 0; }