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