private void SetUpPageForOrder(int orderId) { var order = DataHelper.GetOrderByOrderId((App.Current as App).ConnectionString, orderId); if (order is Order) { currentOrder = order; SetUpCustomer(order); OrderDetails = new OrderDetailsList(); OrderDetailsListView.ItemsSource = OrderDetails; foreach (OrderDetail detail in order.OrderDetails) { OrderDetails.Add(detail); } footerTextBlock.Text = "Order total: " + OrderTotal; ApplicationView.GetForCurrentView().Title = "View Order " + orderId.ToString(); OrderPageHeading.Text = "View Order " + orderId.ToString(); Instructions.Text = "Order date: " + order.OrderDate.ToLongDateString(); // Disable buttons that are only use for new orders Pay.Visibility = Visibility.Collapsed; Save.Visibility = Visibility.Collapsed; Reprint.Visibility = ((App.Current as App).UsePrinter? Visibility.Visible: Visibility.Collapsed); Toggle_Click(this, null); // switch to compact overlay size } }
public Order(string customerId, int employeeId) { OrderDetails = new OrderDetailsList(); // Set up default customer and employee IDs for demo CustomerID = customerId; EmployeeID = employeeId; OrderDate = DateTime.Today; }
public Order() { OrderDetails = new OrderDetailsList(); // Set up default customer and employee IDs for demo CustomerID = "ALFKI"; EmployeeID = 1; OrderDate = DateTime.Today; }
protected override void OnNavigatedTo(NavigationEventArgs e) { OrderDetails = new OrderDetailsList(); OrderDetailsListView.ItemsSource = OrderDetails; footerTextBlock.Text = "Order total: " + OrderTotal; // This window can be launched multiple times so showing the ID here for demo var id = ApplicationView.GetForCurrentView().Id; ApplicationView.GetForCurrentView().Title = "New Order " + id.ToString(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is int) { // Parameter is passed when double-clicking on an order in Orders grid orderId = (int)e.Parameter; SetUpPageForOrder(orderId); } else { Customers = DataHelper.GetCustomers((App.Current as App).ConnectionString); OrderDetails = new OrderDetailsList(); OrderDetailsListView.ItemsSource = OrderDetails; footerTextBlock.Text = "Order total: " + OrderTotal; // This window can be launched multiple times ApplicationView.GetForCurrentView().Title = "New Purchase Order"; Toggle_Click(this, null); // switch to compact overlay size } }
public Order() { OrderDetails = new OrderDetailsList(); }