예제 #1
0
        /// <summary>
        /// Receives food and returns its ingredients
        /// </summary>
        /// <param name="food"></param>
        /// <returns></returns>
        public BE.Component ReturnComponent(String food)
        {
            BE.Component c   = new BE.Component();
            String       xml = bl.XmlFood(food);
            String       key = bl.GetKeyOfFood(xml, food);

            c = bl.ReturnComponent(key, 1);
            return(c);
        }
예제 #2
0
        /// <summary>
        /// filtering Component and change text
        /// </summary>
        /// <param name="filter"></param>
        private void filterComponent(String filter)
        {
            string[] _Component = filter.Split(' ');
            String   compomnent = _Component[1];

            BE.Component c     = new BE.Component();
            String       food1 = food;

            if (food1 != "" && food1 != null)//when the text in user auto complate is null or empty
            {
                c = model.ReturnComponent(food1);
            }
            //action that doing according to component that choose
            switch (compomnent)
            {
            case "Iron":
                Text        = "The amount of Iron is " + c.Iron;
                ImageUri    = "/images/אנרגיה.jpg";
                TextRemarks = "....";
                Image2      = "/images/סימןשאלה.png";

                break;

            case "Cholesterol":
                Text        = "The amount of Cholesterol is " + c.Cholesterol;
                ImageUri    = "/images/מים1.jpg";
                TextRemarks = "......";
                Image2      = "/images/סימןשאלה.png";
                break;

            case "Protien":
                Text        = "The amount of Protein is " + c.Protien;
                ImageUri    = "/images/חלבונים1.jpg";
                TextRemarks = "Protein contributes a lot to building cells and tissues, eating foods with protein!!";
                Image2      = "/images/סימןשאלה.png";

                break;

            case "Fats":
                Text        = "The amount of Fats is " + c.Fats;
                ImageUri    = "/images/fats1.jpg";
                TextRemarks = "fats!?, It's fattening.!!";
                Image2      = "/images/סימןשאלה.png";

                break;

            case "Fiber":
                Text        = "The amount of Fiber is " + c.Fiber;
                ImageUri    = "/images/סיבים1.jpg";
                TextRemarks = "Dietary fiber is essential for preventing disease and reducing or maintaining normal weight";
                Image2      = "/images/סימןשאלה.png";

                break;

            case "Carbohydrate":
                Text        = "The amount of Carbohydrate is " + c.Carbohydrate;
                ImageUri    = "/images/פחמימות1.jpg";
                TextRemarks = "The word carbohydrate means sugar, meaning the word sugar is synonymous with carbohydrate.";
                Image2      = "/images/סימןשאלה.png";
                break;

            case "Sugars":
                Text        = "The amount of Sugars is " + c.Sugar;
                ImageUri    = "/images/סוכר.jpg";
                TextRemarks = "Be careful, Consuming excessive sugar can be harmful!!";
                Image2      = "/images/סימןשאלה.png";

                break;

                /*case "Vitamins":
                 *  Text = "The amount of Vitamins is " + c.Vitamins;
                 *  ImageUri = "/images/ויטמינים1.jpg";
                 *  TextRemarks = "Vitamins are essential for preventing diseases such as anemia, and reducing the risk of contracting diseases such as cancer and heart disease. Many of the vitamins are antioxidants.";
                 *  Image2 = "/images/סימןשאלה.png";
                 */
                break;

            default:
                Text        = "";
                ImageUri    = "/images/פירות1.jpg";
                TextRemarks = "";
                Image2      = "";

                break;
            }
            // c = model.SumOfComponents(Id, DateTime.Now, time);
        }