private void NextButton_Click(object sender, RoutedEventArgs e) { try { order.BranchID = getBranchSelected(); order.Time = DateTime.Now; KashrutComboBox.GetBindingExpression(ComboBox.TextProperty).UpdateSource(); PaymentComboBox.GetBindingExpression(ComboBox.TextProperty).UpdateSource(); this.creditCardUserControl.NameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.creditCardUserControl.NumberTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.creditCardUserControl.CVVTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.creditCardUserControl.MonthTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.creditCardUserControl.YearTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.NoteTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource(); int orderID = bl.nextOrderID(); bl.addOrder(order); AddDishesToOrderPage p = new AddDishesToOrderPage(); p.od.OrderID = orderID; this.NavigationService.Navigate(p); } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { if (bl.getOrder(order.OrderID) == null) { throw new Exception("Order doesn't exist!"); } //if (bl.getOrder(order.OrderID).Time.Date != DateTime.Now.Date) // throw new Exception("You can change only order from today!"); MainWindow w = this.Owner as MainWindow; var x = w.MainFrame.Content as MainPage; AddDishesToOrderPage p = new AddDishesToOrderPage(); p.od.OrderID = order.OrderID; p.OrderedDishDataGrid.ItemsSource = bl.getOrderedDishes(order.OrderID); x.NavigationService.Navigate(p); GetOrderIDWindow w2 = Window.GetWindow(this) as GetOrderIDWindow; w2.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }