public IList<Core.Business.VoteAnswerTemplate> GetAllVoteAnswerTemplate() { IList<Core.Business.VoteAnswerTemplate> voteAnswerTemplatelist = new List<Core.Business.VoteAnswerTemplate>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllVoteAnswerTemplate); if(reader != null) { while(reader.Read()) { Core.Business.VoteAnswerTemplate voteAnswerTemplate = new Core.Business.VoteAnswerTemplate(); if (!reader.IsDBNull(0)) voteAnswerTemplate.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteAnswerTemplate.VoteAnswerContent = reader.GetString(1); voteAnswerTemplate.MarkOld(); voteAnswerTemplatelist.Add(voteAnswerTemplate); } reader.Close(); } return voteAnswerTemplatelist; }
public Core.Business.VoteAnswerTemplate Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Key", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectVoteAnswerTemplate); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.VoteAnswerTemplate voteAnswerTemplate = new Core.Business.VoteAnswerTemplate(); if (!reader.IsDBNull(0)) voteAnswerTemplate.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteAnswerTemplate.VoteAnswerContent = reader.GetString(1); return voteAnswerTemplate; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }