private void Button_Click(object sender, RoutedEventArgs e) { try { var w1 = Window.GetWindow(this) as MainWindow; var w2 = new GetCustomerIDWindow { Owner = w1 }; var store = DS.DataSource.stores.FirstOrDefault( x => x.StoreName == storesComboBox.SelectedItem as string); if (store == null) { this.storesComboBox.BorderBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#f44336")); throw new Exception("Store doesn't exist!"); } App.currentOrder.StoreID = store.StoreID; if (delivCheckBox.IsChecked != null) { App.currentOrder.OrderDeliv = delivCheckBox.IsChecked.Value; } App.currentOrder.OrderID = FactoryDatabase.getDatabase().getNewOrderID(); w2.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Cancel_Click(object sender, RoutedEventArgs e) { GetCustomerIDWindow w = Window.GetWindow(this) as GetCustomerIDWindow; w.Close(); }