private void btnNewRental_Click(object sender, RoutedEventArgs e)
        {
            if (lstResidences.SelectedIndex == -1)
            {
                return;
            }

            if (!((Residence)lstResidences.SelectedItem).IsRentable)
            {
                MessageBox.Show("Dit verblijf kan momenteel niet verhuurd worden", "Niet toegelaten", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            WinRental winRental = new WinRental();

            winRental.status            = "new";
            winRental.selectedResidence = (Residence)lstResidences.SelectedItem;
            winRental.AllRentals        = allRentals;
            winRental.ShowDialog();


            dgrRentals.Items.Clear();
            allRentals.Add(winRental.selectedRental);
            lstResidences_SelectionChanged(null, null);
        }
        private void BtnRentalEdit_Click(object sender, RoutedEventArgs e)
        {
            Button deleteButton = (Button)sender;
            Rental rental       = (Rental)deleteButton.DataContext;

            WinRental rentalWindow = new WinRental(rental, rentals, tenants);

            rentalWindow.ShowDialog();
            UpdateRentals();
        }
        private void btnRentalEdit_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            Rental rental = (Rental)button.DataContext;

            WinRental winRental = new WinRental();

            winRental.status            = "edit";
            winRental.selectedResidence = rental.HollidayResidence;
            winRental.selectedRental    = rental;
            winRental.ShowDialog();

            lstResidences_SelectionChanged(null, null);
        }
Beispiel #4
0
        private void btnNewRental_Click(object sender, RoutedEventArgs e)
        {
            if (lstResidences.SelectedItem != null)
            {
                WinRental winRental = new WinRental();
                winRental.selectedResidence = (Residence)lstResidences.SelectedItem;
                winRental.reasonForEntry    = WinRental.ReasonForEntry.newRental;
                winRental.ShowDialog();

                if (winRental.refreshRequired)
                {
                    lstResidences_SelectionChanged(null, null);
                }
            }
        }
Beispiel #5
0
        private void btnRentalEdit_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            Rental rental = (Rental)button.DataContext;

            WinRental winRental = new WinRental();

            winRental.selectedRental = rental;
            winRental.reasonForEntry = WinRental.ReasonForEntry.editRental;
            winRental.ShowDialog();

            if (winRental.refreshRequired)
            {
                lstResidences_SelectionChanged(null, null);
            }
        }
        private void BtnNewRental_Click(object sender, RoutedEventArgs e)
        {
            if (lstResidences.SelectedItem != null)
            {
                Residence residence = (Residence)lstResidences.SelectedItem;

                if (!residence.IsRentable)
                {
                    MessageBox.Show($"Verblijf {residence} momenteel niet verhuurbaar...");
                    return;
                }

                WinRental rentalWindow = new WinRental(residence, rentals, tenants);
                rentalWindow.ShowDialog();
                if (rentalWindow.Rental != null)
                {
                    rentals.Add(rentalWindow.Rental);
                }
                UpdateRentals();
            }
        }