示例#1
0
        /// <summary>
        /// The on post event
        /// </summary>
        public void OnPost()
        {
            Combos  = Menu.AvailableCombos;
            Drinks  = Menu.AvailableDrinks;
            Entrees = Menu.AvailableEntrees;
            Sides   = Menu.AvailableSides;


            if (search != null)
            {
                Combos  = Combos.Where(item => item.ToString().Contains(search, StringComparison.OrdinalIgnoreCase));
                Drinks  = Drinks.Where(item => item.ToString().Contains(search, StringComparison.OrdinalIgnoreCase));
                Entrees = Entrees.Where(item => item.ToString().Contains(search, StringComparison.OrdinalIgnoreCase));
                Sides   = Sides.Where(item => item.ToString().Contains(search, StringComparison.OrdinalIgnoreCase));
            }

            if (minimumPrice != null)
            {
                Combos  = Combos.Where(item => item.Price >= minimumPrice);
                Drinks  = Drinks.Where(item => item.Price >= minimumPrice);
                Entrees = Entrees.Where(item => item.Price >= minimumPrice);
                Sides   = Sides.Where(item => item.Price >= minimumPrice);
            }

            if (maximumPrice != null)
            {
                Combos  = Combos.Where(item => item.Price <= maximumPrice);
                Drinks  = Drinks.Where(item => item.Price <= maximumPrice);
                Entrees = Entrees.Where(item => item.Price <= maximumPrice);
                Sides   = Sides.Where(item => item.Price <= maximumPrice);
            }

            if (possibleIngredients.Count > 0)
            {
                foreach (string ingredients in possibleIngredients)
                {
                    Combos  = Combos.Where(item => !(item.Ingredients.Contains(ingredients)));
                    Drinks  = Drinks.Where(item => !(item.Ingredients.Contains(ingredients)));
                    Entrees = Entrees.Where(item => !(item.Ingredients.Contains(ingredients)));
                    Sides   = Sides.Where(item => !(item.Ingredients.Contains(ingredients)));
                }
            }

            if (menuCategory.Count > 0)
            {
            }
        }
示例#2
0
 public void OnPost()
 {
     Combos  = Menu.AvailableCombos;
     Entrees = Menu.AvailableEntrees;
     Sides   = Menu.AvailableSides;
     Drinks  = Menu.AvailableDrinks;
     if (search != null)
     {
         Combos  = Combos.Where(combo => combo.Description.Contains(search, StringComparison.OrdinalIgnoreCase));
         Entrees = Entrees.Where(entree => entree.Description.Contains(search, StringComparison.OrdinalIgnoreCase));
         Sides   = Sides.Where(side => side.Description.Contains(search, StringComparison.OrdinalIgnoreCase));
         Drinks  = Drinks.Where(drink => drink.Description.Contains(search, StringComparison.OrdinalIgnoreCase));
     }
     if (menuCategory.Count != 0)
     {
         Combos  = Combos.Where(combo => menuCategory.Contains("Combo"));
         Entrees = Entrees.Where(entree => menuCategory.Contains("Entree"));
         Sides   = Sides.Where(side => menuCategory.Contains("Side"));
         Drinks  = Drinks.Where(drink => menuCategory.Contains("Drink"));
     }
     if (ingredients.Count != 0)
     {
         foreach (string c in ingredients)
         {
             Combos  = Combos.Where(combo => !combo.Ingredients.Contains(c));
             Entrees = Entrees.Where(entree => !entree.Ingredients.Contains(c));
             Sides   = Sides.Where(side => !side.Ingredients.Contains(c));
             Drinks  = Drinks.Where(drink => !drink.Ingredients.Contains(c));
         }
     }
     if (minimumPrice != null)
     {
         Combos  = Combos.Where(combo => combo.Price > minimumPrice || Math.Abs(combo.Price - (double)minimumPrice) < .0001);
         Entrees = Entrees.Where(entree => entree.Price >= minimumPrice || Math.Abs(entree.Price - (double)minimumPrice) < .0001);
         Sides   = Sides.Where(side => side.Price >= minimumPrice || Math.Abs(side.Price - (double)minimumPrice) < .0001);
         Drinks  = Drinks.Where(drink => drink.Price >= minimumPrice || Math.Abs(drink.Price - (double)minimumPrice) < .0001);
     }
     if (maximumPrice != null)
     {
         Combos  = Combos.Where(combo => combo.Price <= maximumPrice || Math.Abs(combo.Price - (double)maximumPrice) < .0001);
         Entrees = Entrees.Where(entree => entree.Price <= maximumPrice || Math.Abs(entree.Price - (double)maximumPrice) < .0001);
         Sides   = Sides.Where(side => side.Price <= maximumPrice || Math.Abs(side.Price - (double)maximumPrice) < .0001);
         Drinks  = Drinks.Where(drink => drink.Price <= maximumPrice || Math.Abs(drink.Price - (double)maximumPrice) < .0001);
     }
 }
示例#3
0
 /// <summary>
 /// Whenever something is clicked this happens
 /// </summary>
 public void OnPost()
 {
     Combos    = Menu.AvailableCombos;
     Entrees   = Menu.AvailableEntrees;
     Sides     = Menu.AvailableSides;
     MenuItems = Menu.AvailableMenuItems;
     Drinks    = Menu.AvailableDrinks;
     Menu.AllIngredients(Menu.AvailableCombos);
     Menu.AllIngredients(Menu.AvailableEntrees);
     Menu.AllIngredients(Menu.AvailableSides);
     Menu.AllIngredients(Menu.AvailableDrinks);
     PossibleIngredientsHashSet = Menu.PossibleIngredients;
     if (Search != null)
     {
         Combos  = Combos.Where(combo => combo.ToString().Contains(Search));
         Entrees = Entrees.Where(entree => entree.ToString().Contains(Search));
         Sides   = Sides.Where(side => side.ToString().Contains(Search));
         Drinks  = Drinks.Where(drink => drink.ToString().Contains(Search));
     }
     if (Filter.Count != 0)
     {
         Combos  = Combos.Where(combo => combo is CretaceousCombo && Filter.Contains("Combo"));;
         Entrees = Entrees.Where(entree => entree is Entree && Filter.Contains("Entree"));
         Sides   = Sides.Where(side => side is Side && Filter.Contains("Side"));
         Drinks  = Drinks.Where(drink => drink is Drink && Filter.Contains("Drink"));
     }
     if (Ingredients.Count != 0)
     {
         Combos = Combos.Where(combo =>
         {
             bool keep = false;
             for (int i = 0; i < Ingredients.Count; i++)
             {
                 if (combo.Ingredients.Contains(Ingredients[i]))
                 {
                     keep = true;
                 }
             }
             return(keep);
         });
         Entrees = Entrees.Where(entree =>
         {
             bool keep = false;
             for (int i = 0; i < Ingredients.Count; i++)
             {
                 if (entree.Ingredients.Contains(Ingredients[i]))
                 {
                     keep = true;
                 }
             }
             return(keep);
         });
         Sides = Sides.Where(side =>
         {
             bool keep = false;
             for (int i = 0; i < Ingredients.Count; i++)
             {
                 if (side.Ingredients.Contains(Ingredients[i]))
                 {
                     keep = true;
                 }
             }
             return(keep);
         });
         Drinks = Drinks.Where(drink =>
         {
             bool keep = false;
             for (int i = 0; i < Ingredients.Count; i++)
             {
                 if (drink.Ingredients.Contains(Ingredients[i]))
                 {
                     keep = true;
                 }
             }
             return(keep);
         });
     }
     if (MinimumPrice != null)
     {
         Combos  = Combos.Where(combo => combo.Price >= MinimumPrice);
         Entrees = Entrees.Where(entree => entree.Price >= MinimumPrice);
         Sides   = Sides.Where(side => side.Price >= MinimumPrice);
         Drinks  = Drinks.Where(drink => drink.Price >= MinimumPrice);
     }
     if (MaximumPrice != null)
     {
         Combos  = Combos.Where(combo => combo.Price <= MaximumPrice);
         Entrees = Entrees.Where(entree => entree.Price <= MaximumPrice);
         Sides   = Sides.Where(side => side.Price <= MaximumPrice);
         Drinks  = Drinks.Where(drink => drink.Price <= MaximumPrice);
     }
 }
示例#4
0
        public void OnPost(string search, List <string> menuCategory, float?minimumPrice, float?maximumPrice, List <string> ingredient)
        {
            Menu    = new Menu();
            Combos  = Menu.AvailableCombos;
            Entrees = Menu.AvailableEntrees;
            Drinks  = Menu.AvailableDrinks;
            Sides   = Menu.AvailableSides;

            //Filter on name
            if (search != null)
            {
                Combos  = Combos.Where(combo => combo.ToString().Contains(search));
                Entrees = Entrees.Where(entree => entree.ToString().Contains(search));
                Drinks  = Drinks.Where(drink => drink.ToString().Contains(search));
                Sides   = Sides.Where(side => side.ToString().Contains(search));
            }

            //Filter on category
            if (menuCategory != null)
            {
                if (!menuCategory.Contains("Combo"))
                {
                    Combos = new List <CretaceousCombo>();
                }
                if (!menuCategory.Contains("Entree"))
                {
                    Entrees = new List <Entree>();
                }
                if (!menuCategory.Contains("Drink"))
                {
                    Drinks = new List <Drink>();
                }
                if (!menuCategory.Contains("Side"))
                {
                    Sides = new List <Side>();
                }
            }

            //Filter on min price
            if (minimumPrice != null)
            {
                Combos  = Combos.Where(combo => combo.Price >= minimumPrice);
                Entrees = Entrees.Where(entree => entree.Price >= minimumPrice);
                Drinks  = Drinks.Where(drink => drink.Price >= minimumPrice);
                Sides   = Sides.Where(side => side.Price >= minimumPrice);
            }

            //Filter on max price
            if (maximumPrice != null)
            {
                Combos  = Combos.Where(combo => combo.Price <= maximumPrice);
                Entrees = Entrees.Where(entree => entree.Price <= maximumPrice);
                Drinks  = Drinks.Where(drink => drink.Price <= maximumPrice);
                Sides   = Sides.Where(side => side.Price <= maximumPrice);
            }

            //Filter on ingredients
            if (ingredient != null)
            {
                Combos  = Combos.Where(combo => combo.Ingredients.Where(ingred => ingredient.Contains(ingred)).Count() == 0);
                Entrees = Entrees.Where(entree => entree.Ingredients.Where(ingred => ingredient.Contains(ingred)).Count() == 0);
                Drinks  = Drinks.Where(drink => drink.Ingredients.Where(ingred => ingredient.Contains(ingred)).Count() == 0);
                Sides   = Sides.Where(side => side.Ingredients.Where(ingred => ingredient.Contains(ingred)).Count() == 0);
            }
        }
示例#5
0
        /// <summary>
        /// The Post method responses to the server, use the LINQ Enumberable.Where method
        /// </summary>
        public void OnPost()
        {
            Combos  = Menu.AvailableCombos;
            Entrees = Menu.AvailableEntrees;
            Sides   = Menu.AvailableSides;
            Drinks  = Menu.AvailableDrinks;

            Menu.AllIngredients(Menu.AvailableCombos);
            Menu.AllIngredients(Menu.AvailableEntrees);
            Menu.AllIngredients(Menu.AvailableSides);
            Menu.AllIngredients(Menu.AvailableDrinks);
            Ingre = Menu.PossibleIngredients;

            if (search != null)
            {
                Combos  = Combos.Where(combo => combo.ToString().Contains(search));
                Entrees = Entrees.Where(entree => entree.ToString().Contains(search));
                Sides   = Sides.Where(side => side.ToString().Contains(search));
                Drinks  = Drinks.Where(drink => drink.ToString().Contains(search));
            }

            if (filters.Count != 0)
            {
                Combos  = Combos.Where(combo => combo is CretaceousCombo && filters.Contains("Combo"));
                Entrees = Entrees.Where(entree => entree is Entree && filters.Contains("Entree"));
                Sides   = Sides.Where(side => side is Side && filters.Contains("Side"));
                Drinks  = Drinks.Where(drink => drink is Drink && filters.Contains("Drink"));
            }

            if (minPrice != null)
            {
                Combos  = Combos.Where(combo => combo.Price >= minPrice);
                Entrees = Entrees.Where(entree => entree.Price >= minPrice);
                Sides   = Sides.Where(side => side.Price >= minPrice);
                Drinks  = Drinks.Where(drink => drink.Price >= minPrice);
            }

            if (maxPrice != null)
            {
                Combos  = Combos.Where(combo => combo.Price <= maxPrice);
                Entrees = Entrees.Where(entree => entree.Price <= maxPrice);
                Sides   = Sides.Where(side => side.Price <= maxPrice);
                Drinks  = Drinks.Where(drink => drink.Price <= maxPrice);
            }


            if (ingredients.Count != 0)
            {
                Combos = Combos.Where(combo =>
                {
                    List <IMenuItem> results = new List <IMenuItem>();
                    bool safeToAdd           = true;
                    for (int j = 0; j < ingredients.Count; j++)
                    {
                        if (combo.Ingredients.Contains(ingredients[j]))
                        {
                            safeToAdd = false;
                            break;
                        }
                    }
                    return(safeToAdd);
                });

                Entrees = Entrees.Where(entree =>
                {
                    List <IMenuItem> results = new List <IMenuItem>();
                    bool safeToAdd           = true;
                    for (int j = 0; j < ingredients.Count; j++)
                    {
                        if (entree.Ingredients.Contains(ingredients[j]))
                        {
                            safeToAdd = false;
                            break;
                        }
                    }
                    return(safeToAdd);
                });

                Sides = Sides.Where(side =>
                {
                    List <IMenuItem> results = new List <IMenuItem>();
                    bool safeToAdd           = true;
                    for (int j = 0; j < ingredients.Count; j++)
                    {
                        if (side.Ingredients.Contains(ingredients[j]))
                        {
                            safeToAdd = false;
                            break;
                        }
                    }
                    return(safeToAdd);
                });

                Drinks = Drinks.Where(drink =>
                {
                    List <IMenuItem> results = new List <IMenuItem>();
                    bool safeToAdd           = true;
                    for (int j = 0; j < ingredients.Count; j++)
                    {
                        if (drink.Ingredients.Contains(ingredients[j]))
                        {
                            safeToAdd = false;
                            break;
                        }
                    }
                    return(safeToAdd);
                });
            }
        }
示例#6
0
        /// <summary>
        /// UI method
        /// </summary>
        public void OnPost()
        {
            Combos = Menu.AvailableCombos;
            Entree = Menu.AvailableEntrees;
            Drink  = Menu.AvailableDrinks;
            Side   = Menu.AvailableSides;

            Menu.AllIngredient(Combos);
            Menu.AllIngredient(Entree);
            Menu.AllIngredient(Drink);
            Menu.AllIngredient(Side);
            Ingre = Menu.PossibleIngredients;

            if (search != null)
            {
                Combos = Combos.Where(cb => cb.ToString().Contains(search));
                Entree = Entree.Where(en => en.ToString().Contains(search));
                Drink  = Drink.Where(dr => dr.ToString().Contains(search));
                Side   = Side.Where(sd => sd.ToString().Contains(search));

                //Combos = Search(Combos, search);
                //Entree = Search(Entree, search);
                //Drink = Search(Drink, search);
                //Side = Search(Side, search);
            }

            if (MChoose.Count != 0)
            {
                FilterByMPAA(MChoose);
            }

            if (minIMDB != null)
            {
                Combos = Combos.Where(cb => cb.Price >= minIMDB);
                Entree = Entree.Where(en => en.Price >= minIMDB);
                Drink  = Drink.Where(dr => dr.Price >= minIMDB);
                Side   = Side.Where(sd => sd.Price >= minIMDB);
            }
            if (maxIMDB != null)
            {
                Combos = Combos.Where(cb => cb.Price <= maxIMDB);
                Entree = Entree.Where(en => en.Price <= maxIMDB);
                Drink  = Drink.Where(dr => dr.Price <= maxIMDB);
                Side   = Side.Where(sd => sd.Price <= maxIMDB);
            }

            if (Ingre.Count != 0)
            {
                Combos = Combos.Where(cb =>
                {
                    bool check = true;
                    foreach (string s in IChoose)
                    {
                        if (cb.Ingredients.Contains(s))
                        {
                            check = false;
                            break;
                        }
                    }
                    return(check);
                });

                Entree = Entree.Where(en =>
                {
                    bool check = true;
                    foreach (string s in IChoose)
                    {
                        if (en.Ingredients.Contains(s))
                        {
                            check = false;
                            break;
                        }
                    }
                    return(check);
                });

                Drink = Drink.Where(dr =>
                {
                    bool check = true;
                    foreach (string s in IChoose)
                    {
                        if (dr.Ingredients.Contains(s))
                        {
                            check = false;
                            break;
                        }
                    }
                    return(check);
                });

                Side = Side.Where(sd =>
                {
                    bool check = true;
                    foreach (string s in IChoose)
                    {
                        if (sd.Ingredients.Contains(s))
                        {
                            check = false;
                            break;
                        }
                    }
                    return(check);
                });
                //Combos = RemoveItem(Combos, IChoose);
                //Entree = RemoveItem(Entree, IChoose);
                //Drink = RemoveItem(Drink, IChoose);
                //Side = RemoveItem(Side, IChoose);
            }
        }