//��ȡͶƱ���� public IList<Core.Business.VoteRecord> GetVoteAdviceByVoteID(int ID) { IList<Core.Business.VoteRecord> voteRecordlist = new List<Core.Business.VoteRecord>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@voteID", SqlDbType.Int, ID); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteAdviceByVoteID); if (reader != null) { while (reader.Read()) { Core.Business.VoteRecord voteRecord = new Core.Business.VoteRecord(); if (!reader.IsDBNull(0)) voteRecord.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteRecord.VoteID = reader.GetInt32(1); if (!reader.IsDBNull(2)) voteRecord.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) voteRecord.VoteTime = reader.GetDateTime(3); if (!reader.IsDBNull(4)) voteRecord.Additional = reader.GetString(4); if (!reader.IsDBNull(5)) voteRecord.IP = reader.GetString(5); voteRecord.MarkOld(); voteRecordlist.Add(voteRecord); } reader.Close(); } return voteRecordlist; }
public Core.Business.VoteRecord SelectByLimit6(int voteid, int userid, string IP, string votetime) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@UserID", SqlDbType.Int, userid); sql.AddParameter("@VoteID", SqlDbType.Int, voteid); sql.AddParameter("@IP", SqlDbType.NVarChar, IP); sql.AddParameter("@VoteTime", SqlDbType.DateTime, votetime); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectVoteRecordByLimit6); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.VoteRecord voteRecord = new Core.Business.VoteRecord(); if (!reader.IsDBNull(0)) voteRecord.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteRecord.VoteID = reader.GetInt32(1); if (!reader.IsDBNull(2)) voteRecord.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) voteRecord.VoteTime = reader.GetDateTime(3); if (!reader.IsDBNull(4)) voteRecord.Additional = reader.GetString(4); if (!reader.IsDBNull(5)) voteRecord.IP = reader.GetString(5); voteRecord.MarkOld(); reader.Close(); return voteRecord; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public Core.Business.VoteRecord Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@ID", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectVoteRecord); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.VoteRecord voteRecord = new Core.Business.VoteRecord(); if (!reader.IsDBNull(0)) voteRecord.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) voteRecord.VoteID = reader.GetInt32(1); if (!reader.IsDBNull(2)) voteRecord.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) voteRecord.VoteTime = reader.GetDateTime(3); if (!reader.IsDBNull(4)) voteRecord.Additional = reader.GetString(4); if (!reader.IsDBNull(5)) voteRecord.IP = reader.GetString(5); reader.Close(); return voteRecord; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }