private void FenetreAccueil_Load(object sender, EventArgs e) { // Remplie le dataGrid avec les Personnes PersonneServices pServices = new PersonneServices(); List <Personne> p = pServices.GetPersonnes(); dataGridView1.DataSource = null; dataGridView1.DataSource = p; FormationServices fServices = new FormationServices(); List <Formation> l = fServices.GetFormations(); dataGridView2.DataSource = null; dataGridView2.DataSource = l; ModuleServices mServices = new ModuleServices(); List <Module> m = mServices.GetModules(); dataGridView3.DataSource = null; dataGridView3.DataSource = m; SessionServices sServices = new SessionServices(); List <Session> s = sServices.GetSessions(); dataGridView4.DataSource = null; dataGridView4.DataSource = s; dataGridView2.Visible = false; dataGridView3.Visible = false; dataGridView4.Visible = false; //Remplie le label de Bienvenue lbBienvenue.Text = lbBienvenue.Text + " " + Personne.Civilite + " " + Personne.Nom + " " + Personne.Prenom; }
public void SupprLigne(DataGridView dataGridView4) { try { SessionServices sServ = new SessionServices(); int id = int.Parse(dataGridView4.SelectedCells[0].Value.ToString()); if (sServ.SupprSession(id) == true) { MessageBox.Show("Module supprime avec succes"); dataGridView4.DataSource = null; dataGridView4.DataSource = sServ.GetSessions(); } else { MessageBox.Show("Erreur lors de la suppression"); } } catch (Exception ex) { MessageBox.Show("Veuillez selectionner la ligne a supprimer"); } }