/// <summary>
        /// Invokes the update customer window.
        /// </summary>
        internal void UpdateCustomer()
        {
            try
            {
                // Make a copy of the current customer to avoid directly editing the customer in the data grid.
                // The customer will be modified in the cache and in the database
                // and the grid view will be updated from the cache or the database.
                Customer c = new Customer();
                c.Copy(this.SelectedCustomer);

                AddCustomerView addCustomerView = new AddCustomerView();
                AddCustomerViewModel addCustomerViewModel = new AddCustomerViewModel(c);
                addCustomerViewModel.SaveCompleted += (s, e) =>
                {
                    // Get latest data after save.
                    this.SelectedCustomer = null;
                    addCustomerView.Close();
                    this.GetData();
                };
                addCustomerViewModel.Cancelled += (s, e) =>
                {
                    this.SelectedCustomer = null;
                    addCustomerView.Close();
                };
                addCustomerView.DataContext = addCustomerViewModel;
                addCustomerView.ShowDialog();
                this.SelectedCustomer = null;
            }
            catch (Exception ex)
            {
                InfoDialogViewModel.ShowDialog(ex.Message, "Unhandled Exception");
                Log.LogException(ex, "MainViewModel.cs");
            }
        }
 /// <summary>
 /// Invokes the add new customer window .
 /// </summary>
 internal void AddCustomer()
 {
     try
     {
         AddCustomerView addCustomerView = new AddCustomerView();
         // Set the date of birth to today, so it's not set to default 01/01/0001
         Customer customer = new Customer() { DateOfBirth = DateTime.Now };
         AddCustomerViewModel addCustomerViewModel = new AddCustomerViewModel(customer);
         addCustomerViewModel.SaveCompleted += (s, e) =>
             {
                 // Get latest data after save.
                 this.SelectedCustomer = null;
                 addCustomerView.Close();
                 this.GetData();
             };
         addCustomerViewModel.Cancelled += (s, e) =>
             {
                 this.SelectedCustomer = null;
                 addCustomerView.Close();
             };
         addCustomerView.DataContext = addCustomerViewModel;
         addCustomerView.ShowDialog();
     }
     catch (Exception ex)
     {
         InfoDialogViewModel.ShowDialog(ex.Message, "Unhandled Exception");
         Log.LogException(ex, "MainViewModel.cs");
     }
 }