コード例 #1
0
ファイル: MarketService.cs プロジェクト: Shikyoh/HSWB2B2C
        public PageModel <MarketServiceRecordInfo> GetBoughtShopList(MarketBoughtQuery query)
        {
            IQueryable <MarketServiceRecordInfo> typeId = context.MarketServiceRecordInfo.AsQueryable <MarketServiceRecordInfo>();

            if (query.MarketType.HasValue)
            {
                typeId =
                    from d in typeId
                    where (int)d.ActiveMarketServiceInfo.TypeId == (int)query.MarketType.Value
                    select d;
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                typeId =
                    from d in typeId
                    where d.ActiveMarketServiceInfo.ShopName.Contains(query.ShopName)
                    select d;
            }
            int num = 0;

            typeId = typeId.GetPage(out num, query.PageNo, query.PageSize, null);
            return(new PageModel <MarketServiceRecordInfo>()
            {
                Models = typeId,
                Total = num
            });
        }
コード例 #2
0
        /// <summary>
        /// 获取服务购买列表
        /// </summary>
        /// <param name="shopName"></param>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public static QueryPageModel <MarketServiceBuyRecordModel> GetMarketServiceBuyList(string shopName, int page = 1, int pagesize = 10)
        {
            QueryPageModel <MarketServiceBuyRecordModel> result = new QueryPageModel <MarketServiceBuyRecordModel>();
            var queryModel = new MarketBoughtQuery()
            {
                PageSize   = pagesize,
                PageNo     = page,
                ShopName   = shopName,
                MarketType = CurMarketType
            };

            ObsoletePageModel <MarketServiceRecordInfo> marketEntities = MarketApplication.GetBoughtShopList(queryModel);

            if (marketEntities.Total > 0)
            {
                result.Models = marketEntities.Models.Select(d => new MarketServiceBuyRecordModel
                {
                    Id              = d.Id,
                    EndTime         = d.EndTime,
                    MarketServiceId = d.MarketServiceId,
                    StartTime       = d.StartTime,
                    SettlementFlag  = d.SettlementFlag,
                    ShopName        = d.ActiveMarketServiceInfo.ShopName
                }).ToList();
            }
            if (result.Models == null)
            {
                result.Models = new List <MarketServiceBuyRecordModel>();
            }
            result.Total = marketEntities.Total;

            return(result);
        }
コード例 #3
0
        public PageModel <ActiveMarketServiceInfo> GetBoughtShopList(MarketBoughtQuery query)
        {
            IQueryable <ActiveMarketServiceInfo> typeId = context.ActiveMarketServiceInfo.AsQueryable <ActiveMarketServiceInfo>();

            if (query.MarketType.HasValue)
            {
                typeId =
                    from d in typeId
                    where (int?)d.TypeId == (int?)query.MarketType
                    select d;
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                typeId =
                    from d in typeId
                    where d.ShopName.Contains(query.ShopName)
                    select d;
            }
            int num = 0;

            typeId = typeId.GetPage(out num, (IQueryable <ActiveMarketServiceInfo> d) =>
                                    from o in d
                                    orderby o.MarketServiceRecordInfo.Max <MarketServiceRecordInfo, DateTime>((MarketServiceRecordInfo m) => m.EndTime)
                                    select o, query.PageNo, query.PageSize);
            return(new PageModel <ActiveMarketServiceInfo>()
            {
                Models = typeId,
                Total = num
            });
        }
コード例 #4
0
        public JsonResult GetBoughtList(MarketBoughtQuery query)
        {
            query.MarketType = CommonModel.MarketType.FullDiscount;
            var data = FullDiscountApplication.GetMarketServiceBuyList(query);

            return(Json(data));
        }
コード例 #5
0
        public JsonResult GetBoughtJson(string shopName, int page, int rows)
        {
            var queryModel = new MarketBoughtQuery()
            {
                PageSize   = rows,
                PageNo     = page,
                ShopName   = shopName,
                MarketType = MarketType.LimitTimeBuy
            };

            QueryPageModel <Entities.MarketServiceRecordInfo> marketEntities = _iMarketService.GetBoughtShopList(queryModel);

            var market = marketEntities.Models.OrderByDescending(m => m.MarketServiceId).ThenByDescending(m => m.EndTime)
                         .Select(item => {
                var obj = MarketApplication.GetMarketService(item.MarketServiceId);
                return(new
                {
                    Id = item.Id,
                    StartDate = item.StartTime.ToString("yyyy-MM-dd"),
                    EndDate = item.EndTime.ToString("yyyy-MM-dd"),
                    ShopName = obj.ShopName
                });
            });

            return(Json(new { rows = market, total = marketEntities.Total }));
        }
コード例 #6
0
ファイル: MarketService.cs プロジェクト: sky63886/Himall3.3
        public QueryPageModel <MarketServiceRecordInfo> GetBoughtShopList(MarketBoughtQuery query)
        {
            var db = DbFactory.Default.Get <MarketServiceRecordInfo>()
                     .InnerJoin <ActiveMarketServiceInfo>((m, a) => m.MarketServiceId == a.Id);

            if (query.MarketType.HasValue)
            {
                db.Where <ActiveMarketServiceInfo>(d => d.TypeId == query.MarketType.Value);
            }

            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                db = db.Where <ActiveMarketServiceInfo>(d => d.ShopName.Contains(query.ShopName));
            }

            switch (query.Sort.ToLower())
            {
            case "startdate":
            case "starttime":
                if (query.IsAsc)
                {
                    db.OrderBy(p => p.StartTime);
                }
                else
                {
                    db.OrderByDescending(p => p.StartTime);
                }
                break;

            case "enddate":
            case "endtime":
                if (query.IsAsc)
                {
                    db.OrderBy(p => p.EndTime);
                }
                else
                {
                    db.OrderByDescending(p => p.EndTime);
                }
                break;

            default:
                db.OrderByDescending(o => o.Id);
                break;
            }
            var data = db.ToPagedList(query.PageNo, query.PageSize);

            return(new QueryPageModel <MarketServiceRecordInfo>()
            {
                Models = data,
                Total = data.TotalRecordCount
            });
        }
コード例 #7
0
        public ActionResult List(MarketBoughtQuery query)
        {
            query.MarketType = MarketType.RandomlyBonus;
            var marketEntities = _iMarketService.GetBoughtShopList(query);
            var market         = marketEntities.Models.Select(item => {
                var obj = MarketApplication.GetMarketService(item.MarketServiceId);
                return(new
                {
                    Id = item.Id,
                    StartDate = item.StartTime.ToString("yyyy-MM-dd"),
                    EndDate = item.EndTime.ToString("yyyy-MM-dd"),
                    ShopName = obj.ShopName
                });
            }).ToList();

            return(Json(new { rows = market, total = marketEntities.Total }));
        }
コード例 #8
0
        public JsonResult List(MarketBoughtQuery query)
        {
            query.MarketType = MarketType.Collocation;
            var data = _iMarketService.GetBoughtShopList(query);

            var list = data.Models.Select(item => {
                var market = MarketApplication.GetMarketService(item.MarketServiceId);
                return(new
                {
                    Id = item.Id,
                    StartDate = item.StartTime.ToString("yyyy-MM-dd"),
                    EndDate = item.EndTime.ToString("yyyy-MM-dd"),
                    ShopName = market.ShopName
                });
            }).ToList();

            return(Json(new { rows = list, total = data.Total }));
        }
コード例 #9
0
        public JsonResult List(string shopName, int page, int rows)
        {
            MarketBoughtQuery marketBoughtQuery = new MarketBoughtQuery()
            {
                PageSize   = rows,
                PageNo     = page,
                ShopName   = shopName,
                MarketType = new MarketType?(MarketType.Collocation)
            };
            PageModel <MarketServiceRecordInfo> boughtShopList = ServiceHelper.Create <IMarketService>().GetBoughtShopList(marketBoughtQuery);
            var array =
                from item in (
                    from m in boughtShopList.Models
                    orderby m.MarketServiceId descending, m.EndTime descending
                    select m).ToArray()
                select new { Id = item.Id, StartDate = item.StartTime.ToString("yyyy-MM-dd"), EndDate = item.EndTime.ToString("yyyy-MM-dd"), ShopName = item.ActiveMarketServiceInfo.ShopName };

            return(Json(new { rows = array, total = boughtShopList.Total }));
        }
コード例 #10
0
        public JsonResult List(string shopName, int page, int rows)
        {
            var queryModel = new MarketBoughtQuery()
            {
                PageSize   = rows,
                PageNo     = page,
                ShopName   = shopName,
                MarketType = MarketType.Collocation
            };
            ObsoletePageModel <MarketServiceRecordInfo> marketEntities = _iMarketService.GetBoughtShopList(queryModel);

            var market = marketEntities.Models.OrderByDescending(m => m.MarketServiceId).ThenByDescending(m => m.EndTime).ToArray().Select(item => new
            {
                Id        = item.Id,
                StartDate = item.StartTime.ToString("yyyy-MM-dd"),
                EndDate   = item.EndTime.ToString("yyyy-MM-dd"),
                ShopName  = item.ActiveMarketServiceInfo.ShopName
            });

            return(Json(new { rows = market, total = marketEntities.Total }));
        }
コード例 #11
0
        public ObsoletePageModel <MarketServiceRecordInfo> GetBoughtShopList(MarketBoughtQuery query)
        {
            IQueryable <MarketServiceRecordInfo> markets = Context.MarketServiceRecordInfo.AsQueryable();

            if (query.MarketType.HasValue)
            {
                markets = markets.Where(d => d.ActiveMarketServiceInfo.TypeId == query.MarketType.Value);
            }
            if (!string.IsNullOrWhiteSpace(query.ShopName))
            {
                markets = markets.Where(d => d.ActiveMarketServiceInfo.ShopName.Contains(query.ShopName));
            }
            int total = 0;

            markets = markets.GetPage(out total, query.PageNo, query.PageSize);
            ObsoletePageModel <MarketServiceRecordInfo> pageModel = new ObsoletePageModel <MarketServiceRecordInfo>()
            {
                Models = markets, Total = total
            };

            return(pageModel);
        }
コード例 #12
0
        public JsonResult GetBoughtList(MarketBoughtQuery query)
        {
            query.MarketType = MarketType.FightGroup;
            var data = MarketApplication.GetBoughtShopList(query);
            var list = data.Models.Select(d => {
                var market = MarketApplication.GetMarketService(d.MarketServiceId);
                return(new MarketServiceBuyRecordModel
                {
                    Id = d.Id,
                    EndTime = d.EndTime,
                    MarketServiceId = d.MarketServiceId,
                    StartTime = d.StartTime,
                    SettlementFlag = d.SettlementFlag,
                    ShopName = market.ShopName
                });
            }).ToList();
            var result = new QueryPageModel <MarketServiceBuyRecordModel>
            {
                Models = list,
                Total  = data.Total
            };

            return(Json(result, true));
        }
コード例 #13
0
 /// <summary>
 /// 获取指定营销类型服务的已购买商家列表
 /// </summary>
 /// <param name="MarketBoughtQuery">营销查询对象</param>
 /// <returns></returns>
 public static QueryPageModel <MarketServiceRecordInfo> GetBoughtShopList(MarketBoughtQuery query)
 {
     return(Service.GetBoughtShopList(query));
 }
コード例 #14
0
        /// <summary>
        /// 获取服务购买列表
        /// </summary>
        /// <param name="shopName"></param>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public static QueryPageModel <MarketServiceBuyRecordModel> GetMarketServiceBuyList(MarketBoughtQuery query)
        {
            var data = MarketApplication.GetBoughtShopList(query);
            var list = data.Models.Select(d => {
                var market = MarketApplication.GetMarketService(d.MarketServiceId);
                return(new MarketServiceBuyRecordModel
                {
                    Id = d.Id,
                    EndTime = d.EndTime,
                    MarketServiceId = d.MarketServiceId,
                    StartTime = d.StartTime,
                    SettlementFlag = d.SettlementFlag,
                    ShopName = market.ShopName
                });
            }).ToList();

            return(new QueryPageModel <MarketServiceBuyRecordModel>
            {
                Models = list,
                Total = data.Total
            });
        }