コード例 #1
0
        /// <summary>
        /// 导航专题分类点击后专题列表页页面
        /// </summary>
        /// <returns></returns>
        public IActionResult List(string id, int pageIndex = 1)
        {
            var topicView = new TopicSearchView();

            topicView.TopicCates = _ArticleTopicService.GetTopicCateList(null, null, true);
            topicView.TopicCount = topicView.TopicCates.Sum(u => u.Childs.Count);
            //精品推荐
            ViewBag.HotTopics = _ArticleTopicService.GetHotTopics(8);

            var cateIds = topicView.TopicCates.Select(u => u.Code).ToList();

            topicView.TopicCount = 0;
            if (!id.IsEmpty())
            {
                ViewBag.TopicCateId = id;
                cateIds             = new List <string>()
                {
                    id
                };
            }
            //todo topic特殊处理,方法重复,但有公用信息待处理
            //topicView.TopicList = _ArticleTopicService.GetCateList(new ArticleTopicSearchView { CateType = 1, ParentId = cateIds.ToArray()}, pageIndex,PageSize);//??
            topicView.TopicList = _ArticleTopicService.GetTopicInfoList(new ArticleTopicSearchView {
                TopicStatus = TopicStatus.Audited, ParentId = cateIds.ToArray()
            }, pageIndex, PageSize);                                                                                                                                                        //??
            return(View(topicView));
        }
コード例 #2
0
    public string TopicSearch(TopicSearchView searchView, MiicPage page)
    {
        string    result = CommonService.InitialJsonList;
        DataTable dt     = ImessageInfo.Search(searchView, page);

        if (dt.Rows.Count > 0)
        {
            var temp = from dr in dt.AsEnumerable()
                       group dr by new
            {
                ID           = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, string>(o => o.ID)],
                Content      = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, string>(o => o.TopicContent)],
                MessageCount = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, int?>(o => o.MessageCount)],
                CreateTime   = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, DateTime?>(o => o.CreateTime)],
                CreaterID    = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, string>(o => o.CreaterID)],
                CreaterName  = dr[Config.Attribute.GetSqlColumnNameByPropertyName <TopicInfo, string>(o => o.CreaterName)]
            } into g
                select new
            {
                ID              = g.Key.ID,
                Content         = g.Key.Content,
                MessageCount    = g.Key.MessageCount,
                CreateTime      = g.Key.CreateTime,
                CreaterID       = g.Key.CreaterID,
                CreaterName     = g.Key.CreaterName,
                MessageInfoList = g.Count(o => Convert.IsDBNull(o["MessageID"]) == false) == 0 ? null : (from item in g.AsEnumerable()
                                                                                                         select new
                {
                    Content = item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.Content)],
                    FromCommenterID = item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.FromCommenterID)],
                    FromCommenterName = item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.FromCommenterName)],
                    FromCommenterUrl = CommonService.GetManageFullUrl(item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.FromCommenterUrl)].ToString()),
                    FromCommenterRealName = item["FROM_COMMENTER_REAL_NAME"].ToString(),
                    FromCommenterIsFriend = item["FROM_COMMENTER_IS_FRIEND"].ToString(),
                    ToCommenterID = item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.ToCommenterID)],
                    ToCommenterName = item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.ToCommenterName)],
                    ToCommenterUrl = Convert.IsDBNull(item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.ToCommenterUrl)]) == true ? string.Empty : CommonService.GetManageFullUrl(item[Config.Attribute.GetSqlColumnNameByPropertyName <MessageShowInfo, string>(o => o.ToCommenterUrl)].ToString()),
                    CommentTime = item[Config.Attribute.GetSqlColumnNameByPropertyName <Miic.Friends.Group.MessageInfo, DateTime?>(o => o.CommentTime)],
                    ToCommenterRealName = item["TO_COMMENTER_REAL_NAME"].ToString(),
                    ToCommenterIsFriend = item["TO_COMMENTER_IS_FRIEND"].ToString()
                }).Take(10)
            };
            result = Config.Serializer.Serialize(temp);
        }
        return(result);
    }
コード例 #3
0
        /// <summary>
        /// 导航专题页面
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            var topicView = new TopicSearchView();

            topicView.HotTopics = _ArticleTopicService.GetTopicInfoList(new ArticleTopicSearchView {
                HotTopic = true, TopicStatus = TopicStatus.Audited, IgnoreCate = true
            }, 1, 4);
            topicView.TopicCates = _ArticleTopicService.GetTopicCateList(null, null, true);
            topicView.TopicCount = topicView.TopicCates.Sum(u => u.Childs.Count);

            var cateIds = topicView.TopicCates.Select(u => u.Code).ToList();

            topicView.TopicCount = 0;
            topicView.TopicList  = _ArticleTopicService.GetTopicInfoList(new ArticleTopicSearchView()
            {
                IgnoreCate = true, TopicStatus = TopicStatus.Audited
            }, 1, 8);
            return(View(topicView));
        }
コード例 #4
0
 public int GetTopicSearchCount(TopicSearchView searchView)
 {
     return(ImessageInfo.GetSearchCount(searchView));
 }