//----------EDITING BOOKING----------------------

        //actions to take when editing booking
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            //before editing we check if the selected dates are correct
            if (!bookingInUse.checkDates(datePickArrival.SelectedDate.Value, datePickDeparture.SelectedDate.Value))
            {
                //if not, then changing the dates to current
                datePickArrival.SelectedDate   = DateTime.Today.Date;
                datePickDeparture.SelectedDate = DateTime.Today.Date.AddDays(1);
            }
            //if they do we proceed with saving changes
            else
            {
                bookingInUse.Arrival     = datePickArrival.SelectedDate.Value;
                bookingInUse.Departure   = datePickDeparture.SelectedDate.Value;
                bookingInUse.DaysBooking = (bookingInUse.Departure - bookingInUse.Arrival).TotalDays;

                //trying to store content of extras if this was updated
                try
                {
                    bookingInUse.Breakfast.DietaryRequirements   = txtBreakfastDietaryRequirements.Text;
                    bookingInUse.EveningMeal.DietaryRequirements = txtEveningDietaryRequirements.Text;
                    bookingInUse.CarHire.DriverName = txtDriverName.Text;
                    bookingInUse.CarHire.StartDate  = dateHireStart.SelectedDate.Value;
                    bookingInUse.CarHire.EndDate    = dateHireEnd.SelectedDate.Value;
                }
                catch (Exception)
                {
                }
                dbAccess.saveFiles();
                //refreshing main window's result after this operation
                mainWindow = (MainWindow)this.Owner;
                mainWindow.btnBookSearch_Click(sender, e);
                this.Close();
            }
        }
        //-------------EDITING CUSTOMER---------------------------
        //upon update we change the content of an object and send it to file write to update the list and save the file
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            //checking correct format of teh name and only proceeding if it's right
            bool correctName = customerInUse.nameFormat(txtCustName.Text);

            if (correctName)
            {
                customerInUse.Address = txtAddress.Text;
                dbAccess.saveFiles();

                //refreshing customer search results to contain valid data
                mainWindow = (MainWindow)this.Owner;
                mainWindow.btnCustSearch_Click(sender, e);
                this.Close();
            }
            else
            {
                MessageBox.Show("Please enter proper name format.", "Wrong Characters", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }
        }