public Fen_GestionEmploye(Personne unePersonne, int choixBtn) { InitializeComponent(); this.unePersonne = unePersonne; this.choixBtn = choixBtn; }
public void setUnEmploye(Personne unEmploye) { this.unEmploye = unEmploye; }
public static List <Enfant> EnfantsDeEmploye(int idEmploye) { seConnecter(); List <Enfant> lesEnfants = new List <Enfant>(); SqlCommand maCommande; string requeteIdentifiant = "SELECT E.id, E.nom, E.prenom ,E.age, E.idJouet, E.idEmploye, " //enfant + "P.nom as empNom, P.prenom as empPrenom, P.numAdr, P.rue, P.ville, P.cp, P.mail, P.mdp, P.estResponsable, P.aValide, " //employé + "J.libelle, J.idCategorie, J.idTrancheAge, " //jouet + "T.ageMin, " //tranche age + "C.libelle " //catégorie + "FROM Enfant E JOIN Employe P ON (E.idEmploye=P.id) JOIN Jouet J ON(E.idJouet=J.id) " + "JOIN Categorie C on C.id = J.idCategorie JOIN TrancheAge T on T.id = J.idTrancheAge " + "WHERE idEmploye =" + idEmploye; // recupere les informations maCommande = new SqlCommand(requeteIdentifiant, laConnexion); SqlDataReader Resultat = maCommande.ExecuteReader(); while (Resultat.Read()) //Parcours le resultat { //données enfant int pIdE = (int)Resultat["id"]; string pNom = (string)Resultat["nom"]; string pPrenom = (string)Resultat["prenom"]; int pAge = (int)Resultat["age"]; int pIdJ = (int)Resultat["idJouet"]; int pIdEm = (int)Resultat["idEmploye"]; //données employé string pNomEm = (string)Resultat["empNom"]; string pPrenomEm = (string)Resultat["empPrenom"]; string pnumAdre = (string)Resultat["numAdr"]; string pRue = (string)Resultat["rue"]; string pVille = (string)Resultat["ville"]; string pCp = (string)Resultat["cp"]; string pMail = (string)Resultat["mail"]; string pMdp = (string)Resultat["mdp"]; bool pEstRes = (bool)Resultat["estResponsable"]; bool pEstValide = (bool)Resultat["aValide"]; //données jouet string pLibelleJ = (string)Resultat["libelle"]; int pIdCat = (int)Resultat["idCategorie"]; int pIdTrancheAge = (int)Resultat["idTrancheAge"]; //données tranche age int pAgeMin = (int)Resultat["ageMin"]; //données catégorie string pLibelleCat = (string)Resultat["libelle"]; Personne unePersonne = new Personne(pIdEm, pNomEm, pPrenomEm, pnumAdre, pRue, pVille, pCp, pMail, pMdp, pEstRes, pEstValide); Categorie uneCat = new Categorie(pIdCat, pLibelleCat); TrancheAge uneTrancheAge = new TrancheAge(pIdTrancheAge, pAgeMin); Jouet unJouet = new Jouet(pIdJ, pLibelleJ, uneCat, uneTrancheAge); Enfant unEnfant = new Enfant(pIdE, pNom, pPrenom, pAge, unePersonne, unJouet); lesEnfants.Add(unEnfant); } Resultat.Close(); return(lesEnfants); }