private void Btn_Supprimer_Click(object sender, EventArgs e) { DataRowView currentDataRowView = (DataRowView)Dgv_Enseignant.CurrentRow.DataBoundItem; DAL_Enseignant.DeleteEnseignant(DAL_Enseignant.GetEnseignantByEmail(currentDataRowView.Row[1].ToString())); Dgv_Enseignant.DataSource = DAL_Enseignant.GetAllEnseignantsDataTable(); if (DAL_Enseignant.GetAllEnseignantsDataTable().Rows.Count == 0) { Btn_Supprimer.Enabled = false; Btn_Modifier.Enabled = false; } MessageBox.Show("Suppression réuissie", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void Btn_Supprimer_Click(object sender, EventArgs e) { DataRowView currentDataRowView = (DataRowView)Dgv_Enseignant.CurrentRow.DataBoundItem; DialogResult Result = MessageBox.Show("Voulez vous supprimer?", "Confirmation de suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (Result == DialogResult.Yes) { Dal_Ens.DeleteEnseignant(Dal_Ens.GetEnseignantByEmail(currentDataRowView.Row[2].ToString())); fillDgvEns(); if (Dal_Ens.GetAllEnseignantsDataTable().Rows.Count == 0) { Btn_Supprimer.Enabled = false; Btn_Modifier.Enabled = false; } MessageBox.Show("Suppression réuissie", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }