Esempio n. 1
0
        /// <summary>
        /// 新闻评论的数据加载
        /// </summary>
        /// <returns></returns>
        public ActionResult LoadNewsLeaveMsg()
        {
            int newsId    = int.Parse(Request["newsId"]);
            int pageIndex = int.Parse(Request["pageIndex"] ?? "1");
            int pageSize  = int.Parse(Request["pageSize"] ?? "20");
            int total     = 0;
            var msg       = LeaveMsgBll.LoadEntities(m => true);
            var news      = NewsBll.LoadEntities(n => n.Id > 0).Select(n => new { n.Id });
            var user      = PersonalUserBll.LoadEntities(u => u.Id > 0).Select(u => new { u.UName, u.Id, u.Head });
            //-------------请求发布的评论----------------------------------
            var data = from m in msg
                       join u in user on m.PersonalUserId equals u.Id into um
                       from umi in um.DefaultIfEmpty()
                       join n in news on m.NewsId equals n.Id
                       where m.NewsId == newsId
                       where m.ReplyId == null || m.ReplyId == 0
                       select new Publish()
            {
                Id          = m.Id,
                Msg         = m.Msg,
                City        = m.City,
                UserName    = umi != null ? umi.UName : "" + m.Id + "" + "爽赞网友",         //用户名
                UserNameImg = umi.Head != null ? ("/Content/Img/" + umi.Head) : null,    //用户头像
                InTime      = m.InTime,
                Tip         = m.Tip == null ? 0 : m.Tip,
                Stamp       = m.Stamp == null ? 0 : m.Stamp,
            };
            var alldata = data.AsNoTracking().OrderByDescending(d => d.InTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList();

            total = data.Count();
            List <Publish> list = WebHelper.ToListTimeSpan(alldata);
            //-------------------------- //回复的数据---------------------------------------------
            string pubStrNav = LaomaPager.ShowPageNavigate(pageSize, pageIndex, total);

            //回复的数据
            var replyData = LeaveMsgBll.GetNewsLeaveMsgData(newsId).Select(n => new Reply
            {
                SelfId       = n.SelfId,
                ReplyId      = n.ReplyId,
                ReplyContent = n.ReplyContent,
                ReplyCity    = n.ReplyCity,
                ReplyName    = n.ReplyName,
                ReplyUserImg = n.ReplyUserImg,  //用户头像
                ReplyInTime  = n.ReplyInTime,
                ReplyTip     = n.ReplyTip,
                ReplyStamp   = n.ReplyStamp,
            }).ToList();
            List <Reply> replyList = WebHelper.ToReplyStrTimeSpan(replyData);
            var          result    = new { Data = list, replyData = replyList, PubStrNav = pubStrNav, Total = total };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        /// <summary>
        /// 该厂商下的联运等游戏
        /// </summary>
        /// <returns></returns>
        public ActionResult JoinGame()
        {
            int    companyId = int.Parse(Request["id"]);
            string type      = Request["type"];
            int    pageIndex = int.Parse(Request["pageIndex"] ?? "1");
            int    pageSize  = int.Parse(Request["pageSize"] ?? "12");
            int    total     = 0;
            var    param     = new GameParam()
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                Total     = total,
                Type      = type,
                CompanyId = companyId
            };
            var    data   = CompanyBll.currentCpyGame(param).ToList();
            string strNav = LaomaPager.ShowPageNavigate(param.PageSize, param.PageIndex, param.Total);
            var    result = new { Data = data, NavStr = strNav };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }