internal static List <Reponse> ListMauvaiseReponse(int id, NiveauIds niveau) { List <Reponse> listReponse = new List <Reponse>(); string connStr = Utils.GetConn; using (MySqlConnection conn = new MySqlConnection(connStr)) { string sql = "SELECT * FROM Reponse WHERE r_id != @id and r_niveau = @niveau"; conn.Open(); using (MySqlCommand cmd = new MySqlCommand(sql, conn)) { cmd.Parameters.Add(new MySqlParameter("@id", id)); cmd.Parameters.Add(new MySqlParameter("@niveau", niveau)); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { Reponse reponse = new Reponse(); fill(reponse, dr); listReponse.Add(reponse); } } } } return(listReponse); }
internal static List <Question> ListQuestions(NiveauIds niveau) { List <Question> mesQuestions = new List <Question>(); string connStr = Utils.GetConn; using (MySqlConnection conn = new MySqlConnection(connStr)) { string sql = "SELECT * FROM Question where q_niveau = @niveau"; conn.Open(); using (MySqlCommand cmd = new MySqlCommand(sql, conn)) { cmd.Parameters.Add(new MySqlParameter("@niveau", niveau)); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { Question uneQuestion = new Question(); fill(uneQuestion, dr); mesQuestions.Add(uneQuestion); } } } } return(mesQuestions); }
public Question(int id, string label, NiveauIds niveau, int bonneReponseId, int imageId) { this.id = id; this.label = label; this.niveau = niveau; this.bonneReponseId = bonneReponseId; this.imageId = imageId; }