Exemplo n.º 1
0
        /// <summary>
        /// Получить конечный напиток
        /// </summary>
        /// <returns></returns>
        private Drink GetFinishDrink()
        {
            //сахар
            int countSugar = cbSugar.Checked ? (int)nUDCountSugar.Value : 0;
            //имя напитка
            string nameDrink = "";
            //молоко
            bool isMilk = cbMilk.Checked;
            //сироп
            bool isSyrup = cbSyrup.Checked;
            //молочная пенка
            bool isCappuccinoFoam = rbCappuccino.Checked;

            foreach (RadioButton rb in gbDrink.Controls)
            {
                if (rb.Checked)
                {
                    nameDrink = rb.Text.Split('(').Length != 0 ? rb.Text.Split('(')[0] : "";
                    break;
                }
            }
            if (String.IsNullOrEmpty(nameDrink))
            {
                return(null);
            }
            FoodAuto     foodAuto = new FoodAuto();
            DrinkBuilder builder  = DrinkBuilder.GetBuilderForNameDrink(nameDrink);

            return(foodAuto.CreateDrink(builder, nameDrink, countSugar, isMilk, isSyrup, isCappuccinoFoam));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Получить конечное блюдо
        /// </summary>
        /// <returns></returns>
        private Dish GetFinishDish()
        {
            //имя блюда
            string nameDish = "";
            //Хлеб
            bool isBread = rbBread.Checked;
            //булочка
            bool isBun = rbBun.Checked;
            //ветчина
            bool isHam = cbHam.Checked;
            //Сыр
            bool isCheese = cbCheese.Checked;
            //джем
            bool isJam = cbJam.Checked;

            if (isBread || isBun)
            {
                nameDish = "Бутерброд";
            }
            else
            {
                foreach (RadioButton rb in gbFood.Controls)
                {
                    if (rb.Checked)
                    {
                        nameDish = rb.Text.Split('(').Length != 0 ? rb.Text.Split('(')[0] : "";
                        break;
                    }
                }
            }

            if (String.IsNullOrEmpty(nameDish))
            {
                return(null);
            }
            FoodAuto    foodAuto = new FoodAuto();
            DishBuilder builder  = DishBuilder.GetBuilderForNameDish(nameDish);

            return(foodAuto.CreateDish(builder, nameDish, isBread, isBun, isHam, isCheese, isJam));
        }