Exemplo n.º 1
0
        //Prints out recipe name, number of ingredients, food category and description
        public override string ToString()
        {
            int chars = Math.Min(description.Length, 30);
            string descriptionText = description.Substring(0, chars);

            int chars2 = Math.Min(recipeName.Length, 30);
            string nameText = recipeName.Substring(0, chars2);

            int chars3 = Math.Min(foodCategory.ToString().Length, 30);
            string categoryText = (foodCategory.ToString().Substring(0, chars3));

            int chars4 = Math.Min(GetCurrentNumOfIngrediens().ToString().Length, 30);
            string noText = (GetCurrentNumOfIngrediens().ToString().Substring(0, chars4));

            if (string.IsNullOrEmpty(descriptionText))
                descriptionText = "No description";

            string textOut = string.Format("{0, -30} {1, 30} {2, 30} {3, 30}", nameText, noText, categoryText, descriptionText);
            return textOut;
        }
Exemplo n.º 2
0
 private void LoadFoodByCategorie(FoodCategory categorie)
 {
     using (var db = new DbManager.ApplicationDbContext())
     {
         var query = db.FoodProducts.Where(x => x.MiCategory == categorie.ToString());
         FoodProductsCollection.Clear();
         foreach (var item in query)
         {
             FoodProductsCollection.Add(item);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a string with all ingredients
        /// </summary>
        /// <returns>All ingredients</returns>
        public override string ToString()
        {
            var chars           = Math.Min(Description.Length, 15);
            var descriptionText = Description.Substring(0, chars);

            if (string.IsNullOrEmpty(descriptionText))
            {
                descriptionText = "No Description";
            }

            return($"{Name,-20} {CurrentNumOfIngredients,5} {FoodCategory.ToString(),16} {descriptionText,16}");
        }
Exemplo n.º 4
0
        public override string ToString()
        {
            int    chars           = Math.Min(description.Length, 15);
            string descriptionText = description.Substring(0, chars);

            if (string.IsNullOrEmpty(descriptionText))
            {
                descriptionText = "No Description!";
            }
            string textOut = string.Format("{0, -20} {1,4}    {2,-12}   {3,-15}",
                                           name, GetCurrentNumOfIngredients(), category.ToString(), descriptionText);

            return(textOut);
        }
        public override string ToString()
        {
            int    CurrentNumOfIngred = GetCurrentNumOfIngred();
            int    charsDesc          = Math.Min(description.Length, 15);
            int    charsName          = Math.Min(name.Length, 12);
            string descriptionText    = description.Substring(0, charsDesc);
            string nameText           = name.Substring(0, charsName);

            if (string.IsNullOrEmpty(descriptionText))
            {
                descriptionText = "No Description";
            }

            string textOut = string.Format("{0, -20} {1,4}      {2, -12}    {3, -15}",
                                           nameText.ToString(), CurrentNumOfIngred.ToString(), category.ToString(), descriptionText);;

            return(textOut);
        }