private void btnCancel_Click(object sender, EventArgs e) { A1_form refrch = new A1_form(); refrch.button12_Click(sender, e); txtDes.Text = null; txtPrice.Text = null; txtQte.Text = null; txtRef.Text = null; pbox.Image = null; }
private void btnOk_Click(object sender, EventArgs e) { if (state == "add") { if (txtDes.Text == "" || txtRef.Text == "" || txtQte.Text == "" || txtPrice.Text == "") { MessageBox.Show("Entrer Tous Les Information", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { MemoryStream ms = new MemoryStream(); pbox.Image.Save(ms, pbox.Image.RawFormat); byte[] byteImage = ms.ToArray(); prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { byte[] byteImage; byteImage = new byte[0]; prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MemoryStream ms = new MemoryStream(); pbox.Image.Save(ms, pbox.Image.RawFormat); byte[] byteImage = ms.ToArray(); prd.UPDATE_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage); MessageBox.Show("Modifié", " Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } A1_form refrch = new A1_form(); refrch.button12_Click(sender, e); }