void LoadReceipt()
        {
            WaffleMachine wm             = WaffleMachine.Get_Instance();
            float         wafflePrice    = wm.CalculateWaffleTotal();
            float         chocolatePrice = wm.CalculateChocolateTotal();
            float         total          = wm.CalculateTotal();

            if (wafflePrice > 0)
            {
                lblWafflesCount.Visibility = Visibility.Visible;
                lblWafflesPrice.Visibility = Visibility.Visible;

                lblWafflesCount.Content = "Waffles x" + wm.GetWaffleCount();
                lblWafflesPrice.Content = wafflePrice + " EGP";
            }
            if (chocolatePrice > 0)
            {
                lblChocolateCount.Visibility = Visibility.Visible;
                lblChocolatePrice.Visibility = Visibility.Visible;

                lblChocolateCount.Content = "Chocolate x" + wm.GetChocolateWaffleCount();
                lblChocolatePrice.Content = chocolatePrice + " EGP";
            }

            lblTotalPrice.Content     = total + " EGP";
            lblTotalPriceDesc.Content = total + " EGP";
        }
示例#2
0
        void ResetToWelcomeScreen()
        {
            WaffleMachine.Get_Instance().Reset();
            WelcomeScreen ws = new WelcomeScreen();

            ws.Show();
            Close();
        }
示例#3
0
        public AdminControlScreen()
        {
            InitializeComponent();

            WaffleMachine wm = WaffleMachine.Get_Instance();

            txtWafflePrice.Text    = String.Format("{0:0.00}", wm.WafflePrice);
            txtChocolatePrice.Text = String.Format("{0:0.00}", wm.ChocolatePrice);
        }
示例#4
0
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            WaffleMachine wm = WaffleMachine.Get_Instance();

            float newWafflePrice, newChocolatePrice;

            if (float.TryParse(txtWafflePrice.Text, out newWafflePrice) && float.TryParse(txtChocolatePrice.Text, out newChocolatePrice))
            {
                wm.WafflePrice    = newWafflePrice;
                wm.ChocolatePrice = newChocolatePrice;
                wm.SavePrices();

                ResetToWelcomeScreen();
            }
            else
            {
                lblError.Visibility = Visibility.Visible;
                txtWafflePrice.Clear();
                txtChocolatePrice.Clear();
            }
        }
        private async void RequestNewOrder(string referenceNum, float amount)
        {
            WaffleApiIntegrator integrator = new WaffleApiIntegrator();
            WaffleMachine       wm         = WaffleMachine.Get_Instance();

            WaffleApiIntegrator.NewOrderResponse response = await integrator.RequestWaffleOrder(wm.GetWaffleCount(), wm.GetChocolateWaffleCount(), referenceNum, amount);

            if (response.statusCode != System.Net.HttpStatusCode.OK || !response.accepted || response.orderId == -1)
            {
                ErrorScreen es = new ErrorScreen();
                es.ShowActivated = true;
                es.Show();
                Close();
            }
            else
            {
                WaitingScreen ws = new WaitingScreen(response.orderId);
                ws.ShowActivated = true;
                ws.Show();
                Close();
            }
        }
        private async void InitiateNewOrder()
        {
            await Task.Delay(10);             //This is to allow time for the UI to be loaded before starting. (Prevents white screen on showing window)

            float      totalToPay      = WaffleMachine.Get_Instance().CalculateTotal();
            Task <int> transactionTask = posHandler.DoTransaction(totalToPay, false);

            int transResult = await transactionTask;

            //testing
            lblDebug.Content += " " + transResult;
            //testing remove True to stop simulating PoS
            if (true || transResult == 0 && posHandler.response != null && posHandler.response.transStatus == PaxPOSECR.POSTransStatus.APPROVED)
            {
                RequestNewOrder(posHandler.referenceNumber.GetLastTransactionRNo(false), totalToPay);
            }
            else
            {
                ErrorScreen es = new ErrorScreen();
                es.ShowActivated = true;
                es.Show();
                Close();
            }
        }