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 btValider_Click(object sender, EventArgs e) { FormationServices fServ = new FormationServices(); bool res = fServ.ModifierFormation(Formation.Intitule, txtIntitule.Text, txtDescription.Text); Datagrid.DataSource = null; Datagrid.DataSource = fServ.GetFormations(); this.Close(); }
public void SupprLigne(DataGridView dataGridView2) { try { FormationServices fServ = new FormationServices(); string intitule = dataGridView2.SelectedCells[0].Value.ToString(); if (fServ.SupprFormation(intitule) == true) { MessageBox.Show("Formation supprimee avec succes"); dataGridView2.DataSource = null; dataGridView2.DataSource = fServ.GetFormations(); } 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(" ", "") != "") { FormationServices f = new FormationServices(); bool res = f.AjouterFormation(txtIntitule.Text, txtDescription.Text); if (res == true) { MessageBox.Show("Formation ajoutee avec succes"); } else { MessageBox.Show("Erreur lors de la creation de la formation"); } Datagrid.DataSource = null; Datagrid.DataSource = f.GetFormations(); this.Close(); } else { MessageBox.Show("Veuillez remplir tout les champs"); } }