public Core.Business.StimulationCriterionQuestion Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectStimulationCriterionQuestion"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.StimulationCriterionQuestion stimulationCriterionQuestion = new Core.Business.StimulationCriterionQuestion(); if (!reader.IsDBNull(0)) stimulationCriterionQuestion.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) stimulationCriterionQuestion.Content = reader.GetString(1); if (!reader.IsDBNull(2)) stimulationCriterionQuestion.StimulationContentType = reader.GetInt32(2); if (!reader.IsDBNull(3)) stimulationCriterionQuestion.Index = reader.GetInt32(3); reader.Close(); return stimulationCriterionQuestion; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.StimulationCriterionQuestion> GetAllStimulationCriterionQuestion() { IList<Core.Business.StimulationCriterionQuestion> stimulationCriterionQuestionlist = new List<Core.Business.StimulationCriterionQuestion>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectStimulationCriterionQuestionsAll"); if(reader != null) { while(reader.Read()) { Core.Business.StimulationCriterionQuestion stimulationCriterionQuestion = new Core.Business.StimulationCriterionQuestion(); if (!reader.IsDBNull(0)) stimulationCriterionQuestion.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) stimulationCriterionQuestion.Content = reader.GetString(1); if (!reader.IsDBNull(2)) stimulationCriterionQuestion.StimulationContentType = reader.GetInt32(2); if (!reader.IsDBNull(3)) stimulationCriterionQuestion.Index = reader.GetInt32(3); stimulationCriterionQuestion.MarkOld(); stimulationCriterionQuestionlist.Add(stimulationCriterionQuestion); } reader.Close(); } return stimulationCriterionQuestionlist; }