Esempio n. 1
0
        /// <summary>
        /// Returns to menu selection screen (exiting payment)
        /// Bound to a button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void returnToOrder(object sender, RoutedEventArgs e)
        {
            OrderComponent w = Window.GetWindow(this).Content as OrderComponent;

            w.changePrimaryMenu("Selection");
            w.OrderListView.SelectedItem = null;
        }
Esempio n. 2
0
        /// <summary>
        /// Finalizes the sale and prints a receipt.txt
        /// Bound to a button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void finalizeSale(object sender, RoutedEventArgs e)
        {
            if ((DataContext as CashPaymentIntermediary).AmountDue > 0.00)
            {
                MessageBox.Show("The customer has not provided enough cash.");
                return;
            }
            OrderComponent w = Window.GetWindow(this).Content as OrderComponent;
            Order          o = (w.DataContext as Order);

            printLine($"Order Number {o.Number + 1}");
            printLine($"{DateTime.Now}");
            printLine($"Order Details:");
            foreach (IOrderItem i in o)
            {
                printLine($"{i.Name}     {i.Price:C2}");
                foreach (string s in i.SpecialInstructions)
                {
                    printLine($"     -{s}");
                }
            }
            printLine($"Subtotal: {o.Subtotal:C2}");
            printLine($"Tax: {o.Tax:C2}");
            printLine($"total: {o.Total:C2}");
            printLine($"Payment Method: Cash");
            printLine($"Change Owed: {(DataContext as CashPaymentIntermediary).ReceiptChangeOwed:C2}");
            RecieptPrinter.CutTape();

            w.cancelOrder(sender, e);
            w.changePrimaryMenu("Selection");
            w.OrderListView.SelectedItem = null;
        }
        /// <summary>
        /// Finds correct customization menu from button pressed and tells the upper level component to dislpay it.
        /// </summary>
        /// <param name="sender">button click args</param>
        /// <param name="e">button click args</param>
        void enterCustomizationMenu(object sender, RoutedEventArgs e)
        {
            Button         b = sender as Button;
            OrderComponent w = Window.GetWindow(this).Content as OrderComponent;

            w.changePrimaryMenu((string)b.Content);
        }
Esempio n. 4
0
        /// <summary>
        /// Remove from order and return to main menu
        /// </summary>
        /// <param name="sender">click event args</param>
        /// <param name="e">click event args</param>using System;using System;using System;
        public void cancelCustomizing(object sender, RoutedEventArgs e)
        {
            Button         b = sender as Button;
            OrderComponent w = Window.GetWindow(this).Content as OrderComponent;

            w.changePrimaryMenu("Selection");
            w.OrderListView.SelectedItem = null;
        }
Esempio n. 5
0
        /// <summary>
        /// A buttonclick event for completion of a customization.
        /// When this fires, the main window must change and the item must be added to the order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void finishCustomizing(object sender, RoutedEventArgs e)
        {
            //add to order component text
            Button         b = sender as Button;
            OrderComponent w = Window.GetWindow(this).Content as OrderComponent;
            Order          o = w.DataContext as Order;

            if (!o.Contains(DataContext as IOrderItem))
            {
                o.Add(this.DataContext as IOrderItem);
            }
            w.changePrimaryMenu("Selection");
            w.OrderListView.SelectedItem = null;
        }