private void sortlist_SelectedValueChanged(object sender, EventArgs e)
        {
            //   itemsnow = Items.itemsearch(Variables.brandlist, searchBox.Text);
            if (sortlist.Text == "Name")
            {
                List <Items> tmp = new List <Items>(itemsnow);
                Items        it  = new Items();
                it.sortbyname(tmp);
                itemsnow = new LinkedList <Items>(tmp);
            }
            else if (sortlist.Text == "Price")
            {
                List <Items> tmp = new List <Items>(itemsnow);
                Items        it  = new Items();
                it.sortbyprice(tmp);
                itemsnow = new LinkedList <Items>(tmp);
            }

            flowLayoutPanel3.Controls.Clear();


            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(Variables.brandlist.ElementAt(i).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);
            }
        }
        private void ViewBtn_Click(object sender, EventArgs e)
        {
            //here
            Home hom;

            hom = (Home)this.FindForm();
            hom.filt_panel.Visible = true;
            Form1.home.flowLayoutPanel3.Controls.Clear();
            Form1.home.Brandlist.Items.Clear();
            Form1.home.sectionlist.Items.Clear();
            Form1.home.Colorlist.Items.Clear();
            Form1.home.itemsnow.Clear();
            for (int i = 0; i < Variables.brandlist.Count; i++)
            {
                for (int j = 0; j < Variables.brandlist.ElementAt(i).itemlist.Count; j++)
                {
                    if (Variables.brandlist.ElementAt(i).itemlist[j].section_id == Section.id)
                    {
                        Item_UC it = new Item_UC();
                        it.item       = Variables.brandlist.ElementAt(i).itemlist[j];
                        it.name.Text  = "Name : " + Variables.brandlist.ElementAt(i).itemlist[j].name;
                        it.price.Text = "Price : " + Variables.brandlist.ElementAt(i).itemlist[j].price;
                        it.color.Text = "Color : " + Variables.brandlist.ElementAt(i).itemlist[j].color;
                        // draw hair
                        // it.image.ImageLocation = Section.itemlist[i].image;
                        if (Variables.brandlist.ElementAt(i).itemlist[j].image != null)
                        {
                            MemoryStream stream = new MemoryStream(Variables.brandlist.ElementAt(i).itemlist[j].image);
                            it.image.Image = System.Drawing.Image.FromStream(stream);
                        }
                        //here
                        it.brand.Text       = "Brand : " + Variables.brandlist.ElementAt(i).name;
                        it.descripiton.Text = "Description : " + Variables.brandlist.ElementAt(i).itemlist[j].description;
                        Form1.home.itemsnow.AddLast(Variables.brandlist.ElementAt(i).itemlist[j]);
                        Form1.home.flowLayoutPanel3.Controls.Add(it);
                        if (!Form1.home.Colorlist.Items.Contains(Variables.brandlist.ElementAt(i).itemlist[j].color))
                        {
                            Form1.home.Colorlist.Items.Add(Variables.brandlist.ElementAt(i).itemlist[j].color);
                        }
                        if (!Form1.home.Brandlist.Items.Contains(Variables.brandlist.ElementAt(i).name))
                        {
                            Form1.home.Brandlist.Items.Add(Variables.brandlist.ElementAt(i).name);
                        }
                    }
                }
            }
            Form1.home.sectionlist.Items.Add(Section.name);
        }
示例#3
0
 private void view_btn_Click(object sender, EventArgs e)
 {
     //here
     Form1.home.flowLayoutPanel3.Controls.Clear();
     for (int i = 0; i < brand.itemlist.Count; i++)
     {
         Item_UC it = new Item_UC();
         it.item                = brand.itemlist[i];
         it.name.Text           = "Name : " + brand.itemlist[i].name;
         it.price.Text          = "Price : " + brand.itemlist[i].price;
         it.color.Text          = "Color : " + brand.itemlist[i].color;
         it.image.ImageLocation = @"C:\\Users\\nader\\Desktop\\nader.jpg";
         it.brand.Text          = "Brand : " + brand.name;
         it.descripiton.Text    = "Description : " + brand.itemlist[i].description;
         Form1.home.flowLayoutPanel3.Controls.Add(it);
     }
 }
示例#4
0
        private void ViewBtn_Click(object sender, EventArgs e)
        {
            //here

            Home hom;

            hom = (Home)this.FindForm();
            hom.filt_panel.Visible = true;
            Form1.home.flowLayoutPanel3.Controls.Clear();
            Form1.home.itemsnow.Clear();
            Form1.home.Colorlist.Items.Clear();
            Form1.home.Brandlist.Items.Clear();
            Form1.home.sectionlist.Items.Clear();
            for (int i = 0; i < brand.itemlist.Count; i++)
            {
                Item_UC it = new Item_UC();
                it.item       = brand.itemlist[i];
                it.name.Text  = "Name : " + brand.itemlist[i].name;
                it.price.Text = "Price : " + brand.itemlist[i].price;
                it.color.Text = "Color : " + brand.itemlist[i].color;
                //draw hair
                // it.image = brand.itemlist[i].image;
                if (brand.itemlist[i].image != null)
                {
                    MemoryStream stream = new MemoryStream(brand.itemlist[i].image);
                    it.image.Image = System.Drawing.Image.FromStream(stream);
                }
                it.brand.Text       = "Brand : " + brand.name;
                it.descripiton.Text = "Description : " + brand.itemlist[i].description;
                Form1.home.itemsnow.AddLast(brand.itemlist[i]);
                Form1.home.flowLayoutPanel3.Controls.Add(it);
                if (!Form1.home.Colorlist.Items.Contains(brand.itemlist[i].color))
                {
                    Form1.home.Colorlist.Items.Add(brand.itemlist[i].color);
                }
                section sec = section.getsectionbyid(Variables.sectionlist, brand.itemlist[i].section_id);
                if (!Form1.home.sectionlist.Items.Contains(sec.name))
                {
                    Form1.home.sectionlist.Items.Add(sec.name);
                }
            }
            Form1.home.Brandlist.Items.Add(brand.name);
        }
        private void min_txt_TextChanged(object sender, EventArgs e)
        {
            //here edit!!!!!
            int max = 0, min = 0;


            if (min_txt.Text == "")
            {
                min = 0;
            }
            else
            {
                min = Convert.ToInt32(min_txt.Text);
            }

            if (max_txt.Text == "")
            {
                max = min;
            }
            else
            {
                max = Convert.ToInt32(max_txt.Text);
            }
            itemsnow = Items.itemsearch(Variables.brandlist, searchBox.Text);
            itemsnow = Items.filterprice(itemsnow, min, max);
            flowLayoutPanel3.Controls.Clear();


            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(Variables.brandlist.ElementAt(i).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);
            }
        }
        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);
                    }
                }
            }
        }