private void button_Supprimer_Click(object sender, EventArgs e) { int empId = Convert.ToInt32(textBoxNoID.Text); Employes emp = new Employes(); emp.NoIdentifiant = empId; emp.DeleteEmploye(emp); MessageBox.Show("Etes-vous sur de vouloir supprimer cet employé ?", "Suppression d'employé", MessageBoxButtons.YesNo, MessageBoxIcon.Question); }
private void button_Modifier_Click(object sender, EventArgs e) { int empId = Convert.ToInt32(textBoxNoID.Text); string mdp = textBoxMDP.Text; string empPrenom = textBox_prenom.Text; string empNom = textBox_nom.Text; string fonction = comboBox_Categorie.Text; Employes emp = new Employes(); emp.NoIdentifiant = empId; emp.MPasse = mdp; emp.PrenomAdmin = empPrenom; emp.NomUtil = empNom; emp.Categorie = fonction; emp.modifyData(emp); }
private void button_Afficher_Click(object sender, EventArgs e) { listView1.Items.Clear(); Employes emp = new Employes(); List <Employes> listEmp = emp.ListeEmployee(); foreach (Employes em in listEmp) { ListViewItem item = new ListViewItem(em.NoIdentifiant.ToString()); item.SubItems.Add(em.MPasse); item.SubItems.Add(em.NomUtil); item.SubItems.Add(em.PrenomAdmin); item.SubItems.Add(em.Categorie); listView1.Items.Add(item); } }
private void button_Ajouter_Click(object sender, EventArgs e) { int empId = Convert.ToInt32(textBoxNoID.Text); string mdp = textBoxMDP.Text; string empPrenom = textBox_prenom.Text; string empNom = textBox_nom.Text; string fonction = comboBox_Categorie.Text; Employes emp = new Employes(); emp.NoIdentifiant = empId; emp.MPasse = mdp; emp.PrenomAdmin = empPrenom; emp.NomUtil = empNom; emp.Categorie = fonction; try { emp.SaveEmploye(emp); MessageBox.Show("Employé ajouté"); } catch (Exception) { MessageBox.Show("Employé déjà existé"); } }
public bool modifyData(Employes emp) { return(EmployesBD.modifyData(emp)); }
public bool DeleteEmploye(Employes emp) { return(EmployesBD.DeleteData(emp)); }
public bool SaveEmploye(Employes emp) { return(EmployesBD.InsertData(emp)); }
private void button_Rechercher_Click(object sender, EventArgs e) { if (radioButtonId.Checked == true) { //recherche avec ID listView1.Items.Clear(); Employes emp = new Employes(); int empId = Convert.ToInt32(textBoxNoID.Text); emp = emp.rechercheParId(empId); ListViewItem item = new ListViewItem(emp.NoIdentifiant.ToString()); item.SubItems.Add(emp.MPasse); item.SubItems.Add(emp.NomUtil); item.SubItems.Add(emp.PrenomAdmin); item.SubItems.Add(emp.Categorie); listView1.Items.Add(item); } else if (radioButtonNom.Checked == true) { listView1.Items.Clear(); Employes emp = new Employes(); string nom = textBox_nom.Text; List <Employes> listEmp = emp.rechercheParNom(nom); foreach (Employes em in listEmp) { ListViewItem item = new ListViewItem(em.NoIdentifiant.ToString()); item.SubItems.Add(em.MPasse); item.SubItems.Add(em.NomUtil); item.SubItems.Add(em.PrenomAdmin); item.SubItems.Add(em.Categorie); listView1.Items.Add(item); } } else if (radioButtonPren.Checked == true) { listView1.Items.Clear(); Employes emp = new Employes(); string prenom = textBox_prenom.Text; List <Employes> listEmp = emp.rechercheParPrenom(prenom); foreach (Employes em in listEmp) { ListViewItem item = new ListViewItem(em.NoIdentifiant.ToString()); item.SubItems.Add(em.MPasse); item.SubItems.Add(em.NomUtil); item.SubItems.Add(em.PrenomAdmin); item.SubItems.Add(em.Categorie); listView1.Items.Add(item); } } else if (radioButtonCateg.Checked == true) { listView1.Items.Clear(); Employes emp = new Employes(); string fonction = comboBox_Categorie.Text; List <Employes> listEmp = emp.rechercheParFonction(comboBox_Categorie.Text); foreach (Employes em in listEmp) { ListViewItem item = new ListViewItem(em.NoIdentifiant.ToString()); item.SubItems.Add(em.MPasse); item.SubItems.Add(em.NomUtil); item.SubItems.Add(em.PrenomAdmin); item.SubItems.Add(em.Categorie); listView1.Items.Add(item); } } else if (radioButtonNomPrenom.Checked == true) { listView1.Items.Clear(); Employes emp = new Employes(); string nom = textBox_nom.Text; string prenom = textBox_prenom.Text; List <Employes> listEmp = emp.rechercheParNomPrenom(nom, prenom); foreach (Employes em in listEmp) { ListViewItem item = new ListViewItem(em.NoIdentifiant.ToString()); item.SubItems.Add(em.MPasse); item.SubItems.Add(em.NomUtil); item.SubItems.Add(em.PrenomAdmin); item.SubItems.Add(em.Categorie); listView1.Items.Add(item); } } }