private void btnAddOrder_Click(object sender, RoutedEventArgs e) { object selectedObject = lbSelectCustomerList.SelectedItem; if (selectedObject == null) { MessageBox.Show(this, "Geen klant geselecteerd!", "Onvoldoende gegevens", MessageBoxButton.OK, MessageBoxImage.Error); return; } Customer customer = (Customer)selectedObject; DateTime dateTimeOrdered = DateTime.Now; DateTime dateTimePickup = dpPickupDate.SelectedDate.GetValueOrDefault(DateTime.Now); dateTimePickup = dateTimePickup.AddHours(timeHours); dateTimePickup = dateTimePickup.AddMinutes(timeMinutes); Employee employee = new Employee("iedereen", 1); string description = tbDescription.Text; Order order = new Order(customer, dateTimeOrdered, dateTimePickup, employee, description); if (access.AddOrder(order)) { MessageBox.Show(this, "Order succesvol toegevoegd!", "Succes", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(this, "Order kon niet toegevoegd worden!", "Fout", MessageBoxButton.OK, MessageBoxImage.Error); } }