Exemplo n.º 1
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));
        }