Esempio n. 1
0
        private void ButtonRemoveBooking_OnClick(object sender, RoutedEventArgs e)
        {
            var           booking    = (AnimalBooking)ListBoxCurrentBookings.SelectedItem;
            DataAccessZoo dataAccess = new DataAccessZoo();

            try
            {
                dataAccess.RemoveBooking(booking.BookingId);
                MessageBox.Show("Bokningen borttagen!");
                UpdateCurrentBookingsListBox();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 2
0
        private void ButtonRemoveBookingAndCloseWindow_OnClick(object sender, RoutedEventArgs e)
        {
            if (ListBoxBookings.SelectedItem != null)
            {
                DataAccessZoo dataAccess = new DataAccessZoo();
                var           booking    = (AnimalBooking)ListBoxBookings.SelectedItem;

                try
                {
                    dataAccess.RemoveBooking(booking.BookingId);
                    MessageBox.Show("Mötet avslutat!");
                    this.Close();
                }
                catch (DbObjectNotFoundException exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }
        }