public QueryPageModel <MobileHomeProductInfo> GetSellerMobileHomePageProducts(long shopId, PlatformType platformType, ProductQuery productQuery) { var homeProducts = DbFactory.Default.Get <MobileHomeProductInfo>().Where(item => item.ShopId == shopId && item.PlatFormType == platformType); if (!string.IsNullOrWhiteSpace(productQuery.KeyWords)) { productQuery.KeyWords = productQuery.KeyWords.Trim(); var brandIds = DbFactory.Default.Get <BrandInfo>().Where(item => item.Name.Contains(productQuery.KeyWords) && item.IsDeleted == false).Select(item => item.Id).ToList <long>(); homeProducts.LeftJoin <ProductInfo>((mi, pi) => mi.ProductId == pi.Id).Where <ProductInfo>(item => item.ProductName.Contains(productQuery.KeyWords) || item.BrandId.ExIn(brandIds)); } if (productQuery.ShopCategoryId.HasValue) { var shopCategoryIds = DbFactory.Default.Get <ShopCategoryInfo>().Where(c => c.Id == productQuery.ShopCategoryId || c.ParentCategoryId == productQuery.ShopCategoryId).Select(c => c.Id).ToList <long>(); var productIds = DbFactory.Default.Get <ProductShopCategoryInfo>().Where(item => item.ShopCategoryId.ExIn(shopCategoryIds)).Select(item => item.ProductId).ToList <long>(); homeProducts.Where(item => item.ProductId.ExIn(productIds)); } var models = homeProducts.OrderBy(item => item.Sequence).ToPagedList(productQuery.PageNo, productQuery.PageSize); QueryPageModel <MobileHomeProductInfo> pageModel = new QueryPageModel <MobileHomeProductInfo>() { Models = models, Total = models.TotalRecordCount }; return(pageModel); }
/// <summary> /// 根据商品搜索周边门店-分页 /// </summary> /// <param name="search"></param> /// <returns>标签的过滤</returns> public static QueryPageModel <ShopBranch> StoreByProductNearShopBranchs(ShopBranchQuery search) { var shopBranchInfos = Service.StoreByProductNearShopBranchs(search); QueryPageModel <ShopBranch> shopBranchs = new QueryPageModel <ShopBranch> { Models = shopBranchInfos.Models.Select(e => new ShopBranch { AddressDetail = RenderAddress(e.AddressPath, e.AddressDetail, 1), ContactPhone = e.ContactPhone, Id = e.Id, ShopBranchName = e.ShopBranchName, Status = e.Status, DistanceUnit = e.Distance >= 1 ? e.Distance + "KM" : e.Distance * 1000 + "M", Distance = e.Distance, ServeRadius = e.ServeRadius, Latitude = e.Latitude, Longitude = e.Longitude, DeliveFee = e.DeliveFee, DeliveTotalFee = e.DeliveTotalFee, IsAboveSelf = e.IsAboveSelf, IsStoreDelive = e.IsStoreDelive, ShopImages = MallIO.GetRomoteImagePath(e.ShopImages), ShopId = e.ShopId, FreeMailFee = e.FreeMailFee, IsFreeMail = e.IsFreeMail, IsRecommend = e.IsRecommend, RecommendSequence = e.RecommendSequence == 0 ? long.MaxValue : e.RecommendSequence//非推荐门店取最大值,便于显示排序 }).ToList(), Total = shopBranchInfos.Total }; return(shopBranchs); }
/// <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); }
public List <TruckModel> GetTruckList(int pageIndex, int pageSize, string number, DateTime dateTime, out int total) { total = 0; QueryPageModel queryPageModel = new QueryPageModel(); queryPageModel.OrderBy = "TruckID"; queryPageModel.PageIndex = pageIndex; queryPageModel.PageSize = pageSize; queryPageModel.QuerySql = @"(select * from [Truck]) u where 1=1 {0} )"; string sqlWhere = ""; TruckModel model = new TruckModel(); if (!string.IsNullOrEmpty(number)) { sqlWhere += " and Number like @Number"; model.Number = number + "%"; } if (dateTime > new DateTime(1950, 1, 1)) { sqlWhere += " and CheckInTime < @CheckInTime"; model.CheckInTime = dateTime; } queryPageModel.QuerySql = string.Format(queryPageModel.QuerySql, sqlWhere); var result = PageDataHelper.QueryWithPage <TruckModel>(queryPageModel, model); total = PageDataHelper.QueryTotalCount(queryPageModel, model); return(result.ToList()); }
/// <summary> /// 分页查询门店 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <ShopBranch> GetShopBranchs(ShopBranchQuery query) { var data = Service.GetShopBranchs(query); var branchs = data.Models; var tags = Service.GetShopBranchInTagByBranchs(branchs.Select(p => p.Id).ToList()); var shops = GetService <IShopService>().GetShops(branchs.Select(p => p.ShopId).ToList()); var shopBranchs = new QueryPageModel <ShopBranch> { Models = branchs.Select(e => new ShopBranch { AddressDetail = e.AddressDetail, AddressFullName = RegionApplication.GetFullName(e.AddressId, CommonConst.ADDRESS_PATH_SPLIT) + CommonConst.ADDRESS_PATH_SPLIT + e.AddressDetail, AddressId = e.AddressId, ContactPhone = e.ContactPhone, ContactUser = e.ContactUser, Id = e.Id, ShopBranchName = e.ShopBranchName, ShopId = e.ShopId, Status = e.Status, ShopBranchInTagNames = string.Join(",", tags.Where(p => p.ShopBranchId == e.Id).Select(p => p.Title)), ShopName = shops.FirstOrDefault(p => p.Id == e.ShopId)?.ShopName ?? string.Empty }).ToList(), Total = data.Total }; return(shopBranchs); }
public JsonResult Recordlist(int page, int rows) { ShopQuery query = new ShopQuery() { BrandId = CurrentSellerManager.ShopId, PageNo = page, PageSize = rows }; QueryPageModel <ShopRenewRecordInfo> accounts = _iShopService.GetShopRenewRecords(query); IList <ShopRecordModel> models = new List <ShopRecordModel>(); foreach (var item in accounts.Models.ToArray()) { ShopRecordModel model = new ShopRecordModel(); model.Id = (int)item.Id; model.OperateType = item.OperateType.ToDescription(); model.OperateDate = item.OperateDate.ToString("yyyy-MM-dd HH:mm"); model.Operate = item.Operator; model.Content = item.OperateContent; model.Amount = item.Amount; models.Add(model); } return(Json(new { rows = models, total = accounts.Total })); }
public static QueryPageModel <WeiActivityModel> Get(WeiActivityQuery query) { QueryPageModel <Entities.WeiActivityInfoInfo> weiInfo = Service.Get(query); var datas = weiInfo.Models.ToList().Select(m => new WeiActivityModel() { Id = m.Id, activityTitle = m.ActivityTitle, activityType = (WeiActivityType)m.ActivityType, activityDetails = m.ActivityDetails, activityUrl = HimallIO.GetImagePath(m.ActivityUrl), beginTime = m.BeginTime, endTime = m.EndTime, participationType = (WeiParticipateType)m.ParticipationType, participationCount = Convert.ToInt32(m.ParticipationCount), consumePoint = m.ConsumePoint, codeUrl = m.CodeUrl, addDate = m.AddDate, totalNumber = GetWinNumber(m.Id, "ALL"), winNumber = GetWinNumber(m.Id, "True") }).ToList(); QueryPageModel <WeiActivityModel> t = new QueryPageModel <WeiActivityModel>(); t.Models = datas; t.Total = weiInfo.Total; return(t); }
public JsonResult List(DateTime?startDate, DateTime?endDate, long?orderId, string shopName, string userName, int page, int rows) { var queryModel = new OrderCommentQuery() { StartDate = startDate, EndDate = endDate, OrderId = orderId, ShopName = shopName, UserName = userName, PageSize = rows, PageNo = page }; QueryPageModel <Mall.Entities.OrderCommentInfo> orderComments = _iTradeCommentService.GetOrderComments(queryModel); var orderCommentMode = orderComments.Models.ToArray().Select(item => new { Id = item.Id, OrderId = item.OrderId, ShopName = item.ShopName, UserName = item.UserName, CommentDate = item.CommentDate.ToShortDateString(), PackMark = item.PackMark, DeliveryMark = item.DeliveryMark, ServiceMark = item.ServiceMark }); return(Json(new { rows = orderCommentMode, total = orderComments.Total })); }
/// <summary> /// 获取门店的月产品数量 /// </summary> /// <param name="query"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> public static QueryPageModel <ProductInfo> GetShopBranchProductsMonth(ShopBranchProductQuery query, DateTime startDate, DateTime endDate) { QueryPageModel <ProductInfo> model = _shopBranchService.SearchProduct(query); OrderQuery orderQuery = new OrderQuery { ShopBranchId = query.shopBranchId, StartDate = new DateTime?(startDate), EndDate = new DateTime?(endDate.AddDays(-1.0)) }; List <OrderItem> orderItemsByOrderId = OrderApplication.GetOrderItemsByOrderId((IEnumerable <long>)(from e in OrderApplication.GetOrdersNoPage(orderQuery) select e.Id)); IEnumerable <long> pids = from e in model.Models select e.Id; var source = from o in orderItemsByOrderId where pids.Contains <long>(o.ProductId) group o by o.ProductId into e select new { productId = e.Key, saleCount = e.Sum <OrderItem>((Func <OrderItem, long>)(p => p.Quantity)) }; using (List <ProductInfo> .Enumerator enumerator = model.Models.GetEnumerator()) { while (enumerator.MoveNext()) { ProductInfo p = enumerator.Current; var fAnonymousType0 = Enumerable.FirstOrDefault(source, e => e.productId == p.Id); p.SaleCounts = fAnonymousType0 == null ? 0 : fAnonymousType0.saleCount; } } return(model); }
public QueryPageModel <WeiActivityWinModel> Get(string text, long id, int pageIndex, int pageSize) { var query = DbFactory.Default.Get <WeiActivityWinInfoInfo>().LeftJoin <WeiActivityAwardInfo>((wwi, wai) => wwi.AwardId == wai.Id).LeftJoin <MemberInfo>((wwi, mi) => wwi.UserId == mi.Id); if (text == "1") { query.Where(p => p.IsWin == true); } else if (text == "0") { query.Where(p => p.IsWin == false); } query.Where(p => p.ActivityId == id); if (pageIndex <= 0) { pageIndex = 1; } query.Select(p => new { userId = p.UserId, activityId = p.ActivityId, awardId = p.AwardId, isWin = p.IsWin, awardName = p.AwardName, addDate = p.AddDate }) .Select <MemberInfo>(p => new { userName = p.UserName }).Select <WeiActivityAwardInfo>(p => p.AwardLevel); var datas = query.OrderByDescending(o => o.AddDate).ToPagedList <WeiActivityWinModel>(pageIndex, pageSize); QueryPageModel <WeiActivityWinModel> pageModel = new QueryPageModel <WeiActivityWinModel>() { Models = datas, Total = datas.TotalRecordCount }; return(pageModel); }
public QueryPageModel <AccountInfo> GetAccounts(AccountQuery query) { //IQueryable<AccountInfo> complaints = Context.AccountInfo.AsQueryable(); var complaints = DbFactory.Default.Get <AccountInfo>(); #region 条件组合 if (query.Status.HasValue) { complaints.Where(item => query.Status == item.Status); } if (query.ShopId.HasValue) { complaints.Where(item => query.ShopId == item.ShopId); } if (!string.IsNullOrEmpty(query.ShopName)) { complaints.Where(item => item.ShopName.Contains(query.ShopName)); } #endregion //int total; //complaints = complaints.GetPage(d => d.OrderByDescending(o => o.Id), out total, query.PageNo, query.PageSize); var models = complaints.OrderByDescending(o => o.Id).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <AccountInfo> pageModel = new QueryPageModel <AccountInfo>() { Models = models, Total = models.TotalRecordCount }; return(pageModel); }
public QueryPageModel <MemberIntegralRecordInfo> GetIntegralRecordList(IntegralRecordQuery query) { //int total = 0; //IQueryable<MemberIntegralRecord> list = Context.MemberIntegralRecord.AsQueryable(); var list = DbFactory.Default.Get <MemberIntegralRecordInfo>(); if (query.UserId.HasValue) { list.Where(item => item.MemberId == query.UserId.Value); } if (query.StartDate.HasValue) { list.Where(item => query.StartDate <= item.RecordDate); } if (query.IntegralType.HasValue) { list.Where(item => item.TypeId == query.IntegralType.Value); } if (query.EndDate.HasValue) { list.Where(item => query.EndDate >= item.RecordDate); } //list = list.GetPage(d => d.OrderByDescending(o => o.Id), out total, query.PageNo, query.PageSize); var model = list.OrderByDescending(o => o.Id).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <MemberIntegralRecordInfo> pageModel = new QueryPageModel <MemberIntegralRecordInfo>() { Models = model, Total = model.TotalRecordCount }; return(pageModel); }
/// <summary> /// 获取消息列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <AppMessagesInfo> GetMessages(AppMessageQuery query) { var sql = Context.AppMessagesInfo.AsQueryable(); if (query.ShopId.HasValue) { sql = sql.Where(d => d.ShopId == query.ShopId.Value); } if (query.ShopBranchId.HasValue) { sql = sql.Where(d => d.ShopBranchId == query.ShopBranchId.Value); } if (query.StartTime.HasValue) { sql = sql.Where(d => d.sendtime >= query.StartTime.Value); } if (query.EndTime.HasValue) { sql = sql.Where(d => d.sendtime <= query.EndTime.Value); } if (query.IsRead.HasValue) { sql = sql.Where(d => d.IsRead == query.IsRead.Value); } QueryPageModel <AppMessagesInfo> result = new QueryPageModel <AppMessagesInfo>(); int total = 0; result.Models = sql.GetPage(out total, query.PageNo, query.PageSize, (o => o.OrderByDescending(d => d.sendtime))).ToList(); result.Total = total; return(result); }
public QueryPageModel <LabelInfo> GetMemberLabelList(LabelQuery model) { //var result = Context.LabelInfo.AsQueryable(); var result = DbFactory.Default.Get <LabelInfo>(); if (!string.IsNullOrWhiteSpace(model.LabelName)) { result.Where(item => item.LabelName.Contains(model.LabelName)); } if (model.LabelIds != null) { //result = result.Where(item => model.LabelIds.Contains(item.Id)); result.Where(item => item.Id.ExIn(model.LabelIds)); } //int total = 0; if (model.PageNo > 0 && model.PageSize > 0) { //result = result.GetPage(d => d.OrderByDescending(o => o.Id), out total, model.PageNo, model.PageSize); var models = result.OrderByDescending(o => o.Id).ToPagedList(model.PageNo, model.PageSize); QueryPageModel <LabelInfo> pageModel = new QueryPageModel <LabelInfo> { Models = models, Total = models.TotalRecordCount }; return(pageModel); } else { QueryPageModel <LabelInfo> pageModel = new QueryPageModel <LabelInfo> { Models = result.ToList(), Total = result.Count() }; return(pageModel); } }
public JsonResult List(DateTime?startDate, DateTime?endDate, long?orderId, int?complaintStatus, string shopName, string userName, int page, int rows) { var queryModel = new ComplaintQuery() { StartDate = startDate, EndDate = endDate, OrderId = orderId, Status = (Mall.Entities.OrderComplaintInfo.ComplaintStatus?)complaintStatus, ShopName = shopName, UserName = userName, PageSize = rows, PageNo = page }; QueryPageModel <Mall.Entities.OrderComplaintInfo> orderComplaints = _iComplaintService.GetOrderComplaints(queryModel); var orderComplaintMode = orderComplaints.Models.ToArray().Select(item => new { Id = item.Id, OrderId = item.OrderId, ComplaintStatus = item.Status.ToDescription(), ShopName = item.ShopName, ShopPhone = item.ShopPhone, UserName = item.UserName, UserPhone = item.UserPhone, ComplaintDate = item.ComplaintDate.ToShortDateString(), ComplaintReason = System.Text.RegularExpressions.Regex.Replace(item.ComplaintReason, @"(<|(<))br[^>]*?(>|(>))", "").Replace("<", "<").Replace(">", ">"), SellerReply = item.SellerReply, PlatRemark = string.IsNullOrWhiteSpace(item.PlatRemark) ? "" : item.PlatRemark }).ToList(); return(Json(new { rows = orderComplaintMode, total = orderComplaints.Total })); }
/// <summary> /// 获取周边门店-分页 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <ShopBranch> GetNearShopBranchs(ShopBranchQuery query) { var shopBranchInfos = _shopBranchService.GetNearShopBranchs(query); QueryPageModel <ShopBranch> shopBranchs = new QueryPageModel <ShopBranch> { Models = shopBranchInfos.Models.Select(e => new ShopBranch { AddressDetail = RenderAddress(e.AddressPath, e.AddressDetail, 1), ContactPhone = e.ContactPhone, Id = e.Id, ShopBranchName = e.ShopBranchName, Status = e.Status, DistanceUnit = e.Distance >= 1 ? e.Distance + "KM" : e.Distance * 1000 + "M", Distance = e.Distance, ServeRadius = e.ServeRadius.HasValue ? e.ServeRadius.Value : 0, Latitude = e.Latitude.HasValue ? e.Latitude.Value : 0, Longitude = e.Longitude.HasValue ? e.Longitude.Value : 0, DeliveFee = e.DeliveFee, DeliveTotalFee = e.DeliveTotalFee, IsAboveSelf = e.IsAboveSelf, IsStoreDelive = e.IsStoreDelive, ShopImages = HimallIO.GetRomoteImagePath(e.ShopImages, (string)null), ShopId = e.ShopId, FreeMailFee = e.FreeMailFee, IsRecommend = e.IsRecommend, RecommendSequence = e.RecommendSequence == 0 ? long.MaxValue : e.RecommendSequence }).ToList(), Total = shopBranchInfos.Total }; return(shopBranchs); }
/// <summary> /// 获取消息列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <AppMessageInfo> GetMessages(AppMessageQuery query) { //var sql = Context.AppMessagesInfo.AsQueryable(); var sql = DbFactory.Default.Get <AppMessageInfo>(); if (query.ShopId.HasValue) { sql.Where(d => d.ShopId == query.ShopId.Value); } if (query.ShopBranchId.HasValue) { sql.Where(d => d.ShopBranchId == query.ShopBranchId.Value); } if (query.StartTime.HasValue) { sql.Where(d => d.sendtime >= query.StartTime.Value); } if (query.EndTime.HasValue) { sql.Where(d => d.sendtime <= query.EndTime.Value); } if (query.IsRead.HasValue) { sql.Where(d => d.IsRead == query.IsRead.Value); } QueryPageModel <AppMessageInfo> result = new QueryPageModel <AppMessageInfo>(); //int total = 0; //result.Models = sql.GetPage(o => o.OrderByDescending(d => d.sendtime), out total, query.PageNo, query.PageSize).ToList(); var models = sql.OrderByDescending(d => d.sendtime).ToPagedList(query.PageNo, query.PageSize); result.Models = models; result.Total = models.TotalRecordCount; return(result); }
public QueryPageModel <CashDepositDetailInfo> GetCashDepositDetails(CashDepositDetailQuery query) { //IQueryable<CashDepositDetailInfo> cashDepositDetails = Context.CashDepositDetailInfo.AsQueryable(); var cashDepositDetails = DbFactory.Default.Get <CashDepositDetailInfo>(); if (query.StartDate.HasValue) { cashDepositDetails.Where(item => query.StartDate <= item.AddDate); } if (query.EndDate.HasValue) { cashDepositDetails.Where(item => query.EndDate >= item.AddDate); } if (!string.IsNullOrWhiteSpace(query.Operator)) { cashDepositDetails.Where(item => item.Operator.Contains(query.Operator)); } cashDepositDetails.Where(item => item.CashDepositId == query.CashDepositId); //int total = 0; //cashDepositDetails = cashDepositDetails.FindBy(item => item.CashDepositId == query.CashDepositId, query.PageNo, query.PageSize, out total, item => item.AddDate, false); var models = cashDepositDetails.OrderByDescending(p => p.AddDate).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <CashDepositDetailInfo> pageModel = new QueryPageModel <CashDepositDetailInfo>() { Models = models, Total = models.TotalRecordCount }; return(pageModel); }
/// <summary> /// 查询结算历史 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <AccountInfo> GetSettledHistory(ShopSettledHistoryQuery query) { //int total = 0; //var model = Context.AccountDetailInfo.Where(a => a.ShopId == query.ShopId).OrderBy(a => a.Id).FirstOrDefault(); var model = DbFactory.Default.Get <AccountDetailInfo>().Where(a => a.ShopId == query.ShopId).OrderBy(a => a.Id).FirstOrDefault(); var MinDate = query.MinSettleTime.Date; if (model == null) //不存在结算记录返回空 { return new QueryPageModel <AccountInfo>() { Models = new List <AccountInfo>(), Total = 0 } } ; else { MinDate = model.Date.Date; } //var list = Context.AccountInfo.Where(a => a.AccountDate >= MinDate); var list = DbFactory.Default.Get <AccountInfo>().Where(a => a.AccountDate >= MinDate); var result = list.OrderByDescending(o => o.Id).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <AccountInfo> pageModel = new QueryPageModel <AccountInfo>() { Models = result, Total = result.TotalRecordCount }; return(pageModel); }
/// <summary> /// 取发送记录 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <SendMessageRecord> GetSendRecords(IServices.QueryModel.SendRecordQuery query) { var data = _iWXMsgTemplateService.GetSendRecords(query); QueryPageModel <SendMessageRecord> item = new QueryPageModel <SendMessageRecord>(); item.Total = data.Total; var list = data.Models.ToList(); var dataList = Mapper.Map <List <SendMessageRecord> >(list); foreach (var info in dataList) { var record = _iWXMsgTemplateService.GetSendrecordCouponSnById(info.Id); info.CurrentCouponCount = record.Count; foreach (var items in record) { var result = _iWXMsgTemplateService.GetCouponRecordBySn(items.CouponSN); var orderResult = result.OrderId == null ? null : OrderApplication.GetOrder(result.OrderId.Value); if (result != null && orderResult != null) { info.CurrentUseCouponCount++; } } } item.Models = dataList; return(item); }
/// <summary> /// 获取参与的拼团 /// </summary> /// <param name="userId">用户编号</param> /// <param name="Statuses">参与状态</param> /// <param name="page"></param> /// <param name="pagesize"></param> /// <returns></returns> public static QueryPageModel <FightGroupsModel> GetJoinGroups( long userId , List <FightGroupOrderJoinStatus> Statuses = null , int PageNo = 1 , int PageSize = 10 ) { // Mapper.CreateMap<FightGroupInfo, FightGroupsModel>(); // Mapper.CreateMap<FightGroupOrderInfo, FightGroupOrderModel>(); // var map = Mapper.CreateMap<QueryPageModel<FightGroupInfo>, QueryPageModel<FightGroupsModel>>(); var data = Service.GetJoinGroups(userId, Statuses, PageNo, PageSize); //QueryPageModel<FightGroupsModel> result = Mapper.Map<QueryPageModel<FightGroupsModel>>(data); QueryPageModel <FightGroupsModel> result = data.Map <QueryPageModel <FightGroupsModel> >(); foreach (var item in result.Models) { item.HeadUserIcon = Mall.Core.MallIO.GetImagePath(item.HeadUserIcon); if (item.GroupOrders != null) { foreach (var subitem in item.GroupOrders) { subitem.Photo = Mall.Core.MallIO.GetImagePath(subitem.Photo); } } } return(result); }
/// <summary> /// 获取周边门店-分页 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <ShopBranchInfo> GetNearShopBranchs(CommonModel.ShopBranchQuery query) { decimal latitude = 0, longitude = 0; if (query.FromLatLng.Split(',').Length != 2) { return(new QueryPageModel <ShopBranchInfo>()); } latitude = TypeHelper.ObjectToDecimal(query.FromLatLng.Split(',')[0]); longitude = TypeHelper.ObjectToDecimal(query.FromLatLng.Split(',')[1]); QueryPageModel <ShopBranchInfo> result = new QueryPageModel <ShopBranchInfo>(); DynamicParameters parms = new DynamicParameters(); string countsql = "select count(1) from himall_shopbranch "; string sql = string.Format("select AddressDetail,AddressPath,ContactPhone,Id,ShopBranchName,Status,Latitude,Longitude,truncate(6378.137*2*ASIN(SQRT(POW(SIN(({0}*PI()/180.0-Latitude*PI()/180.0)/2),2)+COS({0}*PI()/180.0)*COS(Latitude*PI()/180.0)*POW(SIN(({1}*PI()/180.0-Longitude*PI()/180.0)/2),2))),2) AS Distance from himall_shopbranch", latitude, longitude); string where = GetSearchWhere(query, parms); string order = GetSearchOrder(query); if (query.OrderKey == 2) { order = string.Format(" {0}, id desc ", order.TrimEnd(','));//如果存在相同距离,则按ID再次排序 } //暂时不考虑索引 string page = GetSearchPage(query); using (MySqlConnection conn = new MySqlConnection(Connection.ConnectionString)) { result.Models = conn.Query <ShopBranchInfo>(string.Concat(sql, where, order, page), parms).ToList(); result.Total = int.Parse(conn.ExecuteScalar(string.Concat(countsql, where), parms).ToString()); } return(result); }
/// <summary> /// 获取用户积分明细 /// </summary> /// <param name="id">用户编号</param> /// <param name="type"></param> /// <param name="pageSize"></param> /// <param name="pageNo"></param> /// <returns></returns> public QueryPageModel <UserCenterGetIntegralRecordModel> GetIntegralRecord(MemberIntegral.IntegralType?type = null, int page = 1, int pagesize = 10) { CheckUserLogin(); var id = CurrentUser.Id; //处理当前用户与id的判断 var _iMemberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); Himall.Model.MemberIntegral.IntegralType?integralType = type; var query = new IntegralRecordQuery() { IntegralType = integralType, UserId = id, PageNo = page, PageSize = pagesize }; var result = _iMemberIntegralService.GetIntegralRecordListForWeb(query); var list = result.Models.ToList().Select(item => new UserCenterGetIntegralRecordModel { Id = item.Id, RecordDate = item.RecordDate, Integral = item.Integral, TypeId = item.TypeId, ShowType = item.TypeId.ToDescription(), ReMark = GetRemarkFromIntegralType(item.TypeId, item.Himall_MemberIntegralRecordAction, item.ReMark) }); QueryPageModel <UserCenterGetIntegralRecordModel> pageresult = new QueryPageModel <UserCenterGetIntegralRecordModel>(); pageresult.Total = result.Total; pageresult.Models = list.ToList(); return(pageresult); }
public JsonResult CouponList(int page, int rows = 6) { QueryPageModel <Entities.CouponInfo> coupons = _iCouponService.GetIntegralCoupons(page, rows); List <Entities.CouponInfo> result = coupons.Models.ToList(); return(Json(result)); }
/// <summary> /// 判断当前用户是否领取优惠卷 /// </summary> /// <param name="couponinfo"></param> /// <param name="userId"></param> /// <returns></returns> public static int CouponIsUse(Entities.CouponInfo couponinfo, long userId) { var status = 0; CouponRecordQuery crQuery = new CouponRecordQuery(); if (userId > 0) {//检验当前会员是否可领 crQuery.CouponId = couponinfo.Id; crQuery.UserId = userId; QueryPageModel <Entities.CouponRecordInfo> pageModel = _iCouponService.GetCouponRecordList(crQuery); if (couponinfo.PerMax != 0 && pageModel.Total >= couponinfo.PerMax) { //达到个人领取最大张数 status = 1; } } if (status == 0) {//检验优惠券本身是否可领 crQuery = new CouponRecordQuery() { CouponId = couponinfo.Id }; QueryPageModel <Entities.CouponRecordInfo> pageModel = _iCouponService.GetCouponRecordList(crQuery); if (pageModel.Total >= couponinfo.Num) { //达到领取最大张数 status = 2; } } return(status); }
public JsonResult GiftList(int page, int rows = 12) { GiftQuery query = new GiftQuery(); query.skey = ""; query.status = GiftInfo.GiftSalesStatus.Normal; query.PageSize = rows; query.PageNo = page; QueryPageModel <GiftModel> gifts = _iGiftService.GetGifts(query); List <GiftModel> datalist = gifts.Models.ToList(); var result = datalist.Select(d => new { Id = d.Id, GiftName = d.GiftName, NeedIntegral = d.NeedIntegral, LimtQuantity = d.LimtQuantity, StockQuantity = d.StockQuantity, EndDate = d.EndDate, NeedGrade = d.NeedGrade, SumSales = d.SumSales, SalesStatus = d.SalesStatus, ImagePath = d.ImagePath, GiftValue = d.GiftValue, ShowImagePath = Core.MallIO.GetProductSizeImage(d.ShowImagePath, 1, (int)ImageSize.Size_350), NeedGradeName = d.NeedGradeName }).ToList(); return(Json(result)); }
/// <summary> /// 获取活动列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <FullDiscountActiveList> GetActives(FullDiscountActiveQuery query) { QueryPageModel <FullDiscountActiveList> result = new QueryPageModel <FullDiscountActiveList>(); var datalist = _iFullDiscountService.GetActives(query); result.Total = datalist.Total; var actids = datalist.Models.Select(d => d.Id).ToList(); var fdparg = _iFullDiscountService.GetActivesProductCountAggregate(actids); result.Models = new List <FullDiscountActiveList>(); foreach (var item in datalist.Models) { FullDiscountActiveList _data = Mapper.Map <ActiveInfo, FullDiscountActiveList>(item); if (_data.IsAllProduct) { _data.ProductCount = -1; } else { var _parg = fdparg.FirstOrDefault(d => d.ActiveId == _data.Id); if (_parg != null) { _data.ProductCount = _parg.ProductCount; } } result.Models.Add(_data); } return(result); }
public ActionResult Coupon(int page = 1) { if (CurrentUser == null) { string url = Request.GetDisplayUrl(); string returnurl = System.Web.HttpUtility.HtmlEncode(url); return(RedirectToAction("", "Login", new { area = "Web", returnUrl = returnurl })); } int pagesize = 12; QueryPageModel <Entities.CouponInfo> coupons = _iCouponService.GetIntegralCoupons(page, pagesize); List <Entities.CouponInfo> datalist = coupons.Models.ToList(); #region 分页控制 PagingInfo info = new PagingInfo { CurrentPage = page, ItemsPerPage = pagesize, TotalItems = coupons.Total }; ViewBag.pageInfo = info; #endregion int MemberAvailableIntegrals = 0; var userInte = MemberIntegralApplication.GetMemberIntegral(CurrentUser.Id); if (userInte != null) { MemberAvailableIntegrals = userInte.AvailableIntegrals; } ViewBag.MemberAvailableIntegrals = MemberAvailableIntegrals; ViewBag.Keyword = SiteSettings.Keyword; return(View(datalist)); }
/// <summary> /// 会员购买力列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <DTO.MemberPurchasingPower> GetPurchasingPowerMember(MemberPowerQuery query) { var result = _iMemberService.GetPurchasingPowerMember(query); QueryPageModel <DTO.MemberPurchasingPower> model = new QueryPageModel <MemberPurchasingPower>(); model.Total = result.Total; model.Models = AutoMapper.Mapper.Map <List <DTO.MemberPurchasingPower> >(result.Models); var userIds = model.Models.Select(p => p.Id).ToArray(); var memberCategorys = _iMemberService.GetMemberBuyCategoryByUserIds(userIds); var grades = MemberGradeApplication.GetMemberGradeList(); var integrals = MemberIntegralApplication.GetMemberIntegrals(userIds); foreach (var item in model.Models) { var intergral = integrals.Where(a => a.MemberId == item.Id).Select(a => a.HistoryIntegrals).FirstOrDefault(); //填充等级数据 item.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, intergral).GradeName; //填充分类数据 var categoryNames = memberCategorys.Where(p => p.UserId == item.Id).Select(p => p.CategoryName).Take(3).ToArray(); if (categoryNames.Length == 0) { continue; } item.CategoryNames = string.Join(",", categoryNames); } return(model); }
public QueryPageModel <ChargeDetailInfo> GetChargeLists(ChargeQuery query) { //var charges = Context.ChargeDetailInfo.AsQueryable(); var charges = DbFactory.Default.Get <ChargeDetailInfo>(); if (query.ChargeStatus.HasValue) { charges = charges.Where(e => e.ChargeStatus == query.ChargeStatus.Value); } if (query.memberId.HasValue) { charges = charges.Where(e => e.MemId == query.memberId.Value); } if (query.ChargeNo.HasValue) { charges = charges.Where(e => e.Id == query.ChargeNo.Value); } //int total = 0; //var model = charges.GetPage(p => p.OrderByDescending(o => o.CreateTime), out total, query.PageNo, query.PageSize); var model = charges.OrderByDescending(o => o.CreateTime).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <ChargeDetailInfo> result = new QueryPageModel <ChargeDetailInfo> { Models = model, Total = model.TotalRecordCount }; return(result); }