// OPT00020100219 // Obtenir toutes les Reponse d'une Question public static PollAnswerCollection GetByPollQuestionID(Guid questionID) { DataSet ds = new DataSet(); SqlParameter param = new SqlParameter(); param = new SqlParameter("@QuestionID", SqlDbType.UniqueIdentifier); param.Value = questionID; ds = SqlDataProvider.ExecuteDataset ( Tools.DatabaseConnectionString, CommandType.StoredProcedure, "GetPollAnswerByPollQuestionID", param ); PollAnswerCollection oc = new PollAnswerCollection(); foreach (DataRow r in ds.Tables[0].Rows) { PollAnswer o = PollAnswer.Fill(r); oc.Add(o); } return(oc); }
// Optimisation public PollAnswerCollection FindByPollQuestionID(Guid pollQuestionId) { if (pollQuestionId == Guid.Empty) { return(null); } PollAnswerCollection newpac = new PollAnswerCollection(); foreach (PollAnswer pa in this) { if (pa.PollQuestionId == pollQuestionId) { newpac.Add(pa); } } return(newpac); }
/// <summary> /// SELECT * FROM PollAnswers ORDER BY Rank ASC /// </summary> public static PollAnswerCollection GetAll() { DataSet ds = new DataSet(); ds = SqlDataProvider.ExecuteDataset ( Tools.DatabaseConnectionString, CommandType.StoredProcedure, "GetPollAnswerAll" ); PollAnswerCollection oc = new PollAnswerCollection(); foreach (DataRow r in ds.Tables[0].Rows) { PollAnswer o = PollAnswer.Fill(r); oc.Add(o); } return(oc); }