예제 #1
0
        private void GetList(HttpContext context)
        {
            int num  = 1;
            int num2 = 10;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.Title = context.Request["topicTitle"];
            if (!string.IsNullOrEmpty(context.Request["topicType"]))
            {
                topicQuery.TopicType = base.GetIntParam(context, "topicType", false).Value;
            }
            topicQuery.SortBy    = "topicId";
            topicQuery.SortOrder = SortAction.Desc;
            topicQuery.PageIndex = num;
            topicQuery.PageSize  = num2;
            DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(topicQuery);
            string s = base.SerializeObjectToJson(dataList);

            context.Response.Write(s);
            context.Response.End();
        }
예제 #2
0
        public object GetTopicList(int pageNo, int pageSize)
        {
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.ShopId       = 0;
            topicQuery.PlatformType = PlatformType.IOS;//IOS表示APP端
            topicQuery.PageNo       = pageNo;
            topicQuery.PageSize     = pageSize;
            var pagemodel = ServiceProvider.Instance <ITopicService> .Create.GetTopics(topicQuery);

            var topics = pagemodel.Models.ToList();
            var model  = topics.Select(item => new
            {
                Id = item.Id,
                //TopImage = "http://" + Url.Request.RequestUri.Host + item.TopImage,
                TopImage = Core.MallIO.GetRomoteImagePath(item.TopImage),
                Name     = item.Name
            }
                                       );
            dynamic result = SuccessResult();

            result.Topic = model;
            result.total = pagemodel.Total;
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            TopicQuery query = cmdData.ProtoBufDeserialize<TopicQuery>();
            if (Compiled.Debug)
                query.Debug("=== Bbs.QueryUserTopic 上行数据 ===");

            if (query.OwnerId == 0 || query.OwnerId == context.UserId)
            {
                context.Flush(RespondCode.DataInvalid);
                return;
            }
            query.AttachContent = string.Empty;
            query.ForumId = 0;
            query.HasBestAnswer = true;
            query.Keyword = string.Empty;
            query.OrderType = OrderType.Default;

            UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(context.UserId);
            TopicQueryConditions condition = new TopicQueryConditions(userCache.UserSite, query, 1);
            PageResult<TopicInfo> pageResult = BbsBiz.GetPageTopicList(condition, query.QueryIndex, query.QuerySize);

            //TopicList topicList = pageResult.ToTopicList();
            context.Flush<TopicList>(pageResult.ToTopicList());
        }
예제 #4
0
        public async Task <IResultList <Topic> > QueryAsync(string appId, TopicQuery query, CancellationToken ct)
        {
            var filters = new List <FilterDefinition <MongoDbTopic> >
            {
                Filter.Eq(x => x.Doc.AppId, appId)
            };

            if (!string.IsNullOrWhiteSpace(query.Query))
            {
                var regex = new BsonRegularExpression(query.Query, "i");

                filters.Add(Filter.Regex(x => x.Doc.Path, regex));
            }

            var filter = Filter.And(filters);

            var resultItems = await Collection.Find(filter).SortByDescending(x => x.Doc.LastUpdate).ToListAsync(query, ct);

            var resultTotal = (long)resultItems.Count;

            if (query.ShouldQueryTotal(resultItems))
            {
                resultTotal = await Collection.Find(filter).CountDocumentsAsync(ct);
            }

            return(ResultList.Create(resultTotal, resultItems.Select(x => x.ToTopic())));
        }
예제 #5
0
        public JsonResult List(int page, int rows, string titleKeyword, string tagsKeyword)
        {
            TopicQuery query = new TopicQuery()
            {
                IsAsc        = false,
                PageSize     = rows,
                PageNo       = page,
                Name         = titleKeyword,
                Tags         = tagsKeyword,
                PlatformType = PlatformType.Mobile,
                ShopId       = CurrentSellerManager.ShopId,
                Sort         = "id"
            };

            var topics = _iTopicService.GetTopics(query);
            var curUrl = CurrentUrlHelper.CurrentUrlNoPort();
            var list   = new
            {
                rows = topics.Models.ToArray().Select(item => new
                {
                    id     = item.Id,
                    url    = curUrl + "/m-wap/topic/detail/" + item.Id,
                    name   = item.Name,
                    imgUrl = item.FrontCoverImage,
                    tags   = string.IsNullOrWhiteSpace(item.Tags) ? "" : item.Tags.Replace(",", " ")
                }),
                total = topics.Total
            };

            return(Json(list));
        }
예제 #6
0
        public async Task <IResultList <Topic> > QueryAsync(string appId, TopicQuery query, CancellationToken ct)
        {
            var filters = new List <FilterDefinition <MongoDbTopic> >
            {
                Filter.Eq(x => x.Doc.AppId, appId)
            };

            if (!string.IsNullOrWhiteSpace(query.Query))
            {
                var regex = new BsonRegularExpression(query.Query, "i");

                filters.Add(Filter.Regex(x => x.Doc.Path, regex));
            }

            var filter = Filter.And(filters);

            var taskForItems = Collection.Find(filter).SortByDescending(x => x.Doc.LastUpdate).ToListAsync(query, ct);
            var taskForCount = Collection.Find(filter).CountDocumentsAsync(ct);

            await Task.WhenAll(
                taskForItems,
                taskForCount);

            return(ResultList.Create(taskForCount.Result, taskForItems.Result.Select(x => x.Doc)));
        }
예제 #7
0
        public TopicQuery GetTopicSearch(HttpContext context)
        {
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.PageSize  = 10;
            topicQuery.SortBy    = "TopicId";
            topicQuery.SortOrder = SortAction.Desc;
            topicQuery.PageIndex = ((context.Request.Form["p"] == null) ? 1 : Convert.ToInt32(context.Request.Form["p"]));
            topicQuery.Title     = context.Request["title"];
            string text = context.Request["client"];

            if (!string.IsNullOrEmpty(text) && (text.ToLower() == "appshop" || text.ToLower() == "appshoptopic"))
            {
                topicQuery.TopicType = 2;
            }
            else if (text.ToLower().Trim() == "pctopic")
            {
                topicQuery.TopicType = 3;
            }
            else
            {
                topicQuery.TopicType = 1;
            }
            return(topicQuery);
        }
예제 #8
0
        private void GetList(HttpContext context)
        {
            TopicQuery dataQuery = this.GetDataQuery(context);
            DataGridViewModel <Dictionary <string, object> > listSplittinDraws = this.GetListSplittinDraws(dataQuery);
            string s = base.SerializeObjectToJson(listSplittinDraws);

            context.Response.Write(s);
            context.Response.End();
        }
예제 #9
0
        public PageModel <TopicInfo> GetTopics(TopicQuery topicQuery)
        {
            int num;
            PageModel <TopicInfo>  pageModel = new PageModel <TopicInfo>();
            IQueryable <TopicInfo> topicInfo =
                from item in context.TopicInfo
                where (int)item.PlatForm == (int)topicQuery.PlatformType
                select item;

            if (topicQuery.ShopId > 0)
            {
                topicInfo =
                    from item in topicInfo
                    where item.ShopId == topicQuery.ShopId
                    select item;
            }
            if (topicQuery.IsRecommend.HasValue)
            {
                topicInfo =
                    from item in topicInfo
                    where item.IsRecommend == topicQuery.IsRecommend.Value
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(topicQuery.Name))
            {
                topicQuery.Name = topicQuery.Name.Trim();
                topicInfo       =
                    from item in topicInfo
                    where item.Name.Contains(topicQuery.Name)
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(topicQuery.Tags))
            {
                topicQuery.Tags = topicQuery.Tags.Trim();
                topicInfo       =
                    from item in topicInfo
                    where item.Tags.Contains(topicQuery.Tags)
                    select item;
            }
            Func <IQueryable <TopicInfo>, IOrderedQueryable <TopicInfo> > orderBy = topicInfo.GetOrderBy((IQueryable <TopicInfo> d) =>
                                                                                                         from o in d
                                                                                                         orderby o.Id descending
                                                                                                         select o);

            if (topicQuery.IsAsc)
            {
                orderBy = topicInfo.GetOrderBy((IQueryable <TopicInfo> d) =>
                                               from o in d
                                               orderby o.Id
                                               select o);
            }
            pageModel.Models = topicInfo.GetPage(out num, topicQuery.PageNo, topicQuery.PageSize, orderBy);
            pageModel.Total  = num;
            return(pageModel);
        }
 /// <summary>
 /// 帖子查询条件信息结构
 /// </summary>
 /// <param name="schoolId"></param>
 /// <param name="query"></param>
 /// <param name="status"></param>
 public TopicQueryConditions(int schoolId, TopicQuery query, int status = -1)
 {
     this.SchoolId      = schoolId;
     this.ForumId       = query.ForumId;
     this.OwnerId       = query.OwnerId;
     this.AttachContent = query.AttachContent;
     this.HasBestAnswer = query.HasBestAnswer;
     this.Keyword       = query.Keyword;
     this.Sort          = (int)query.OrderType;
     this.Status        = status;
 }
예제 #11
0
        private TopicQuery GetDataQuery(HttpContext context)
        {
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.TopicType = 2;
            topicQuery.PageSize  = base.CurrentPageSize;
            topicQuery.PageIndex = base.CurrentPageIndex;
            topicQuery.SortBy    = "topicId";
            topicQuery.SortOrder = SortAction.Desc;
            Globals.EntityCoding(topicQuery, true);
            return(topicQuery);
        }
예제 #12
0
        public QueryPageModel <TopicInfo> GetTopics(TopicQuery topicQuery)
        {
            var topic  = new QueryPageModel <Entities.TopicInfo>();
            var topics = DbFactory.Default.Get <Entities.TopicInfo>();

            if (topicQuery.MorePlatForm != null)
            {
                topics.Where(item => item.PlatForm.ExIn(topicQuery.MorePlatForm));
            }
            else
            {
                topics.Where(item => item.PlatForm == topicQuery.PlatformType);
            }
            #region 条件组合
            if (topicQuery.ShopId > 0)
            {
                topics.Where(item => item.ShopId == topicQuery.ShopId);
            }
            else
            {
                topics.Where(item => item.ShopId == 0);
            }
            if (topicQuery.IsRecommend.HasValue)
            {
                topics.Where(item => item.IsRecommend == topicQuery.IsRecommend.Value);
            }
            if (!string.IsNullOrWhiteSpace(topicQuery.Name))
            {
                topicQuery.Name = topicQuery.Name.Trim();
                topics.Where(item => item.Name.Contains(topicQuery.Name));
            }
            if (!string.IsNullOrWhiteSpace(topicQuery.Tags))
            {
                topicQuery.Tags = topicQuery.Tags.Trim();
                topics.Where(item => item.Tags.Contains(topicQuery.Tags));
            }
            #endregion

            topics = topics.OrderByDescending(d => d.Id);
            if (topicQuery.IsAsc)
            {
                topics.OrderBy(d => d.Id);
            }
            else
            {
                topics.OrderByDescending(d => d.Id);
            }

            var data = topics.ToPagedList(topicQuery.PageNo, topicQuery.PageSize);
            topic.Models = data;
            topic.Total  = data.TotalRecordCount;
            return(topic);
        }
예제 #13
0
        // GET: Mobile/Topic

        public ActionResult List(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.ShopId       = 0;
            topicQuery.PlatformType = PlatformType.Mobile;
            topicQuery.PageNo       = pageNo;
            topicQuery.PageSize     = pageSize;
            var topics = _iTopicService.GetTopics(topicQuery).Models;

            return(View(topics));
        }
예제 #14
0
        public DbQueryResult GetTopicList(TopicQuery page)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" 1=1 ");
            if (page.IsRelease.HasValue && page.IsRelease.Value)
            {
                stringBuilder.Append(" and IsRelease = 1");
            }
            else
            {
                if (page.IsRelease.HasValue && !page.IsRelease.Value)
                {
                    stringBuilder.Append(" and IsRelease = 0");
                }
            }

            if (page.SupplierId.HasValue)
            {
                stringBuilder.AppendFormat(" and SupplierId = {0} ", page.SupplierId.Value);
            }

            else
            {
                stringBuilder.Append(" and SupplierId=0 ");
            }


            if (page.IsincludeHomeProduct.HasValue)
            {
                if (!page.IsincludeHomeProduct.Value)
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(" and ");
                    }
                    if (!page.Client.HasValue)
                    {
                        stringBuilder.Append(" topicid  not in (select topicid from Vshop_HomeTopics) ");
                    }
                    else
                    {
                        stringBuilder.Append(" topicid  not in (select topicid from Vshop_HomeTopics where Client=" + page.Client.Value + " ) ");
                    }
                }
            }


            int num = 512;

            return(DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Vshop_Topics t", "TopicId", stringBuilder.ToString(), "*, (SELECT Keys FROM vshop_Reply WHERE [ReplyType] =" + num + " AND Activityid = t.TopicId) AS Keys"));
        }
예제 #15
0
        public ActionResult List(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery
            {
                ShopId       = 0,
                PlatformType = PlatformType.Mobile,
                PageNo       = pageNo,
                PageSize     = pageSize
            };
            List <TopicInfo> models = this._iTopicService.GetTopics(topicQuery).Models;

            return(base.View(models));
        }
예제 #16
0
        public ActionResult List(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                ShopId       = 0,
                PlatformType = Himall.Core.PlatformType.Mobile,
                PageNo       = pageNo,
                PageSize     = pageSize
            };
            IQueryable <TopicInfo> models = ServiceHelper.Create <ITopicService>().GetTopics(topicQuery).Models;

            return(View(models));
        }
예제 #17
0
        public JsonResult TopicList(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery
            {
                ShopId       = 0L,
                PlatformType = PlatformType.Mobile,
                PageNo       = pageNo,
                PageSize     = pageSize
            };
            var data = from item in this._iTopicService.GetTopics(topicQuery).Models.ToList <TopicInfo>() select new { Id = item.Id, TopImage = item.TopImage, Name = item.Name };

            return(base.Json(data));
        }
예제 #18
0
        public ActionResult List()
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                IsRecommend  = new bool?(true),
                PlatformType = PlatformType.PC,
                PageNo       = 1,
                PageSize     = 5
            };
            PageModel <TopicInfo> topics = ServiceHelper.Create <ITopicService>().GetTopics(topicQuery);

            ViewBag.TopicInfo = topics.Models.ToList();
            return(View());
        }
예제 #19
0
        protected void BindTopicList()
        {
            TopicQuery page = new TopicQuery {
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                SortBy    = "DisplaySequence",
                SortOrder = SortAction.Asc
            };
            DbQueryResult topicList = VShopHelper.GettopicList(page);

            this.rpTopic.DataSource = topicList.Data;
            this.rpTopic.DataBind();
            this.pager.TotalRecords = topicList.TotalRecords;
        }
예제 #20
0
        public JsonResult List(int page, int pageSize)
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                IsRecommend  = true,
                PlatformType = Core.PlatformType.PC,
                PageNo       = page,
                PageSize     = 5
            };

            var pagemodel = _iTopicService.GetTopics(topicQuery);
            var model     = pagemodel.Models.ToList().Select(item => new { id = item.Id, name = item.Name, topimage = item.TopImage });

            return(Json(new { success = true, data = model }));
        }
예제 #21
0
        public ActionResult List()
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                IsRecommend  = true,
                PlatformType = Core.PlatformType.PC,
                PageNo       = 1,
                PageSize     = 5
            };

            var pagemodel = _iTopicService.GetTopics(topicQuery);

            ViewBag.TopicInfo = pagemodel.Models.ToList();
            ViewBag.Keyword   = SiteSettings.Keyword;
            return(View());
        }
예제 #22
0
        protected void BindTopics()
        {
            TopicQuery page = new TopicQuery
            {
                PageIndex            = this.pager.PageIndex,
                PageSize             = this.pager.PageSize,
                IsincludeHomeProduct = new bool?(false),
                SortBy    = "DisplaySequence",
                SortOrder = SortAction.Asc
            };
            DbQueryResult topicList = VShopHelper.GettopicList(page);

            this.grdTopics.DataSource = topicList.Data;
            this.grdTopics.DataBind();
            this.pager1.TotalRecords = (this.pager.TotalRecords = topicList.TotalRecords);
        }
예제 #23
0
        public JsonResult List(int page, int pageSize)
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                IsRecommend  = new bool?(true),
                PlatformType = PlatformType.PC,
                PageNo       = page,
                PageSize     = 5
            };
            PageModel <TopicInfo> topics = ServiceHelper.Create <ITopicService>().GetTopics(topicQuery);
            var list =
                from item in topics.Models.ToList()
                select new { id = item.Id, name = item.Name, topimage = item.TopImage };

            return(Json(new { success = true, data = list }));
        }
예제 #24
0
        public JsonResult TopicList(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                ShopId       = 0,
                PlatformType = Himall.Core.PlatformType.Mobile,
                PageNo       = pageNo,
                PageSize     = pageSize
            };
            List <TopicInfo> list = ServiceHelper.Create <ITopicService>().GetTopics(topicQuery).Models.ToList();
            var variable          =
                from item in list
                select new { Id = item.Id, TopImage = item.TopImage, Name = item.Name };

            return(Json(variable));
        }
예제 #25
0
        public DbQueryResult GetTopicList(TopicQuery page)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (page.TopicType > 0)
            {
                stringBuilder.Append(" TopicType = " + page.TopicType);
            }
            else
            {
                stringBuilder.Append(" TopicType > 0 ");
            }
            if (!string.IsNullOrEmpty(page.Title))
            {
                stringBuilder.Append($" and Title like '%{page.Title}%'");
            }
            return(DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Vshop_Topics t", "TopicId", stringBuilder.ToString(), "*"));
        }
예제 #26
0
        public JsonResult TopicList(int pageNo = 1, int pageSize = 10)
        {
            TopicQuery topicQuery = new TopicQuery();

            topicQuery.ShopId       = 0;
            topicQuery.PlatformType = PlatformType.Mobile;
            topicQuery.PageNo       = pageNo;
            topicQuery.PageSize     = pageSize;
            var topics = _iTopicService.GetTopics(topicQuery).Models.ToList();
            var model  = topics.Select(item => new
            {
                Id       = item.Id,
                TopImage = item.TopImage,
                Name     = item.Name
            }
                                       );

            return(SuccessResult <dynamic>(data: model));
        }
예제 #27
0
        public JsonResult List(int page, int rows, string titleKeyword, string tagsKeyword)
        {
            TopicQuery topicQuery = new TopicQuery()
            {
                IsAsc        = false,
                PageSize     = rows,
                PageNo       = page,
                Name         = titleKeyword,
                Tags         = tagsKeyword,
                PlatformType = PlatformType.Mobile,
                ShopId       = base.CurrentSellerManager.ShopId,
                Sort         = "id"
            };
            PageModel <TopicInfo> topics = ServiceHelper.Create <ITopicService>().GetTopics(topicQuery);
            var variable = new { rows =
                                     from item in topics.Models.ToArray()
                                     select new { id = item.Id, url = string.Concat(new object[] { "http://", base.HttpContext.Request.Url.Authority, "/m-wap/topic/detail/", item.Id }), name = item.Name, imgUrl = item.FrontCoverImage, tags = (string.IsNullOrWhiteSpace(item.Tags) ? "" : item.Tags.Replace(",", " ")) }, total = topics.Total };

            return(Json(variable));
        }
예제 #28
0
파일: TopicBLL.cs 프로젝트: TTKLLL/NewExam
    //分页获取题目信息
    public List <ImputTopic> GetTopicsByPage(ref int pageNumber, ref int totalPage, TopicQuery topicQuery, ref int totalCount)
    {
        var query  = GetTopicsByQuery(topicQuery);
        int counts = query.Count();
        List <ImputTopic> topics = new List <ImputTopic>();

        if (counts == 0)
        {
            totalPage  = 0;
            pageNumber = 0;
        }
        else
        {
            totalPage = counts % TopicPageSize == 0 ? counts / TopicPageSize : counts / TopicPageSize + 1;

            topics = (List <ImputTopic>)query.Skip((pageNumber - 1) * TopicPageSize).Take(TopicPageSize).ToList();
        }
        totalCount = counts; //题目总数
        return(topics);
    }
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            TopicQuery query = cmdData.ProtoBufDeserialize <TopicQuery>();

            if (Compiled.Debug)
            {
                query.Debug("=== Bbs.QueryMyRepliedTopic 上行数据 ===");
            }

            PageResult <TopicInfo> pageResult = BbsBiz.GetUserRepliedTopicPageList(context.UserId, query.QueryIndex, query.QuerySize);

            context.Flush <TopicList>(pageResult.ToTopicList());
        }
        private void InitialCateModel(TopicAjaxModel model, string name, int pageNo, long shopId)
        {
            TopicQuery topicQuery = new TopicQuery
            {
                PageNo       = pageNo,
                PageSize     = 10,
                ShopId       = shopId,
                PlatformType = PlatformType.Mobile,
                Name         = name
            };
            QueryPageModel <TopicInfo> topics = this._iTopicService.GetTopics(topicQuery);
            int pageCount = TemplatePageHelper.GetPageCount(topics.Total, 10);

            if (topics != null)
            {
                model.status = 1;
                model.page   = TemplatePageHelper.GetPageHtml(pageCount, pageNo);
                this.InitialCateContentModel(topics.Models, model);
            }
        }