private void backBtn_Click(object sender, RoutedEventArgs e) { OrderListWindow olw = new OrderListWindow(); olw.Show(); this.Close(); }
private void AddOrder_Click(object sender, RoutedEventArgs e) { ProxyOrder proxyOrder = new ProxyOrder(FirstnameTextBox.Text, LastnameTextBox.Text, PeselTextBox.Text); Order order = proxyOrder.Validate(chosenProducts); if (order != null) { foreach (IProduct product in chosenProducts) { data.decrementCountProduct(product.Id, product.Count); } data.addOrder(order, chosenProducts); order.OrderId = data.getLastInsertProductId(); Order o = data.getOrder(order.OrderId); Console.WriteLine(o.getTotalCost()); // Discount handlers if ((bool)regularCustomerCheckBox.IsChecked == true) { o = new RegularCustomerDecorator(o); } if ((bool)xmasSaleCheckBox.IsChecked == true) { o = new ChristmasSaleDecorator(o); } data.updateOrderTotalCost(order.OrderId, o.getTotalCost()); OrderListWindow olw = new OrderListWindow(); olw.Show(); this.Close(); } else { MessageBox.Show("Imie i nazwisko nie powinno być puste, PESEL musi składać się z 11 cyfr oraz lista produktów nie może być pusta", "Alert", MessageBoxButton.OK, MessageBoxImage.Information); } }