public IList<Core.Business.MiniBlogComment> GetAllMiniBlogComment() { IList<Core.Business.MiniBlogComment> miniBlogCommentlist = new List<Core.Business.MiniBlogComment>(); SqlServerUtility sql = new SqlServerUtility(connectionString); SqlDataReader reader = sql.ExecuteSPReader("USP_MiniBlogComment_Select_All"); if (reader != null) { while (reader.Read()) { Core.Business.MiniBlogComment miniBlogComment = new Core.Business.MiniBlogComment(); long id = 0; if (!reader.IsDBNull(0)) id = reader.GetInt64(0); miniBlogComment = CY.UME.Core.Business.MiniBlogComment.Load(id); miniBlogComment.MarkOld(); miniBlogCommentlist.Add(miniBlogComment); } reader.Close(); } return miniBlogCommentlist; }
public int GetReplyNumByAuthorId(CY.UME.Core.Business.Account account) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@AccountId", SqlDbType.BigInt, account.Id); SqlDataReader reader = sql.ExecuteSPReader("USP_MiniBlogComment_SelectCount_By_AuthorId"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.MiniBlogComment miniBlogComment = new Core.Business.MiniBlogComment(); int num = 0; if (!reader.IsDBNull(0)) num = reader.GetInt32(0); reader.Close(); return num; } else { if (reader != null && !reader.IsClosed) reader.Close(); return 0; } }
public Core.Business.MiniBlogComment Select(Int64 id) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.BigInt, id); SqlDataReader reader = sql.ExecuteSPReader("USP_MiniBlogComment_Select_By_Id"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.MiniBlogComment miniBlogComment = new Core.Business.MiniBlogComment(); if (!reader.IsDBNull(0)) miniBlogComment.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) miniBlogComment.DateCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) miniBlogComment.InstanceId = reader.GetInt64(2); if (!reader.IsDBNull(3)) miniBlogComment.AccountId = reader.GetInt64(3); if (!reader.IsDBNull(4)) miniBlogComment.AuthorId = reader.GetInt64(4); if (!reader.IsDBNull(5)) miniBlogComment.ReferedId = reader.GetInt64(5); if (!reader.IsDBNull(6)) miniBlogComment.Content = reader.GetString(6); if (!reader.IsDBNull(7)) miniBlogComment.IP = reader.GetString(7); reader.Close(); return miniBlogComment; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<CY.UME.Core.Business.MiniBlogComment> GetTopMiniBlogCommentByReferedId(long ReferedId, int Num) { IList<Core.Business.MiniBlogComment> miniBlogCommentlist = new List<Core.Business.MiniBlogComment>(); SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@InstanceId", SqlDbType.BigInt, ReferedId); sql.AddParameter("@Num", SqlDbType.BigInt, Num); SqlDataReader reader = sql.ExecuteSPReader("USP_MiniBlogComment_Select_Top_By_InstanceId"); if (reader != null) { while (reader.Read()) { Core.Business.MiniBlogComment miniBlogComment = new Core.Business.MiniBlogComment(); if (!reader.IsDBNull(0)) miniBlogComment.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) miniBlogComment.DateCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) miniBlogComment.InstanceId = reader.GetInt64(2); if (!reader.IsDBNull(3)) miniBlogComment.AccountId = reader.GetInt64(3); if (!reader.IsDBNull(4)) miniBlogComment.AuthorId = reader.GetInt64(4); if (!reader.IsDBNull(5)) miniBlogComment.ReferedId = reader.GetInt64(5); if (!reader.IsDBNull(6)) miniBlogComment.Content = reader.GetString(6); if (!reader.IsDBNull(7)) miniBlogComment.IP = reader.GetString(7); miniBlogComment.MarkOld(); miniBlogCommentlist.Add(miniBlogComment); } reader.Close(); } return miniBlogCommentlist; }