public void chargerDatesEvenement() { bindingSource1 = new BindingSource(); Controleur.Vmodele.charger_datejoachEvenement(); if (Controleur.Vmodele.DTdatejoachEvenement.Rows.Count == 0) { DateTime d = new DateTime(); d = DateTime.Now; Controleur.ajouterDate(d, false, false); } Controleur.Vmodele.charger_datejoachEvenement(); bindingSource1.DataSource = Controleur.Vmodele.DTdatejoachEvenement; dataGridView1.DataSource = bindingSource1; dataGridView1.Columns["IDD"].Visible = false; dataGridView1.Columns["DATEEVENEMENT"].HeaderText = "Date"; dataGridView1.Columns["ESTINSCRITPROF"].Visible = false; dataGridView1.Columns["ESTINSCRITELEVE"].Visible = false; dataGridView1.Columns["MATIN"].HeaderText = "Matin"; dataGridView1.Columns["APRESMIDI"].HeaderText = "Après-Midi"; }
private void BtnValiderDatesInscrit_Click(object sender, EventArgs e) { Controleur.Vmodele.charger_datejoachInscriptions(); bool existeProf = false; bool existeEleve = false; if (Controleur.Vmodele.DTdatejoachInscriptions.Rows.Count != 0) { for (int i = 0; i < Controleur.Vmodele.DTdatejoachInscriptions.Rows.Count; i++) { if (Convert.ToBoolean(Controleur.Vmodele.DTdatejoachInscriptions.Rows[i]["ESTINSCRITPROF"]) == true) { Controleur.Vmodele.DTdatejoachInscriptions.Rows[i]["DATEEVENEMENT"] = dateTimePickerInscriptionProf.Value; existeProf = true; } if (Convert.ToBoolean(Controleur.Vmodele.DTdatejoachInscriptions.Rows[i]["ESTINSCRITELEVE"]) == true) { Controleur.Vmodele.DTdatejoachInscriptions.Rows[i]["DATEEVENEMENT"] = dateTimePickerInscriptionEleve.Value; existeEleve = true; } } } if (existeProf == false) { Controleur.ajouterDate(dateTimePickerInscriptionProf.Value, true, false); } btnSupprDateProf.Enabled = true; if (existeEleve == false) { Controleur.ajouterDate(dateTimePickerInscriptionEleve.Value, false, true); } btnSupprDateEleve.Enabled = true; MessageBox.Show("Dates enregistrées"); }