示例#1
0
    public static List <BSComment> GetCommentsByUserID(int iUserID, CommentStates state)
    {
        List <BSComment> comments = new List <BSComment>();

        using (DataProcess dp = new DataProcess())
        {
            if (state == CommentStates.All)
            {
                dp.AddParameter("UserID", iUserID);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID ORDER By CreateDate DESC");
            }
            else
            {
                dp.AddParameter("UserID", iUserID);
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID AND [Approve]=@Approve ORDER By CreateDate DESC");
            }

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return(comments);
    }
示例#2
0
    public static List <BSComment> GetComments(CommentStates state, int iCommentCount)
    {
        List <BSComment> comments = new List <BSComment>();

        using (DataProcess dp = new DataProcess())
        {
            string top = iCommentCount == 0 ? String.Empty : "TOP " + iCommentCount;

            if (state == CommentStates.All)
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments ORDER By CreateDate DESC", top));
            }
            else
            {
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments WHERE [Approve]=@Approve ORDER By CreateDate DESC", top));
            }
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return(comments);
    }
 public List <BSComment> GetComments(CommentStates state)
 {
     return(BSComment.GetCommentsByPostID(PostID, state));
 }
示例#4
0
    public static List<BSComment> GetCommentsByUserID(int iUserID, CommentStates state)
    {
        List<BSComment> comments = new List<BSComment>();
        using (DataProcess dp = new DataProcess())
        {
            if (state == CommentStates.All)
            {
                dp.AddParameter("UserID", iUserID);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID ORDER By CreateDate DESC");
            }
            else
            {
                dp.AddParameter("UserID", iUserID);
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID AND [Approve]=@Approve ORDER By CreateDate DESC");
            }

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return comments;
    }
示例#5
0
    public static List<BSComment> GetComments(CommentStates state, int iCommentCount)
    {
        List<BSComment> comments = new List<BSComment>();
        using (DataProcess dp = new DataProcess())
        {
            string top = iCommentCount == 0 ? String.Empty : "TOP " + iCommentCount;

            if (state == CommentStates.All)
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments ORDER By CreateDate DESC", top));
            }
            else
            {
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments WHERE [Approve]=@Approve ORDER By CreateDate DESC", top));
            }
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return comments;
    }
示例#6
0
 public static List<BSComment> GetComments(CommentStates state)
 {
     return GetComments(state, 0);
 }
示例#7
0
文件: BSPost.cs 项目: Blogsa/blogsa
 public List<BSComment> GetComments(CommentStates state)
 {
     return BSComment.GetCommentsByPostID(PostID, state);
 }
示例#8
0
文件: BSHelper.cs 项目: Blogsa/blogsa
 public static int GetCommentCount(int iUserID, CommentStates state)
 {
     return BSComment.GetCommentsByUserID(iUserID, state).Count;
 }
示例#9
0
文件: BSHelper.cs 项目: Blogsa/blogsa
 public static int GetCommentCount(CommentStates state)
 {
     return BSComment.GetComments(state).Count;
 }
示例#10
0
 public static List <BSComment> GetComments(CommentStates state)
 {
     return(GetComments(state, 0));
 }
示例#11
0
 public static int GetCommentCount(int iUserID, CommentStates state)
 {
     return(BSComment.GetCommentsByUserID(iUserID, state).Count);
 }
示例#12
0
 public static int GetCommentCount(CommentStates state)
 {
     return(BSComment.GetComments(state).Count);
 }