/// <summary>
        /// Method created to fill the List of Dishes
        /// </summary>
        /// <param name="mealTime"></param>
        /// <returns></returns>
        private ICollection<string> FillMenuList(EnumDishesTime mealTime)
        {
            ICollection<string> menuList = new List<string>();

            var aggrouped = GetAggroupedSummary();

            foreach (var item in aggrouped)
            {
                object dishName;

                if ((MealServices.IsMorningAndDishTypeIsCoffee(mealTime, item.Value)
                        || (MealServices.IsNightAndDishTypeIsPotato(mealTime, item.Value)))
                        && item.Amount > 1)
                {
                    dishName = GetDishName(mealTime, item.Value);

                    var concDishAmount = dishName + "(" + item.Amount + "X)";
                    menuList.Add(concDishAmount);
                }
                else if (MealServices.IsNotCorrectDish(item.Value))
                {
                    dishName = GetDishName(mealTime, item.Value);
                    menuList.Add(dishName.ToString());
                }
            }

            return menuList;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Class dependent IScheduleStrategy
        /// </summary>
        /// <param name="time"></param>
        /// <param name="numbersOfMeal"></param>
        /// <returns></returns>
        public MealPlan Meal(EnumDishesTime time, List<int> numbersOfMeal)
        {
            var mealPlan = new MealFactory(time, numbersOfMeal).Create();

            return mealPlan;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="schedule"></param>
 /// <param name="dishesTime"></param>
 public MealManager(IScheduleStrategy schedule, EnumDishesTime dishesTime)
 {
     _schedule = schedule;
     _dishesTime = dishesTime;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Method to get the MealPlan
 /// </summary>
 /// <param name="plan"></param>
 /// <returns></returns>
 private static MealPlan MealPlan(IScheduleStrategy schedule, EnumDishesTime dishesTime, string plan)
 {
     var manager = new MealManager(schedule, dishesTime).Manager(plan);
     return manager;
 }