private void btnSave_Click(object sender, EventArgs e) { try { if (!bln) { medicament.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); clsDoTraitement.EnterFormArticle = true; } else { if (bsrc.DataSource != null) { clsarticle m = (clsarticle)bsrc.Current; new clsarticle().update(m); MessageBox.Show("Modification effectuée!", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("Echec de la mise à jour" + ex.Message, "Mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.New(); refresh(); }
private void New() { try { medicament = new clsarticle(); bln = false; bindingcls(); txtStock.Text = "0"; } catch (Exception) { btnSave.Enabled = false; } }
private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult result = MessageBox.Show("Voulez - vous vraiment supprimer cet enregistrement ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (bsrc.DataSource != null) { clsarticle m = (clsarticle)bsrc.Current; new clsarticle().delete(m); clsDoTraitement.EnterFormArticle = true; MessageBox.Show("Suppression éffectuée", "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Information); this.New(); refresh(); } } } catch (Exception ex) { MessageBox.Show("Echec de la suppression " + ex.Message, "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }