示例#1
0
        public _QuestionInfo GetQuestionDetail(int id, long userid, Paging page)
        {
            //获取问题 基本信息
            DataTable     dt     = dal.GetQuestionDetail(id, userid);
            _QuestionInfo qmodel = ModelConvertHelper <_QuestionInfo> .ConverToModel(dt);

            if (qmodel != null)
            {
                #region MyRegion
                //qmodel.Comments = new _Comments();
                ////获取问题对应评论
                //DataSet ds = CommentBLL.Instance.GetCommentsByType(id, userid, 1, page.StartIndex, page.EndIndex);
                //int recordCount =Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                //if (recordCount>0)
                //{
                //    page.RecordCount = recordCount;
                //    qmodel.Comments.Comments = ModelConvertHelper<_Comment>.ConvertToList(ds.Tables[1]);
                //    //获取评论的回复
                //    qmodel.Comments.Comments.ForEach(item =>
                //    {
                //        //(非回答作者)如果该回答需要付费并且没有付过费,则先不加载评论的回复
                //        if (item.CommentUserID == userid || item.IsHideOrFeeToSee != 1 || item.IsFeeAnswer)
                //        {
                //            item.ReplyList = ModelConvertHelper<_ReplyComment>.ConvertToList(dal.GetReplyList(item.CommentId, userid));
                //        }
                //    });
                //}
                //qmodel.Comments.CommentPage = page;
                #endregion
                qmodel.Comments = CommentBLL.Instance.GetCommentCallBack(id, CommentEnumType.BBS.GetHashCode(), PriseEnumType.BBSComment.GetHashCode(), userid, page, ScoreBeloneMainEnumType.Comment_BBS.GetHashCode());
                qmodel.Tags     = TagBLL.Instance.GetTagByMainID(CommentEnumType.BBS.GetHashCode(), id);
                return(qmodel);
            }
            return(null);
        }