private void btnAdd_Click(object sender, EventArgs e) { try { MemoryStream ms = new MemoryStream(); picProImage.Image.Save(ms, picProImage.Image.RawFormat); byte[] arr = ms.ToArray(); if (_isupdate == false) { if (txtproductname.Text != "" && txtBuyPrice.Text != "" && txtSellPrice.Text != "") { CLASSPRODUCT.SP_ADDNEWPRODUCT(txtproductname.Text, txtPDescription.Text, arr, txtBuyPrice.Text, txtSellPrice.Text, (int)cmbcatogary.SelectedValue, (int)cmbAMName.SelectedValue, (int)cmbSnName.SelectedValue, txtbarcode.Text); MessageBox.Show("تمت عملية اضافة المنتج بنجاح"); } else { MessageBox.Show("المعلومات المدخلة غير كافية"); return; } // txtbarcode.Text = txtproductname.Text = txtBuyPrice.Text = txtPDescription.Text = txtSellPrice.Text = string.Empty; foreach (Control item in groupBox1.Controls) { if (item is TextBox) { item.Text = string.Empty; } } } else { CLASSPRODUCT.SP_UPDATEPRODUCT(FRM_ProductManagment.id, txtproductname.Text, txtPDescription.Text, arr, txtBuyPrice.Text, txtSellPrice.Text, (int)cmbcatogary.SelectedValue, (int)cmbAMName.SelectedValue, (int)cmbSnName.SelectedValue, txtbarcode.Text); MessageBox.Show("تمت عملية تعديل بيانات المنتج بنجاح"); } } catch (Exception ex) { MessageBox.Show("البيانات المدخلة غير كافية"); } }