Пример #1
0
        private void GetBeverageDesc()
        {
            switch (beverageType.SelectedValue)
            {
            case "C":     //Coffee
                bev = new Coffee();
                break;

            case "S":     //Soymilk
                bev = new SoyMilk();
                break;

            case "T":     //Tea
                bev = new Tea();
                break;
            }
            foreach (ListItem li in toppingList.Items)
            {
                if (li.Selected)
                {
                    switch (li.Value.ToString())
                    {
                    case "C":     //Caramel
                        bev = new ToppingCaramel(bev);
                        break;

                    case "D":     //Cream
                        bev = new ToppingCream(bev);
                        break;

                    case "W":     //Whip
                        bev = new ToppingWhip(bev);
                        break;
                    }
                }
            }

            lblResult.Text = "You have ordered " + bev.desc() + ", and the price is " + bev.price().ToString();
            string toppings = toppingList.SelectedValue;
        }