private void button2_Click(object sender, EventArgs e) { Products_DATA Product = new Products_DATA(); Product.Label_product = description.Text; Product.Qte_in_product = quantity.Text; Product.Price = price.Text; MemoryStream memory = new MemoryStream(); pictureBox1.Image.Save(memory, pictureBox1.Image.RawFormat); byte[] byte_image = memory.ToArray(); Product.Image = byte_image; Product.Id = Id; int x = Convert.ToInt16(comboBox1.SelectedValue); Categories_DATA c = new Categories_DATA(); c.Id = x; Product.Category = c; Products_BLL.Update_Product(Product); DataTable table = new DataTable(); List <Products_DATA> list = Products_DAL.Select_ALL_Product(); table.Columns.Add("Id"); table.Columns.Add("اسم المنتج"); table.Columns.Add("سعر المنتج"); table.Columns.Add("كمية المنتج"); table.Columns.Add("نوع المنتج"); table.Columns.Add("Category_ID"); table.Columns.Add("image", typeof(byte[])); foreach (var item in list) { table.Rows.Add(item.Id, item.Label_product, item.Price, item.Qte_in_product, item.Category.Description, item.Category.Id, item.Image); } form_product.DataGridView1.DataSource = table; form_product.DataGridView1.Columns[0].Visible = false; form_product.DataGridView1.Columns[5].Visible = false; form_product.DataGridView1.Columns[6].Visible = false; }
private void crystalReportViewer1_Load(object sender, EventArgs e) { Products_BLL.Select_Item_Product(Product); }