private void btnDelete_Click(object sender, EventArgs e) { if (txtIMGid.Text.Equals("")) { picImage.Image = null; } else { if (ss.Equals("ShowQManag")) { int delImage = ClassQute.deleteQuteImg(int.Parse(txtIMGid.Text)); dt = ClassQute.selectimgforQute(DocID); MessageBox.Show("Done . ."); txtIMGid.Text = ""; picImage.Image = null; } else if (ss.Equals("ShowOManag")) { int delImage = ClassOrder.deleteImgForOrder(int.Parse(txtIMGid.Text)); dt = ClassOrder.selectImgOrder(DocID); MessageBox.Show("Done . ."); txtIMGid.Text = ""; picImage.Image = null; } } numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); }
public FRM_ShowImage(int id, string s) { InitializeComponent(); DocID = id; ss = s; if (s.Equals("ShowQ")) { btnSave.Visible = btnDelete.Visible = btnSelectOne.Visible = btnExport.Visible = btnPrint.Visible = false; dt = ClassQute.selectimgforQute(DocID); } if (s.Equals("ShowO")) { btnSave.Visible = btnDelete.Visible = btnSelectOne.Visible = btnExport.Visible = btnPrint.Visible = false; dt = ClassOrder.selectImgOrder(DocID); } if (s.Equals("ShowQManag")) { dt = ClassQute.selectimgforQute(DocID); } if (s.Equals("ShowOManag")) { dt = ClassOrder.selectImgOrder(DocID); } 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) { } }
private void btnSave_Click(object sender, EventArgs e) { if (ss.Equals("ShowQManag")) { try { if (txtIMGid.Text.Equals("") && picImage.Image != null) { int addIMG = ClassQute.AddImgQute(arr, DocID); dt = ClassQute.selectimgforQute(DocID); MessageBox.Show("Done . ."); numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); } } catch (Exception) { } } else if (ss.Equals("ShowOManag")) { try { if (txtIMGid.Text.Equals("") && picImage.Image != null) { int addIMG = ClassOrder.AddImageOrder(arr, DocID); dt = ClassOrder.selectImgOrder(DocID); MessageBox.Show("Done . ."); numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); } } catch (Exception) { } } }