Example #1
0
        public void AfficherCategorie()
        {
            var CategorieID = this.Request.Params["categoryId"];

            DS = new DataSetEcommerce();
            DS.EnforceConstraints = false;
            PTA = new ProductTableAdapter();

               PTA.FillByCategoryID(DS.Product, Convert.ToInt32(CategorieID));

            StringBuilder SBproduct = new StringBuilder();

            foreach (DataSetEcommerce.ProductRow item in DS.Product)
            {
                PICTA = new Product_Picture_MappingTableAdapter();
                int PictureID1 = PICTA.FillByGetPictureID(DS.Product_Picture_Mapping, item.Id);

                SBproduct.AppendFormat("<section><h1>{0} (Réf: {1})</h1><img src=\"a.imgg?Productid={1}\" alt=\"image du produit {0}\" height=\"150\" width=\"250\"><p>{2}</p><p><input type=\"button\" class=\"btn btn-info\" onclick='RequeteAjax({1})' value=\"Plus d'information\" /><p id=\"fullDescriptionProduit\"></p><p>Prix: {3}<button type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#myModal\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> Dans mon panier</button></p></section><hr/>", item.Name, item.Id, item.ShortDescription, item.Price);
            }

            ProduitsAff.InnerHtml = SBproduct.ToString();
        }
Example #2
0
        private void BtnCategory_Click(object sender, EventArgs e)
        {
            Button btnCategory = sender as Button;

            dataset.Product.Clear();
            ProductTableAdapter pro_adapter = new ProductTableAdapter();

            pro_adapter.Connection = Program.Connection;
            pro_adapter.FillByCategoryID(dataset.Product, Convert.ToInt32(btnCategory.Tag));
            //add to flowlayoutpanel_products
            flowLayoutPanel_Products.Controls.Clear();
            foreach (var pro in dataset.Product)
            {
                UserControl_Product uc_product = new UserControl_Product();
                uc_product.Label_Price.Text               = pro.UnitPrice.ToString();
                uc_product.Label_Product_Name.Text        = pro.Name;
                uc_product.PictureBox_Product_Image.Image = this.ConvertImageFromBytes(pro.Image);

                uc_product.PictureBox_Product_Image.Tag    = pro.ID;
                uc_product.PictureBox_Product_Image.Click += PictureBox_Product_Image_Click;

                flowLayoutPanel_Products.Controls.Add(uc_product);
            }
        }