// RECUPERATION RESULTAT BDD POUR RESULTAT SONDAGE !!!!!!! public static Resultat RecupererResultatEnBdd(int idSondage) { using (SqlConnection connection = new SqlConnection(ConnectString)) { connection.Open(); SqlCommand command = new SqlCommand(@"SELECT * FROM Sondage,Resultat WHERE ID = @id and FK_Id_sondage = @id", connection); command.Parameters.AddWithValue("@id", idSondage); SqlDataReader reader = command.ExecuteReader(); reader.Read(); int idsondage = (int)reader["ID"]; string question = (string)reader["Questions"]; string reponse1 = (string)reader["Reponse1"]; string reponse2 = (string)reader["Reponse2"]; string reponse3 = (string)reader["Reponse3"]; bool choix = (bool)reader["Choix"]; bool actifOuPas = (bool)reader["ActiveSondage"]; int nbreRep1 = (int)reader["NbreVoteReponse1"]; int nbrevoterep2 = (int)reader["NbreVoteReponse2"]; int nbrevoteRep3 = (int)reader["NbreVoteReponse3"]; int nombreDeVotant = (int)reader["NbreVotant"]; int fk_id_sondage = (int)reader["FK_Id_sondage"]; Sondage sondage = new Sondage(idsondage, question, reponse1, reponse2, reponse3, choix, actifOuPas); Resultat resultat = new Resultat(sondage, nbreRep1, nbrevoterep2, nbrevoteRep3, nombreDeVotant, fk_id_sondage); return(resultat); } }
public ResultatVote(Sondage resultatVoteSondage, Resultat resultatVoteResultat) { ResultatVoteSondage = resultatVoteSondage; ResultatVoteResultat = resultatVoteResultat; }