public FRM_ProductImageView(string s) { InitializeComponent(); ProID = s; dt = ClassSetting.SelectImageOnePro(int.Parse(s)); numOfImag = dt.Rows.Count; try { txtIMGid.Text = dt.Rows[0][0].ToString(); byte[] arr = (byte[])(dt.Rows[0][1]); MemoryStream ms = new MemoryStream(arr); picImage.Image = Image.FromStream(ms); } catch (Exception) { MessageBox.Show("No Image Found !!!"); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtIMGid.Text.Equals("") && picImage.Image != null) { int addIMG = ClassSetting.sp_imgageProduct(arr, int.Parse(ProID)); dt = ClassSetting.SelectImageOnePro(int.Parse(ProID)); MessageBox.Show("Done . ."); numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); } } catch (Exception) { } }
private void btnDelete_Click(object sender, EventArgs e) { if (txtIMGid.Text.Equals("")) { picImage.Image = null; } else { int delImage = ClassSetting.deleteProImage(int.Parse(txtIMGid.Text)); dt = ClassSetting.SelectImageOnePro(int.Parse(ProID)); MessageBox.Show("Done . ."); txtIMGid.Text = ""; picImage.Image = null; } numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); }