예제 #1
0
        public static List <Employe> GetEmployes()
        {
            List <Employe> lstEmployes = new List <Employe>();

            if (ConnexionBD.Instance().EstConnecte())
            {
                string requete = "SELECT c.nom nm, c.prenom prm, numEmploye numEmp, p.nom poste, e.idEmploye id " +
                                 "FROM employes e " +
                                 "INNER JOIN  postes p ON p.idPoste = e.idPoste " +
                                 "INNER JOIN citoyens c ON c.idCitoyen = e.idCitoyen;";
                ConnexionBD.Instance().ExecuterRequete(requete, SqlDR =>
                {
                    lstEmployes.Add(new Employe
                    {
                        idEmploye  = SqlDR.GetInt16("id"),
                        NumEmploye = SqlDR.GetString("numEmp"),
                        Nom        = SqlDR.GetString("nm"),
                        Prenom     = SqlDR.GetString("prm"),
                        Poste      = SqlDR.GetString("poste")
                    });
                });
            }

            /*SELECT c.nom, c.prenom, numEmploye, p.nom
             *      FROM employes e
             *  INNER JOIN  postes p ON p.idPoste = e.idPoste
             *  INNER JOIN citoyens c ON c.idCitoyen = e.idCitoyen;*/

            return(lstEmployes);
        }