private void GenerateDefaultDiet_Click(object sender, EventArgs e)
        {
            SystemUser.diet = new Diet();

            IEnumerable <categories> categoriesList;
            IEnumerable <products>   productsList;
            IEnumerable <meals>      mealsConsumptionTime;

            SystemUser.diet.ChoosenProducts.Clear();

            using (var dbConnection = new Entities())
            {
                categoriesList       = (from b in dbConnection.categories select b).ToList();
                productsList         = (from c in dbConnection.products select c).ToList();
                mealsConsumptionTime = (from d in dbConnection.meals select d).ToList();
            }
            foreach (var product in productsList)
            {
                SystemUser.diet.ChoosenProducts.Add(new Product(product));
                var catArray = from c in categoriesList where c.id_category == product.id_category select c.nameCategory;
                SystemUser.diet.ChoosenProducts.Last().CategoryName = catArray.Last();

                var consumptionTimeForCurrentProduct = (from d in mealsConsumptionTime where d.id_product == product.id_product select d).ToList();
                if (consumptionTimeForCurrentProduct.Count == 0)
                {
                    Debug.WriteLine("No product to choose. Sorry");
                    continue;
                }
                SystemUser.diet.ChoosenProducts.Last().ConsumptionTime[(int)FoodConsumptionTime.FirstMeal]  = consumptionTimeForCurrentProduct[0].first_meal;
                SystemUser.diet.ChoosenProducts.Last().ConsumptionTime[(int)FoodConsumptionTime.SecondMeal] = consumptionTimeForCurrentProduct[0].second_meal;
                SystemUser.diet.ChoosenProducts.Last().ConsumptionTime[(int)FoodConsumptionTime.ThirdMeal]  = consumptionTimeForCurrentProduct[0].third_meal;
                SystemUser.diet.ChoosenProducts.Last().ConsumptionTime[(int)FoodConsumptionTime.FourthMeal] = consumptionTimeForCurrentProduct[0].fourth_meal;
                SystemUser.diet.ChoosenProducts.Last().ConsumptionTime[(int)FoodConsumptionTime.FifthMeal]  = consumptionTimeForCurrentProduct[0].fifth_meal;
            }

            AddKcalDifferenceBasedOnDietType();

            CalculateKcalAndPrepareDiet();

            SystemUser.diet.GenerateDiet();

            YourMeals showMeals = new YourMeals(SystemUser);

            showMeals.ShowDialog();
        }
        private void GeneratePersonalizedDiet_Click(object sender, EventArgs e)
        {
            SystemUser.diet = new Diet();
            QuestionCounter = 0;
            SystemUser.diet.ChoosenProducts.Clear();

            List <Question>          QuestionList = new List <Question>();
            IEnumerable <categories> categoriesList;
            IEnumerable <products>   productsList;
            IEnumerable <meals>      mealsConsumptionTime;

            using (var dbConnection = new Entities())
            {
                categoriesList       = (from b in dbConnection.categories select b).ToList();
                productsList         = (from c in dbConnection.products select c).ToList();
                mealsConsumptionTime = (from d in dbConnection.meals select d).ToList();
            }

            foreach (var category in categoriesList)
            {
                var currentCategoryProducts = from c in productsList where c.id_category == category.id_category select c;
                QuestionList.Add(new Question(category.id_category, category.nameCategory, currentCategoryProducts.ToList()));
            }

            QuestionWindow questionWindow = new QuestionWindow(QuestionList, SystemUser, mealsConsumptionTime.ToList())
            {
                StartPosition = FormStartPosition.CenterParent
            };

            questionWindow.ShowDialog();

            CalculateKcalAndPrepareDiet();

            SystemUser.diet.GenerateDiet();

            YourMeals showMeals = new YourMeals(SystemUser);

            showMeals.ShowDialog();
        }