// 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); }
public static PollAnswer GetByPollAnswerID(Guid pollAnswerID) { if (pollAnswerID == Guid.Empty) { return(null); } PollAnswerCollection pac = PollAnswerCollection.GetAll(); foreach (PollAnswer pa in pac) { if (pa.PollAnswerId == pollAnswerID) { return(pa); } } return(null); }
// 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); }
public static PollAnswerCollection GetByPollQuestionID(Guid pollQuestionId) { if (pollQuestionId == Guid.Empty) { return(null); } //PollAnswerCollection pac = PollAnswerCollection.GetAll(); //PollAnswerCollection newpac = new PollAnswerCollection(); //foreach ( PollAnswer pa in pac ) //{ // if ( pa.PollQuestionId == pollQuestionId ) // { // newpac.Add( pa ); // } //} // OPT00020100219 PollAnswerCollection newpac = PollAnswerDAL.GetByPollQuestionID(pollQuestionId); return(newpac); }