private void btnSave_Click(object sender, EventArgs e) { try { if (!bln) { attSpec.inserts(); MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (bsrc.DataSource != null) { clsattention_speciale s = (clsattention_speciale)bsrc.Current; new clsattention_speciale().update(s); MessageBox.Show("Modification effectuée!", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information); } } clsDoTraitement.EnterFormAttentionSpeciale = true; } catch (Exception ex) { MessageBox.Show("Echec de la mise à jour" + ex.Message, "Mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void New() { attSpec = new clsattention_speciale(); bln = false; bindingcls(); txtIdEnfant.Text = clsDoTraitement.IdEnfant.ToString(); if (cboAttention.Items.Count > 0) { cboAttention.SelectedIndex = 0; } }
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) { clsattention_speciale d = (clsattention_speciale)bsrc.Current; new clsattention_speciale().delete(d); MessageBox.Show("Suppression éffectuée", "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Information); clsDoTraitement.EnterFormAttentionSpeciale = true; //this.New(); //refresh(); } } } catch (Exception ex) { MessageBox.Show("Echec de la suppression " + ex.Message, "Suppression", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }