Beispiel #1
0
        private PizzaInfo getPizzaInfo()
        {
            PizzaInfo pizzaInfo = new PizzaInfo();

            pizzaInfo.toppingsList = new List <string>();

            if (this.rbSmall.Checked)
            {
                pizzaInfo.pizzaSize     = "Small";
                pizzaInfo.pizzaBaseCost = 10;
            }
            else if (this.rbMedium.Checked)
            {
                pizzaInfo.pizzaSize     = "Medium";
                pizzaInfo.pizzaBaseCost = 15;
            }
            else if (this.rbLarge.Checked)
            {
                pizzaInfo.pizzaSize     = "Large";
                pizzaInfo.pizzaBaseCost = 15;
            }

            if (cbPepperoni.Checked)
            {
                pizzaInfo.toppingsList.Add("Pepperoni");
                pizzaInfo.numberOfToppings++;
            }
            if (cbSausage.Checked)
            {
                pizzaInfo.toppingsList.Add("Sausage");
                pizzaInfo.numberOfToppings++;
            }
            if (cbOlives.Checked)
            {
                pizzaInfo.toppingsList.Add("Olives");
                pizzaInfo.numberOfToppings++;
            }
            if (cbOnion.Checked)
            {
                pizzaInfo.toppingsList.Add("Onions");
                pizzaInfo.numberOfToppings++;
            }
            if (cbCheese.Checked)
            {
                pizzaInfo.toppingsList.Add("Extra Cheese");
                pizzaInfo.numberOfToppings++;
            }

            return(pizzaInfo);
        }
Beispiel #2
0
        private void formSubmission(object sender, EventArgs e)
        {
            CustomerInfo customerInfo = getCustomerInfo();

            PaymentInfo paymentInfo = getPaymentInfo();

            PizzaInfo pizzaInfo = getPizzaInfo();

            double cost = calculateCost(paymentInfo.Quantity, pizzaInfo.numberOfToppings, pizzaInfo.pizzaBaseCost);

            FormInfo formInfo = new FormInfo
            {
                customerInfo = customerInfo,
                paymentInfo  = paymentInfo,
                pizzaInfo    = pizzaInfo,
                totalCost    = cost,
                orderNumber  = Convert.ToInt32(this.tbOrderNo.Text)
            };

            loadTotalsForm(formInfo);
        }