private void btnSave_Click(object sender, EventArgs e) { try { if (txtIMGid.Text.Equals("") && picImage.Image != null) { int addIMG = ClassProduct.insertIMG(arr, int.Parse(ProID)); dt = ClassManagmentReport.displayAllIMGForPro(int.Parse(ProID)); MessageBox.Show("Done . ."); numOfImag = dt.Rows.Count; btnFirstIMG_Click(null, null); } } catch (Exception) { } }
private void btnSave_Click(object sender, EventArgs e) { btnSave.Enabled = false; int found = 0; if (txtname.Text.Equals("")) { MessageBox.Show("Please Insert Product Name ! "); } else { DataTable ProName = ClassProduct.selectOnePro(txtbarcode.Text); if (ProName.Rows.Count > 0) { found = 1; MessageBox.Show("This Product or Barcode Already Exist . ."); } if (found == 0) { int product = ClassProduct.insertPro(txtname.Text, txtbarcode.Text, txtCategory.Text, txtCountry.Text, txtcity.Text, txtCompany.Text, "0", "0", "0", rtxtdiscrp.Text, rtxtnote.Text); if (NumOfImage > 0) { DataTable LastOne = ClassProduct.LastPro(); for (int i = 0; i < images.Count; i++) { int AddImg = ClassProduct.insertIMG(images[i], int.Parse(LastOne.Rows[0][0].ToString())); } } txtname.Text = txtbarcode.Text = txtCategory.Text = txtCountry.Text = txtcity.Text = txtCompany.Text = rtxtdiscrp.Text = rtxtnote.Text = ""; lbNumIMG.Text = "0"; NumOfImage = 0; images.Clear(); MessageBox.Show("Done. ."); } } btnSave.Enabled = true; }