예제 #1
0
        public List <Partenaire> listePartenaire()
        {
            List <Partenaire> lesPartenaires = new List <Partenaire>();

            DAOFactory db = new DAOFactory();

            db.connecter();

            String        req    = "select * from partenaires;";
            SqlDataReader reader = db.excecSQLRead(req);



            while (reader.Read())
            {
                Partenaire P = new Partenaire(

                    id: int.Parse(reader[0].ToString()),
                    nom: reader[1].ToString(),
                    typePartenaire: int.Parse(reader[2].ToString()));

                lesPartenaires.Add(P);
            }

            return(lesPartenaires);
        }
예제 #2
0
        public void AjouterPartenaire(Partenaire unPartenaire)
        {
            String req = "INSERT INTO partenaires values ( '"
                         + unPartenaire.Nom + "' , '"
                         + unPartenaire.TypePartenaire + "' );";

            DAOFactory daoAddPartenaire = new DAOFactory();

            daoAddPartenaire.connecter();
            daoAddPartenaire.excecSQLRead(req);
        }