private void button7_Click_1(object sender, EventArgs e) { #region Ajout try { //int n_dirige = textBox1.Text; string code_dirige = textBox2.Text; DateTime date_deb = dateTimePicker3.Value; DateTime date_fin = dateTimePicker4.Value; int direct = int.Parse(comboBox5.SelectedItem.ToString()); int direction = int.Parse(comboBox6.SelectedItem.ToString()); Diriger d = new Diriger(code_dirige, date_deb, date_fin, direct, direction); d.Ajouter(); MessageBox.Show("Opération effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion }
private void button6_Click_1(object sender, EventArgs e) { if (MessageBox.Show("Voulez vous vraiment supprimer ce enregistrement ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { #region Suppression try { //int n_dirige = textBox1.Text; string code_dirige = textBox2.Text; Diriger d = new Diriger(); d.Code_dirige = code_dirige; d.Supprimer(); MessageBox.Show("Opération effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion } }