private void initializeReservationComboBox() { reservationComboBoxInfos = new List <ReservationComboBoxInfo>(); foreach (var reservation in ReservationCalendar.reservationCalendar) { if (reservation.borrowerId == CurrentlyLoggedUser.currentlyLoggedUserId) { ReservationComboBoxInfo temp = new ReservationComboBoxInfo(); temp.carId = reservation.carId; temp.carName = CarList.getSpecificCarName(reservation.carId); temp.rentedFrom = reservation.rentedFrom; temp.rentedTo = reservation.rentedTo; reservationComboBoxInfos.Add(temp); } } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { ReservationComboBoxInfo temp = (ReservationComboBoxInfo)reservationsComboBox.SelectedItem; if (temp == null) { System.Windows.MessageBox.Show("Please select reservation."); return; } Reservation resToDelete = new Reservation(CurrentlyLoggedUser.currentlyLoggedUserId, temp.carId, temp.rentedFrom, temp.rentedTo); ReservationCalendar.deleteReservationFromList(resToDelete); System.Windows.MessageBox.Show("Reservation deleted!"); User_ControlPanel user_ControlPanel = new User_ControlPanel(Left, Top); user_ControlPanel.Show(); Close(); }