Beispiel #1
0
        private BBSListViewModel GetQuestionList(HomeSortTypeEnum sortType)
        {
            string           sortConfit = ConfigHelper.AppSettings("HomeSortConfig-{0}".FormatWith(sortType.ToString()));
            int              count      = ConfigHelper.AppSettings("HomeListCount").ToInt32();
            BBSListViewModel model      = new BBSListViewModel();

            model.QuestionPage = InitPage();
            model.QuestionList = QuestionBLL.Instance.GetListBySortType(sortType, count, sortConfit, model.QuestionPage);

            bool isVip = UserBaseBLL.Instance.IsVIP(UserID);//当前用户是否VIP用户

            model.QuestionList?.Where(a => a.TopicID == 1037)?.ToList()?.ForEach(item =>
            {
                if (IsLogin)
                {
                    //是会员 或者 购买过了 则显示
                    item.HideForNoVipUserOrNotBuy = !isVip && DB.BuyOtherLog.FirstOrDefault(a => a.CreateUser == UserID && a.MainID == item.QuestionId) == null;
                }
                else
                {
                    item.HideForNoVipUserOrNotBuy = true;
                }
            });
            return(model);
        }
Beispiel #2
0
        /// <summary>
        /// 查找用户所有提问问题
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public BBSListViewModel GetQuestionListByUserid(long userID, Paging page)
        {
            BBSListViewModel bmodel     = new BBSListViewModel();
            DataSet          ds         = dal.GetQuestionListByUserid(userID, page.StartIndex, page.EndIndex, UserBaseBLL.Instance.IsMaster);
            DataTable        questiondt = ds.Tables[1];

            if (questiondt.IsNotNullAndRowCount())
            {
                page.RecordCount    = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                bmodel.QuestionPage = page;
                bmodel.QuestionList = ModelConvertHelper <_QuestionInfo> .ConvertToList(questiondt);

                bmodel.QuestionHeadUrl = ds.Tables[2].Rows[0][0].ToString();
            }
            return(bmodel);
        }
Beispiel #3
0
        public ActionResult B(long id)
        {
            var tag = TagBLL.Instance.GetModel(id);

            if (tag != null)
            {
                BBSListViewModel model = new BBSListViewModel()
                {
                    QuestionPage = InitPage()
                };
                model.QuestionList     = QuestionBLL.Instance.GetQuestionList(0, model.QuestionPage, null, tagId: id);
                ViewBag.HasTopicMaster = false;// UserBaseBLL.Instance.IsRoot;//无权编辑页面,除了超管
                ViewBag.Name           = tag.TagName;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index", "Tag"));
            }
        }
Beispiel #4
0
        private BBSListViewModel GetAllBBS(string order)
        {
            BBSListViewModel model = new BBSListViewModel();

            model.QuestionPage = InitPage();
            model.QuestionList = QuestionBLL.Instance.GetAllBBSList(order, model.QuestionPage);

            bool isVip = UserBaseBLL.Instance.IsVIP(UserID);//当前用户是否VIP用户

            model.QuestionList?.Where(a => a.TopicID == 1037)?.ToList()?.ForEach(item =>
            {
                if (IsLogin)
                {
                    //是会员 或者 购买过了 则显示
                    item.HideForNoVipUserOrNotBuy = !isVip && DB.BuyOtherLog.FirstOrDefault(a => a.CreateUser == UserID && a.MainID == item.QuestionId) == null;
                }
                else
                {
                    item.HideForNoVipUserOrNotBuy = true;
                }
            });
            return(model);
        }