private void bunifuFlatButton6_Click(object sender, EventArgs e) { filt_panel.Visible = false; cat = true; timer1.Start(); flowLayoutPanel3.Controls.Clear(); sectionsnow = Variables.sectionlist; for (int i = 0; i < Variables.sectionlist.Count; i++) { viewsection newsection = new viewsection(); newsection.Section = Variables.sectionlist.ElementAt(i); newsection.name.Text = "Name : " + Variables.sectionlist.ElementAt(i).name; newsection.description.Text = "Description : " + Variables.sectionlist.ElementAt(i).description; if (Variables.sectionlist.ElementAt(i).image != null) { MemoryStream stream = new MemoryStream(Variables.sectionlist.ElementAt(i).image); newsection.image.Image = System.Drawing.Image.FromStream(stream); } flowLayoutPanel3.Controls.Add(newsection); } }
private void searchBox_TextChanged(object sender, EventArgs e) { if (searchBox.Text == "") { bunifuFlatButton2.Click += new EventHandler(bunifuFlatButton2_Click); } else { flowLayoutPanel3.Controls.Clear(); Brandlist.Items.Clear(); sectionlist.Items.Clear(); Colorlist.Items.Clear(); itemsnow.Clear(); sortlist.Text = ""; if (comboBox1.Text == "Item") { filt_panel.Visible = true; flowLayoutPanel3.Controls.Clear(); itemsnow = Items.itemsearch(Variables.brandlist, searchBox.Text); for (int i = 0; i < itemsnow.Count; i++) { Item_UC itemui = new Item_UC(); itemui.item = itemsnow.ElementAt(i); itemui.name.Text = "Name : " + itemsnow.ElementAt(i).name; itemui.price.Text = "Price : " + itemsnow.ElementAt(i).price; itemui.color.Text = "Color : " + itemsnow.ElementAt(i).color; // draw hair // it.image.ImageLocation = Section.itemlist[i].image; if (itemsnow.ElementAt(i).image != null) { MemoryStream stream = new MemoryStream(itemsnow.ElementAt(i).image); itemui.image.Image = System.Drawing.Image.FromStream(stream); } Brand brand = new Brand(); brand = Brand.getbrandbyid(Variables.brandlist, itemsnow.ElementAt(i).brand_id); itemui.brand.Text = "Brand : " + brand.name; if (!Brandlist.Items.Contains(brand.name)) { Brandlist.Items.Add(brand.name); } section sec = new section(); sec = section.getsectionbyid(Variables.sectionlist, itemsnow.ElementAt(i).section_id); if (!sectionlist.Items.Contains(sec.name)) { sectionlist.Items.Add(sec.name); } if (!Colorlist.Items.Contains(itemsnow.ElementAt(i).color)) { Colorlist.Items.Add(itemsnow.ElementAt(i).color); } itemui.descripiton.Text = "Description : " + itemsnow.ElementAt(i).description; flowLayoutPanel3.Controls.Add(itemui); } } else if (comboBox1.Text == "Brand") { filt_panel.Visible = true; flowLayoutPanel3.Controls.Clear(); brandsnow = Brand.brandsearch(Variables.brandlist, searchBox.Text); for (int i = 0; i < brandsnow.Count; i++) { viewbrandsection newbrand = new viewbrandsection(); newbrand.brand = brandsnow.ElementAt(i); if (brandsnow.ElementAt(i).image != null) { MemoryStream stream = new MemoryStream(brandsnow.ElementAt(i).image); newbrand.image.Image = System.Drawing.Image.FromStream(stream); } newbrand.name.Text = "Name : " + brandsnow.ElementAt(i).name; newbrand.phone.Text = "Phone : " + brandsnow.ElementAt(i).phone; newbrand.mail.Text = "Email : " + brandsnow.ElementAt(i).mail; newbrand.description.Text = "Description : " + brandsnow.ElementAt(i).category; newbrand.country.Text = "Country : " + brandsnow.ElementAt(i).country; //newbrand.image.ImageLocation =@"C:\\Users\\nader\\Desktop\\nader.jpg"; flowLayoutPanel3.Controls.Add(newbrand); } } else if (comboBox1.Text == "Section") { filt_panel.Visible = true; flowLayoutPanel3.Controls.Clear(); sectionsnow = section.searchsection(Variables.sectionlist, searchBox.Text); for (int i = 0; i < sectionsnow.Count; i++) { viewsection newsection = new viewsection(); newsection.Section = sectionsnow.ElementAt(i); newsection.name.Text = "Name : " + sectionsnow.ElementAt(i).name; newsection.description.Text = "Description : " + sectionsnow.ElementAt(i).description; if (Variables.sectionlist.ElementAt(i).image != null) { MemoryStream stream = new MemoryStream(sectionsnow.ElementAt(i).image); newsection.image.Image = System.Drawing.Image.FromStream(stream); } flowLayoutPanel3.Controls.Add(newsection); } } } }