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(); }
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); }
/// <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()); }
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()))); }
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)); }
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))); }
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); }
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(); }
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; }
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); }
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); }
// 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)); }
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")); }
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)); }
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)); }
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)); }
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()); }
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; }
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 })); }
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()); }
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); }
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 })); }
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)); }
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(), "*")); }
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)); }
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)); }
//分页获取题目信息 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); } }