//Dish d = new Dish(); //List<Dish> menulist = new List<Dish>(); public Originals() { InitializeComponent(); this.AutoScroll = true; // Header BasePage bpage = new BasePage(); Panel p = bpage.GetHeaderPanel(); pnlHeader.Location = new Point(0, p.Location.Y + p.Size.Height); pnlHeader.Size = new Size(1265, 490); pnlHeader.BackgroundImage = OOP_PROJECT.Properties.Resources._5; this.Controls.Add(pnlHeader); Originals f = this; Burger.DisplayMenuItems(Program.menuOriginals, pnlHeader.Bottom, f); }
private void button1_Click(object sender, EventArgs e) { if (done) { Burger.DisposeControl(this); } done = true; customizeList = new List <Dish>(); #region PRICE foreach (Dish dish in Program.dishlist) { if (dish.Price <= trbarPrice.Value) { customizeList.Add(dish); } } #endregion //Calories List <Dish> templist = new List <Dish>(customizeList); foreach (Dish dish in templist) { if (dish.Calories > trbarCalories.Value) { customizeList.Remove(dish); } } templist = new List <Dish>(customizeList); #region MENU TYPE templist = new List <Dish>(customizeList); foreach (Dish dish in templist) { if (!checkDishInMenu(dish.Menu, clbMenu)) { customizeList.Remove(dish); } } templist = new List <Dish>(customizeList); #endregion //Allergens -with tooltip templist = new List <Dish>(customizeList); foreach (Dish dish in templist) { foreach (string ingredient in dish.Allergens) { for (int i = 0; i < clbAllergens.CheckedItems.Count; i++) { if (ingredient == clbAllergens.CheckedItems[i].ToString().ToLower()) { customizeList.Remove(dish); break; } } } } switch (comboBox1.SelectedIndex) { case 0: customizeList = customizeList.OrderBy(o => o.Name).ToList(); break; case 1: customizeList = customizeList.OrderBy(o => o.Price).ToList(); break; case 2: customizeList = customizeList.OrderBy(o => o.Calories).ToList(); break; case 3: customizeList = customizeList.OrderBy(o => o.Preptime).ToList(); break; } Burger.DisplayMenuItems(customizeList, groupBox1.Bottom + 20, this); }