Esempio n. 1
0
        public static IEnumerable <ArticleCommentModel> SelectArticleCommentByPKID(int PKID, string UserID, int PageIndex = 1, int PageSize = 10)
        {
            var dt = ArticleComment.SelectArticleCommentByPKID(PKID, UserID, PageIndex, PageSize);

            return(dt.Rows.Cast <DataRow>().Select(row => new ArticleCommentModel(row)).Select(a =>
            {
                a.PhoneNum = CommentHelper.GetCommentUserName(a.PhoneNum, 0);
                a.UserName = CommentHelper.GetCommentUserName(a.UserName, 0);
                return a;
            }));
        }
Esempio n. 2
0
        /// <summary>
        /// 热门评论
        /// </summary>
        /// <param name="PKID"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static IEnumerable <ArticleCommentModel> GetArticleCommentTop3(int PKID, string UserID)
        {
            var dt = ArticleComment.GetArticleCommentTop3(PKID, UserID);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(new ArticleCommentModel[0]);
            }
            return(dt.Rows.Cast <DataRow>().Select(row => new ArticleCommentModel(row)).Select(a =>
            {
                a.PhoneNum = CommentHelper.GetCommentUserName(a.PhoneNum, 0);
                //a.UserName = CommentHelper.GetCommentUserName(a.RealName, 0);
                return a;
            }));
        }
Esempio n. 3
0
        /// <summary>
        /// 查询相关文章,以及置顶评论
        /// </summary>
        /// <param name="PKID"></param>
        /// <param name="Category"></param>
        /// <param name="UserId"></param>
        /// <param name="IsLikeNew"></param>
        /// <returns></returns>
        public static NewsInfoModel SelectNewsInfo(int PKID, int Category, string UserId = "", bool IsLikeNew = false)
        {
            try
            {
                var ds = Articles.SelectNewsInfo(PKID, Category);
                if (ds != null && ds.Tables.Count == 2)
                {
                    NewsInfoModel model = new NewsInfoModel();

                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        model.CommentItems = (List <tbl_CommentModel>)Helper.ModelConvertHelper <tbl_CommentModel> .ConvertToModel(ds.Tables[0]);

                        if (model.CommentItems != null && model.CommentItems.Count > 0)
                        {
                            model.CommentItems.ForEach(w => w.UserName = CommentHelper.GetCommentUserName(w.UserName, 0));
                        }
                    }
                    else
                    {
                        model.CommentItems = null;
                    }

                    if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
                    {
                        model.ArticleItems = (List <tbl_ArticleModel>)Helper.ModelConvertHelper <tbl_ArticleModel> .ConvertToModel(ds.Tables[1]);
                    }
                    else
                    {
                        model.ArticleItems = null;
                    }

                    return(model);
                }
                return(null);
            }
            catch (Exception ex) { return(null); }
        }