Exemplo n.º 1
0
        private void bttnAddRewards_Click(object sender, EventArgs e)
        {
            /////////////////////////////////////////////
            txtBoxPreTaxTot.Text         = "";
            txtBoxSalesTaxTotal.Text     = "";
            txtBoxRewardsFromOrder.Text  = "";
            txtBoxTotal.Text             = "";
            richTextBoxOrderSummary.Text = "";

            int.TryParse(txtBoxSmoothieQty.Text, out SmoothieQty);
            int.TryParse(txtBoxBowlQty.Text, out BowlQty);
            int.TryParse(txtBoxShootersQty.Text, out ShooterQty);
            double RewardsFromOrderTotal;

            PreTaxTotal = ((double)SmoothieTotalPrice + (double)BowlTotalPrice + (double)ShooterTotalPrice) * 0.9;

            SalesTax = PreTaxTotal * 0.001;
            Total    = PreTaxTotal + SalesTax;
            RewardsFromOrderTotal       = PreTaxTotal * .1;
            txtBoxPreTaxTot.Text        = PreTaxTotal.ToString("C");
            txtBoxSalesTaxTotal.Text    = SalesTax.ToString("C");
            txtBoxRewardsFromOrder.Text = RewardsFromOrderTotal.ToString("C");
            txtBoxTotal.Text            = Total.ToString("C");

            richTextBoxOrderSummary.Text = "You have ordered " + SmoothieQty.ToString() + " of " + drpDownSmoothies.SelectedItem.ToString() + " -" + SmoothieTotalPrice.ToString("C") + ", \n" + BowlQty.ToString() + " of " + drpDownBowls.SelectedItem.ToString() + " -" + BowlTotalPrice.ToString("C") + ", and \n" + ShooterQty.ToString() + " of " + drpDownShooters.SelectedItem.ToString() + " -" + ShooterTotalPrice.ToString("C") + ". \n Rewards Added - 10% off";

            /////////////////////////////////////////////
        }
Exemplo n.º 2
0
        private void bttnAddToOrder_Click(object sender, EventArgs e)
        {
            int.TryParse(txtBoxSmoothieQty.Text, out SmoothieQty);
            int.TryParse(txtBoxBowlQty.Text, out BowlQty);
            int.TryParse(txtBoxShootersQty.Text, out ShooterQty);

            if (drpDownSmoothies.SelectedIndex == 0)
            {
                SmoothieTotalPrice = WaterfallMelonSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 1)
            {
                SmoothieTotalPrice = WaterfallMelonLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 2)
            {
                SmoothieTotalPrice = JavaJavaSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 3)
            {
                SmoothieTotalPrice = JavaJavaLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 4)
            {
                SmoothieTotalPrice = TheClassicSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 5)
            {
                SmoothieTotalPrice = TheClassicLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 6)
            {
                SmoothieTotalPrice = TheTropicsSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 7)
            {
                SmoothieTotalPrice = TheTropicsLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 8)
            {
                SmoothieTotalPrice = TheGreenGoblinSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 9)
            {
                SmoothieTotalPrice = TheGreenGoblinLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 10)
            {
                SmoothieTotalPrice = GiveMeABoostSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 11)
            {
                SmoothieTotalPrice = GiveMeABoostLargePrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 12)
            {
                SmoothieTotalPrice = SourCravingSmallPrice * (double)SmoothieQty;
            }
            else if (drpDownSmoothies.SelectedIndex == 13)
            {
                SmoothieTotalPrice = SourCravingLargePrice * (double)SmoothieQty;
            }
            else
            {
                SmoothieTotalPrice = 0;
            }

            if (drpDownBowls.SelectedIndex == 0)
            {
                BowlTotalPrice = BowlofMelonSmallPrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 1)
            {
                BowlTotalPrice = BowlofMelonLargePrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 2)
            {
                BowlTotalPrice = IslandMedleySmallPrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 3)
            {
                BowlTotalPrice = IslandMedleyLargePrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 4)
            {
                BowlTotalPrice = CreamAndCrunchSmallPrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 5)
            {
                BowlTotalPrice = CreamAndCrunchyLargePrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 6)
            {
                BowlTotalPrice = TheRedHeadSmallPrice * (double)BowlQty;
            }
            else if (drpDownBowls.SelectedIndex == 7)
            {
                BowlTotalPrice = TheRedHeadLargePrice * (double)BowlQty;
            }
            else
            {
                BowlTotalPrice = 0;
            }

            if (drpDownShooters.SelectedIndex == 0)
            {
                ShooterTotalPrice = WatermelonShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 1)
            {
                ShooterTotalPrice = CoffeeShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 2)
            {
                ShooterTotalPrice = StrawberryShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 3)
            {
                ShooterTotalPrice = BlueberryShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 4)
            {
                ShooterTotalPrice = ApricotShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 5)
            {
                ShooterTotalPrice = CherryShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 6)
            {
                ShooterTotalPrice = PeachShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 7)
            {
                ShooterTotalPrice = PineappleShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 8)
            {
                ShooterTotalPrice = BananaShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 9)
            {
                ShooterTotalPrice = MangoShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 10)
            {
                ShooterTotalPrice = KiwiShotPrice * (double)ShooterQty;
            }
            else if (drpDownShooters.SelectedIndex == 11)
            {
                ShooterTotalPrice = DragonFruitShotPrice * (double)ShooterQty;
            }
            else
            {
                ShooterTotalPrice = 0;
            }

            richTextBoxOrderSummary.Text = "You have ordered " + txtBoxSmoothieQty.Text.ToString() + " of " + drpDownSmoothies.SelectedItem.ToString() + " -" + SmoothieTotalPrice.ToString("C") + ", \n" + txtBoxBowlQty.Text.ToString() + " of " + drpDownBowls.SelectedItem.ToString() + " -" + BowlTotalPrice.ToString("C") + ", and \n" + txtBoxShootersQty.Text.ToString() + " of " + drpDownShooters.SelectedItem.ToString() + " -" + ShooterTotalPrice.ToString("C") + ".";

            PreTaxTotal = (double)SmoothieTotalPrice + (double)BowlTotalPrice + (double)ShooterTotalPrice;
            SalesTax    = PreTaxTotal * 0.001;
            Total       = PreTaxTotal + SalesTax;

            txtBoxPreTaxTot.Text        = PreTaxTotal.ToString("C");
            txtBoxSalesTaxTotal.Text    = SalesTax.ToString("C");
            txtBoxRewardsFromOrder.Text = "$0.00";
            txtBoxTotal.Text            = Total.ToString("C");
        }