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; }
private void FenetreTest_Load(object sender, EventArgs e) { ModuleServices s = new ModuleServices(); List <Module> list = s.GetModules(); dataGridView1.DataSource = null; dataGridView1.DataSource = list; }
public void SupprLigne(DataGridView dataGridView3) { try { ModuleServices mServ = new ModuleServices(); string intitule = dataGridView3.SelectedCells[0].Value.ToString(); if (mServ.SupprModule(intitule) == true) { MessageBox.Show("Module supprime avec succes"); dataGridView3.DataSource = null; dataGridView3.DataSource = mServ.GetModules(); } else { MessageBox.Show("Erreur lors de la suppression"); } } catch (Exception ex) { MessageBox.Show("Veuillez selectionner la ligne a supprimer"); } }
private void btValider_Click(object sender, EventArgs e) { if (txtDescription.Text.Replace(" ", "") != "" && txtIntitule.Text.Replace(" ", "") != "" && txtNbJour.Text.Replace(" ", "") != "") { ModuleServices f = new ModuleServices(); bool res = f.AjouterModule(txtIntitule.Text, txtDescription.Text, txtNbJour.Text); if (res == true) { MessageBox.Show("Module ajoute avec succes"); } else { MessageBox.Show("Erreur lors de la creation du module"); } Datagrid.DataSource = null; Datagrid.DataSource = f.GetModules(); this.Close(); } else { MessageBox.Show("Veuillez remplir tout les champs"); } }
private void btModifier_Click(object sender, EventArgs e) { if (dataGridView1.Visible == true) // Personne { Personne cible = new PersonneServices().GetPersonneByMail(dataGridView1.SelectedCells[2].Value.ToString()); FenetreModifierPersonne fn = new FenetreModifierPersonne(Personne, cible, dataGridView1); fn.ShowDialog(); } else if (dataGridView2.Visible == true) // Formation { Formation f = new FormationServices().GetFormationByIntitule(dataGridView2.SelectedCells[0].Value.ToString()); FenetreModifierFormation fn = new FenetreModifierFormation(dataGridView2, f); fn.ShowDialog(); } else if (dataGridView3.Visible == true) // Module { Module m = new ModuleServices().GetModuleByIntitule(dataGridView3.SelectedCells[0].Value.ToString()); FenetreAjouterModule fn = new FenetreAjouterModule(dataGridView3, m); fn.ShowDialog(); } else if (dataGridView4.Visible == true) // Session { } }