Пример #1
0
        /// <summary>
        /// Event handler for if user wants to return to their order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ReturnToOrderClicked(object sender, RoutedEventArgs e)
        {
            MainMenuSelection main           = new MainMenuSelection();
            OrderComponent    orderComponent = this.FindAncestor <OrderComponent>(); // Find the Order Component that is a parent of the current order summary

            orderComponent.Swap(main);
        }
Пример #2
0
        void ClickDone(object sender, RoutedEventArgs e)
        {
            MainMenuSelection custom         = new MainMenuSelection();
            OrderComponent    orderComponent = this.FindAncestor <OrderComponent>();

            orderComponent.Swap(custom);
        }
Пример #3
0
        /// <summary>
        /// Event handler for when the user wants to return to the main menu
        /// Should take them back to the main menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mainMenuButton_Click(object sender, RoutedEventArgs e)
        {
            MainMenuSelection main           = new MainMenuSelection();
            OrderComponent    orderComponent = this.FindAncestor <OrderComponent>();

            orderComponent.Swap(main);
        }
Пример #4
0
        /// <summary>
        /// Event handler for if the user cancels the order
        /// Should clear order summary and retain the same order number
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnCancelClick(object sender, RoutedEventArgs e)
        {
            Order             newOrder       = new Order();
            MainMenuSelection main           = new MainMenuSelection();
            OrderComponent    orderComponent = this.FindAncestor <OrderComponent>(); // Find the Order Component that is a parent of the current order summary

            orderComponent.DataContext = newOrder;                                   // Set the data context of the order component to be the new order
            orderComponent.Swap(main);
        }
Пример #5
0
 /// <summary>
 /// Event handler for if the users wants to return to their order and is not ready to pay yet
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnReturnSelect(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order order)
     {
         MainMenuSelection main           = new MainMenuSelection();
         OrderComponent    orderComponent = this.FindAncestor <OrderComponent>();
         orderComponent.Swap(main);
     }
 }
Пример #6
0
        /// <summary>
        /// Event handler for if the user wants to finalize the sale
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void FinalizeSaleClicked(object sender, RoutedEventArgs e)
        {
            cashDrawer.PrintReceipt(true, thisOrder);
            Order             newOrder       = new Order();
            MainMenuSelection main           = new MainMenuSelection();
            OrderComponent    orderComponent = this.FindAncestor <OrderComponent>(); // Find the Order Component that is a parent of the current order summary

            orderComponent.DataContext = newOrder;                                   // Set the data context of the order component to be the new order
            orderComponent.Swap(main);
        }
Пример #7
0
 /// <summary>
 /// Event handler for if user selects credit card payment
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnCreditSelect(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order order)
     {
         var result = CardReader.RunCard(order.Total);
         if (result is CardTransactionResult.Approved)
         {
             Order             newOrder       = new Order();
             UpdateCashDrawer  cashDrawer     = new UpdateCashDrawer(order.Total);
             MainMenuSelection main           = new MainMenuSelection();
             OrderComponent    orderComponent = this.FindAncestor <OrderComponent>(); // Find the Order Component that is a parent of the current order summary
             orderComponent.DataContext = newOrder;                                   // Set the data context of the order component to be the new order
             orderComponent.Swap(main);
             cashDrawer.PrintReceipt(false, order);                                   // Print receipt for false (paying with card, not cash), and this order
         }
     }
 }