예제 #1
0
파일: Dao.cs 프로젝트: Gustou91/competition
        public Boolean updateMembre(Membre membre)
        {
            openBase();

            string sql = "UPDATE membre SET mem_nom = '" + membre.getNom() + "', mem_prenom = '" + membre.getPrenom()
                         + "', mem_sexe = '" + membre.getSexe() + "', mem_age = " + membre.getAge().ToString()
                         + ", mem_poids = " + membre.getPoids().ToString() + ", mem_club = " + membre.getClub() + ", mem_modification = DATETIME('NOW')"
                         + " WHERE mem_id = " + membre.getId();

            logger.Info("updateMembre: requête = " + sql);

            using (SQLiteCommand cmd = new SQLiteCommand(sql, _dbConnection))
            {
                cmd.ExecuteNonQuery();
            }
            closeBase();

            return(true);
        }
예제 #2
0
파일: Dao.cs 프로젝트: Gustou91/competition
        public Boolean insertMembre(Membre mbr)
        {
            Membre membre = getMembre(mbr.getId());

            if (membre.getNom() == null)
            {
                openBase();

                // Insertion de le nouveau membre.
                string sql = "INSERT INTO membre (mem_nom, mem_prenom, mem_sexe, mem_age, mem_poids, mem_club, mem_creation)"
                             + "values ('" + mbr.getNom() + "', '" + mbr.getPrenom() + "', '" + mbr.getSexe()
                             + "', " + mbr.getAge().ToString() + ", " + mbr.getPoids().ToString() + ", " + mbr.getClub() + ", DATETIME('NOW'))";
                logger.Info("insertMembre: requête = " + sql);

                using (SQLiteCommand cmd = new SQLiteCommand(sql, _dbConnection))
                {
                    cmd.ExecuteNonQuery();
                }


                closeBase();
            }
            else
            {
                updateMembre(mbr);
            }

            return(true);
        }