Beispiel #1
0
        public static IEnumerable <IOrderItem> FullMenu()
        {
            List <IOrderItem> list = new List <IOrderItem>();

            list.AddRange(Menu.Entrees());
            list.AddRange(Menu.Sides());
            list.AddRange(Menu.Drinks());
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// Gets a list of all items on the menu.
        /// </summary>
        /// <returns>A list of IOrderItem objects that contains all items.</returns>
        public static IEnumerable <IOrderItem> FullMenu()
        {
            List <IOrderItem> fullMenu = new List <IOrderItem>();

            foreach (IOrderItem i in Menu.Entrees())
            {
                fullMenu.Add(i);
            }
            foreach (IOrderItem i in Menu.Sides())
            {
                fullMenu.Add(i);
            }
            foreach (IOrderItem i in Menu.Drinks())
            {
                fullMenu.Add(i);
            }
            return(fullMenu);
        }
Beispiel #3
0
        /// <summary>
        /// Filters menu items for website based on Text search terms
        /// </summary>
        /// <param name="s">terms entered by user</param>
        /// <returns>List of Lists of IOrderItem. First list is entrees, second is sides, thrid is drinks.</returns>
        public static List <List <IOrderItem> > Search(string s)
        {
            if (s == null)
            {
                return new List <List <IOrderItem> > {
                           Entrees().ToList(), Sides().ToList(), Drinks().ToList()
                }
            }
            ;

            string term = s.ToLower();

            string[] terms = term.Split();

            IEnumerable <IOrderItem> entrees = Menu.Entrees().Where(item => terms.Any(item.ToString().ToLower().Contains) || terms.Any(item.Description.ToLower().Contains));
            IEnumerable <IOrderItem> drinks  = Menu.Drinks().Where(item => terms.Any(item.ToString().ToLower().Contains) || terms.Any(item.Description.ToLower().Contains));
            IEnumerable <IOrderItem> sides   = Menu.Sides().Where(item => terms.Any(item.ToString().ToLower().Contains) || terms.Any(item.Description.ToLower().Contains));

            return(new List <List <IOrderItem> > {
                entrees.ToList(), sides.ToList(), drinks.ToList()
            });
        }
        /// <summary>
        /// Creates the window based off of a combo item being created.
        /// </summary>
        /// <param name="combo">The combo item being created.</param>
        private void CreateComboItem(ComboItem combo)
        {
            //Entree
            ComboBox entreeCb = new ComboBox();

            entreeCb.FontSize            = 16;
            entreeCb.Margin              = new Thickness(5, 0, 5, 0);
            entreeCb.ItemsSource         = GetItemsForComboBox(Menu.Entrees(), combo.Entree);
            entreeCb.HorizontalAlignment = HorizontalAlignment.Left;
            entreeCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Entree").Name)
            {
                Source = combo,
                Mode   = BindingMode.TwoWay
            });
            MainPanel.Children.Add(entreeCb);
            setControls.Add(entreeCb);
            entreeCb.SelectedIndex = 0;

            Button customizeEntreeButton = new Button();

            customizeEntreeButton.Content             = "Customize Entree";
            customizeEntreeButton.Click              += CustomizeEntreeButtonClick;
            customizeEntreeButton.FontSize            = 16;
            customizeEntreeButton.Margin              = new Thickness(5, 0, 5, 0);
            customizeEntreeButton.HorizontalAlignment = HorizontalAlignment.Left;
            MainPanel.Children.Add(customizeEntreeButton);
            setControls.Add(customizeEntreeButton);

            //Side
            ComboBox sideCb = new ComboBox();

            sideCb.FontSize            = 16;
            sideCb.Margin              = new Thickness(5, 0, 5, 0);
            sideCb.ItemsSource         = GetItemsForComboBox(Menu.Sides(), combo.Side);
            sideCb.SelectedItem        = combo.Side;
            sideCb.HorizontalAlignment = HorizontalAlignment.Left;
            sideCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Side").Name)
            {
                Source = combo,
                Mode   = BindingMode.TwoWay
            });
            MainPanel.Children.Add(sideCb);
            setControls.Add(sideCb);
            sideCb.SelectedIndex = 0;

            Button customizeSideButton = new Button();

            customizeSideButton.Content             = "Customize Side";
            customizeSideButton.Click              += CustomizeSideButtonClick;
            customizeSideButton.FontSize            = 16;
            customizeSideButton.Margin              = new Thickness(5, 0, 5, 0);
            customizeSideButton.HorizontalAlignment = HorizontalAlignment.Left;
            MainPanel.Children.Add(customizeSideButton);
            setControls.Add(customizeSideButton);

            //Drink
            ComboBox drinkCb = new ComboBox();

            drinkCb.FontSize            = 16;
            drinkCb.Margin              = new Thickness(5, 0, 5, 0);
            drinkCb.ItemsSource         = GetItemsForComboBox(Menu.Drinks(), combo.Drink);
            drinkCb.HorizontalAlignment = HorizontalAlignment.Left;
            drinkCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Drink").Name)
            {
                Source = combo,
                Mode   = BindingMode.TwoWay
            });
            MainPanel.Children.Add(drinkCb);
            setControls.Add(drinkCb);
            drinkCb.SelectedIndex = 0;

            Button customizeDrinkButton = new Button();

            customizeDrinkButton.Content             = "Customize Drink";
            customizeDrinkButton.Click              += CustomizeDrinkButtonClick;
            customizeDrinkButton.FontSize            = 16;
            customizeDrinkButton.Margin              = new Thickness(5, 0, 5, 0);
            customizeDrinkButton.HorizontalAlignment = HorizontalAlignment.Left;
            MainPanel.Children.Add(customizeDrinkButton);
            setControls.Add(customizeDrinkButton);
        }