Exemplo n.º 1
0
        public JsonResult Recordlist(int page, int rows)
        {
            ShopQuery query = new ShopQuery()
            {
                BrandId  = CurrentSellerManager.ShopId,
                PageNo   = page,
                PageSize = rows
            };

            ObsoletePageModel <ShopRenewRecord> 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 }));
        }
Exemplo n.º 2
0
 public void GetShopsTest()
 {
     ShopQuery queryModel = new ShopQuery
     {
         ShopName = "店铺"
     };
     var    service = Instance <IShopService> .Create;
     var    shops   = service.GetShops(queryModel);
     string s       = "";
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取店铺信息(以分页的形式展示)
        /// </summary>
        /// <param name="shopQueryModel">ShopQuery对象</param>
        /// <returns></returns>
        public static QueryPageModel <Shop> GetShops(ShopQuery shopQueryModel)
        {
            var data = Service.GetShops(shopQueryModel);

            return(new QueryPageModel <Shop>()
            {
                Models = data.Models.Map <List <Shop> >(),
                Total = data.Total
            });
        }
Exemplo n.º 4
0
        public JsonResult List(long?shopGradeId, int?shopStatus, int page, int rows, string shopName, string companyName, string shopAccount, string type = "")
        {
            ShopInfo.ShopAuditStatus?nullable;
            ShopQuery shopQuery = new ShopQuery();

            shopQuery.PageSize    = rows;
            shopQuery.PageNo      = page;
            shopQuery.ShopName    = shopName;
            shopQuery.ShopAccount = shopAccount;
            shopQuery.CompanyName = companyName;
            shopQuery.ShopGradeId = shopGradeId;
            shopQuery.Type        = type;
            ShopQuery shopQuery1 = shopQuery;
            int?      nullable1  = shopStatus;

            if (nullable1.HasValue)
            {
                nullable = new ShopInfo.ShopAuditStatus?((ShopInfo.ShopAuditStatus)nullable1.GetValueOrDefault());
            }
            else
            {
                nullable = null;
            }
            shopQuery1.Status = nullable;
            PageModel <ShopInfo> shops = ServiceHelper.Create <IShopService>().GetShops(shopQuery);

            ServiceHelper.Create <ICategoryService>();
            IShopService            shopService = ServiceHelper.Create <IShopService>();
            IEnumerable <ShopModel> array       =
                from item in shops.Models.ToArray()
                select new ShopModel()
            {
                Id          = item.Id,
                Account     = item.ShopAccount,
                CompanyName = item.CompanyName,
                EndDate     = (type == "Auditing" ? "--" : (item.EndDate.HasValue ? item.EndDate.Value.ToString("yyyy-MM-dd") : "")),
                Name        = item.ShopName,
                ShopGrade   = (shopService.GetShopGrade(item.GradeId) == null ? "" : shopService.GetShopGrade(item.GradeId).Name),
                Status      = item.ShowShopAuditStatus.ToDescription(),
                IsSelf      = item.IsSelf,
                CreateDate  = item.CreateDate,
                Disabled    = item.Disabled
            };
            DataGridModel <ShopModel> dataGridModel = new DataGridModel <ShopModel>()
            {
                rows  = array,
                total = shops.Total
            };

            return(Json(dataGridModel));
        }
Exemplo n.º 5
0
        public JsonResult List(long?shopGradeId, int?shopStatus, int page, int rows, string shopName, string shopAccount, string type = "")
        {
            var queryModel = new ShopQuery()
            {
                Status      = (Himall.Model.ShopInfo.ShopAuditStatus?)shopStatus,
                PageSize    = rows,
                PageNo      = page,
                ShopAccount = shopAccount,
                ShopName    = shopName,
                ShopGradeId = shopGradeId
            };

            if (type == "Auditing")
            {
                if (shopStatus == null)
                {
                    queryModel.Status = Himall.Model.ShopInfo.ShopAuditStatus.WaitAudit;
                    queryModel.MoreStatus.Add(Himall.Model.ShopInfo.ShopAuditStatus.WaitConfirm);
                }
            }

            var shops        = ShopApplication.GetShops(queryModel);
            var shopGrades   = ShopApplication.GetShopGrades();
            var shopAccounts = ShopApplication.GetShopAccounts(shops.Models.Select(p => p.Id));

            var models = shops.Models.Select(item =>
            {
                var shopGrade        = shopGrades.FirstOrDefault(p => p.Id == item.GradeId);
                var shopAccountModel = shopAccounts.FirstOrDefault(p => p.ShopId == item.Id);

                return(new ShopModel()
                {
                    Id = item.Id,
                    Account = item.ShopAccount,
                    EndDate = type == "Auditing" ? "--" : item.EndDate.HasValue ? item.EndDate.Value.ToString("yyyy-MM-dd") : "",
                    Name = item.ShopName,
                    ShopGrade = shopGrade != null ? shopGrade.Name : "",
                    Status = item.EndDate < DateTime.Now ? "已过期" : item.ShowShopAuditStatus.ToDescription(),
                    IsSelf = item.IsSelf,
                    BusinessType = item.BusinessType == null ? Himall.CommonModel.ShopBusinessType.Enterprise : item.BusinessType.Value,
                    Balance = shopAccountModel != null ? shopAccountModel.Balance : 0
                });
            });

            var dataGrid = new DataGridModel <ShopModel>()
            {
                rows = models, total = shops.Total
            };

            return(Json(dataGrid));
        }
Exemplo n.º 6
0
        public JsonResult GetPlatfromMessage()
        {
            ProductQuery productQuery = new ProductQuery()
            {
                PageSize    = 10000,
                PageNo      = 1,
                AuditStatus = new ProductInfo.ProductAuditStatus[] { ProductInfo.ProductAuditStatus.WaitForAuditing },
                SaleStatus  = new ProductInfo.ProductSaleStatus?(ProductInfo.ProductSaleStatus.OnSale)
            };
            ProductQuery productQuery1 = productQuery;
            int          num           = ServiceHelper.Create <IProductService>().GetProducts(productQuery1).Models.Count();
            ShopQuery    shopQuery     = new ShopQuery()
            {
                Status   = new ShopInfo.ShopAuditStatus?(0),
                PageSize = 10000,
                PageNo   = 1
            };
            int num1 = (
                from s in ServiceHelper.Create <IShopService>().GetShops(shopQuery).Models
                where (int)s.ShopStatus == 2 || (int)s.ShopStatus == 5 || (int)s.ShopStatus == 3
                select s).Count();
            long?          nullable       = null;
            int            num2           = ServiceHelper.Create <IBrandService>().GetShopBrandApplys(nullable, new int?(0), 1, 10000, "").Models.Count();
            ComplaintQuery complaintQuery = new ComplaintQuery()
            {
                Status   = new OrderComplaintInfo.ComplaintStatus?(OrderComplaintInfo.ComplaintStatus.Dispute),
                PageSize = 10000,
                PageNo   = 1
            };
            ComplaintQuery complaintQuery1 = complaintQuery;
            int            num3            = ServiceHelper.Create <IComplaintService>().GetOrderComplaints(complaintQuery1).Models.Count();
            RefundQuery    refundQuery     = new RefundQuery()
            {
                ConfirmStatus = new OrderRefundInfo.OrderRefundConfirmStatus?(OrderRefundInfo.OrderRefundConfirmStatus.UnConfirm),
                AuditStatus   = new OrderRefundInfo.OrderRefundAuditStatus?(OrderRefundInfo.OrderRefundAuditStatus.Audited),
                PageSize      = 10000,
                PageNo        = 1
            };
            RefundQuery refundQuery1 = refundQuery;
            int         num4         = ServiceHelper.Create <IRefundService>().GetOrderRefunds(refundQuery1).Models.Count();
            int         num5         = num + num1 + num2 + num3 + num4;

            return(Json(new { ProductWaitForAuditing = num, ShopWaitAudit = num1, BrandAudit = num2, ComplaintDispute = num3, RefundWaitAudit = num4, AllMessageCount = num5 }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public JsonResult List(ShopQuery query, string type = "")
        {
            if (type == "Auditing")
            {
                query.Status = ShopInfo.ShopAuditStatus.WaitAudit;
                query.MoreStatus.Add(ShopInfo.ShopAuditStatus.WaitConfirm);
            }
            var shops        = ShopApplication.GetShops(query);
            var shopGrades   = ShopApplication.GetShopGrades();
            var shopAccounts = ShopApplication.GetShopAccounts(shops.Models.Select(p => p.Id).ToList());
            var models       = shops.Models.Select(item =>
            {
                var shopGrade        = shopGrades.FirstOrDefault(p => p.Id == item.GradeId);
                var shopAccountModel = shopAccounts.FirstOrDefault(p => p.ShopId == item.Id);
                var shopbranchs      = ShopBranchApplication.GetShopBranchByShopId(item.Id);
                return(new ShopModel()
                {
                    Id = item.Id,
                    Account = item.ShopAccount,
                    EndDate = type == "Auditing" ? "--" : item.EndDate.HasValue ? item.EndDate.Value.ToString("yyyy-MM-dd") : "",
                    Name = item.ShopName,
                    ShopGrade = shopGrade != null ? shopGrade.Name : "",
                    Status = (item.EndDate < DateTime.Now && item.ShowShopAuditStatus == ShopInfo.ShopAuditStatus.Open) ? "已过期" : item.ShowShopAuditStatus.ToDescription(),
                    IsSelf = item.IsSelf,
                    BusinessType = item.BusinessType == null ? CommonModel.ShopBusinessType.Enterprise : item.BusinessType.Value,
                    Balance = shopAccountModel != null ? shopAccountModel.Balance : 0,
                    ShopBranchCount = shopbranchs.Count()
                });
            });

            var dataGrid = new DataGridModel <ShopModel>()
            {
                rows = models, total = shops.Total
            };

            return(Json(dataGrid));
        }
Exemplo n.º 8
0
        public ActionResult Index(string keywords = "", long categoryId = 0, long brandId = 0, int orderBy = 0, int pageNo = 1, int pageSize = 40)
        {
            ShopQuery queryModel = new ShopQuery
            {
                ShopName   = keywords,
                CategoryId = categoryId,
                BrandId    = brandId,
                PageNo     = pageNo,
                PageSize   = pageSize,
                OrderBy    = orderBy,
                Status     = ShopInfo.ShopAuditStatus.Open
            };

            var shopService = _iShopService;
            var model       = shopService.GetShops(queryModel);
            var shops       = model.Models.ToList();

            var defaultValue = "5.00";

            Dictionary <long, string> brands    = new Dictionary <long, string>();
            Dictionary <long, string> categorys = new Dictionary <long, string>();

            foreach (var m in shops)
            {
                //销量
                m.Sales = shopService.GetSales(m.Id);

                var shopStatisticOrderComments = _iShopService.GetShopStatisticOrderComments(m.Id);
                var productAndDescription      = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.ProductAndDescription).FirstOrDefault();
                var sellerServiceAttitude      = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerServiceAttitude).FirstOrDefault();
                var sellerDeliverySpeed        = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerDeliverySpeed).FirstOrDefault();
                //宝贝与描述
                m.ProductAndDescription = productAndDescription != null?string.Format("{00:F}", productAndDescription.CommentValue) : defaultValue;

                //卖家服务态度
                m.SellerServiceAttitude = sellerServiceAttitude != null?string.Format("{00:F}", sellerServiceAttitude.CommentValue) : defaultValue;

                //卖家发货速度
                m.SellerDeliverySpeed = sellerDeliverySpeed != null?string.Format("{00:F}", sellerDeliverySpeed.CommentValue) : defaultValue;

                foreach (var b in m.Himall_ShopBrands)  //获取品牌
                {
                    if (!brands.ContainsKey(b.BrandId))
                    {
                        brands.Add(b.BrandId, b.Himall_Brands.Name);
                    }
                }

                foreach (var p in m.Himall_Products.Where(d => d.SaleStatus == ProductInfo.ProductSaleStatus.OnSale && d.AuditStatus == ProductInfo.ProductAuditStatus.Audited))  //获取类目
                {
                    if (!categorys.ContainsKey(p.CategoryId))
                    {
                        categorys.Add(p.CategoryId, p.Himall_Categories.Name);
                    }
                    if (m.IsSelf == true)
                    {
                        if (!brands.ContainsKey(p.BrandId))
                        {
                            var branddata = _iBrandService.GetBrand(p.BrandId);
                            if (branddata != null)
                            {
                                brands.Add(branddata.Id, branddata.Name);
                            }
                        }
                        m.SellerDeliverySpeed   = "5.00";
                        m.SellerServiceAttitude = "5.00";
                        m.ProductAndDescription = "5.00";
                    }
                }
            }

            PagingInfo info = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = model.Total
            };

            ViewBag.pageInfo   = info;
            ViewBag.QueryModel = queryModel;
            ViewBag.Brands     = brands;
            ViewBag.Categorys  = categorys;

            return(View(shops));
        }
Exemplo n.º 9
0
 public static int GetShopCount(ShopQuery query)
 {
     return(BaseApplicaion <IShopService> .Service.GetShopCount(query));
 }
Exemplo n.º 10
0
        public ActionResult Index(string keywords = "", long categoryId = 0, long brandId = 0, int orderBy = 0, int pageNo = 1, int pageSize = 40)
        {
            var query = new ShopQuery
            {
                ShopName   = keywords,
                CategoryId = categoryId,
                BrandId    = brandId,
                PageNo     = pageNo,
                PageSize   = pageSize,
                Status     = Entities.ShopInfo.ShopAuditStatus.Open
            };

            if (orderBy == 1)
            {
                query.Sort = "OrderCount";
            }
            var result = new ShopSearchViewModel
            {
                Keywords         = keywords,
                CategoryId       = categoryId,
                BrandId          = brandId,
                Shops            = new List <Shop>(),
                OrderBy          = orderBy,
                IsSaleCountOnOff = SiteSettingApplication.SiteSettings.ProductSaleCountOnOff == 1
            };

            var shopData = _iShopService.GetShops(query);
            var shops    = shopData.Models;

            if (shopData.Total == 0)
            {
                return(View(result));
            }

            result.Pager = new PagingInfo
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = shopData.Total
            };
            result.Total = shopData.Total;


            var statisticList = ShopApplication.GetStatisticOrderComment(shops.Select(p => p.Id).ToList());

            var productQuery = new ProductQuery
            {
                PageNo   = 1,
                PageSize = 4,
                OnSale   = true,
                IsAsc    = false,
                Sort     = "displaysale",
            };

            foreach (var item in shops)
            {
                var shop = new Shop();
                shop.Id       = item.Id;
                shop.ShopName = item.ShopName;
                //销量
                shop.SaleCount = (int)ShopApplication.GetShopDisplaySales(item.Id);
                var statistic = statisticList.FirstOrDefault(p => p.ShopId == item.Id);
                //宝贝与描述
                shop.ProductAndDescription = string.Format("{00:F}", statistic.ProductAndDescription);
                //卖家服务态度
                shop.SellerServiceAttitude = string.Format("{00:F}", statistic.SellerServiceAttitude);
                //卖家发货速度
                shop.SellerDeliverySpeed = string.Format("{00:F}", statistic.SellerDeliverySpeed);

                //查询商品
                productQuery.ShopId = item.Id;
                var products = ProductManagerApplication.GetProducts(productQuery);
                shop.ProductCount = products.Total;
                shop.Products     = products.Models.Select(p => new Product {
                    Id         = p.Id,
                    Image      = MallIO.GetProductSizeImage(p.ImagePath, 1, (int)ImageSize.Size_150),
                    Price      = p.MinSalePrice,
                    CategoryId = p.CategoryId,
                }).ToList();
                shop.Logo = item.Logo;
                result.Shops.Add(shop);
            }

            //经营品牌
            var shopBrands = ShopApplication.GetShopBrands(shops.Select(p => p.Id).ToList());

            result.Brands = shopBrands.GroupBy(p => p.BrandId).ToDictionary(k => k.Key, v => v.FirstOrDefault().BrandName);

            //经营类型
            var CategoryIds = result.Shops.SelectMany(s => s.Products.Select(p => p.CategoryId));

            result.Categorys = CategoryApplication.GetCategories()
                               .Where(p => CategoryIds.Contains(p.Id))
                               .ToDictionary(k => k.Id, v => v.Name);

            return(View(result));
        }
Exemplo n.º 11
0
 public ShopController(ShopLocalContext _context)
 {
     context   = _context;
     shopQuery = new ShopQuery(context);
 }
Exemplo n.º 12
0
        public ActionResult Index(string keywords = "", long categoryId = 0L, long brandId = 0L, int orderBy = 0, int pageNo = 1, int pageSize = 40)
        {
            ShopQuery shopQuery = new ShopQuery()
            {
                ShopName   = keywords,
                CategoryId = categoryId,
                BrandId    = brandId,
                PageNo     = pageNo,
                PageSize   = pageSize,
                OrderBy    = orderBy
            };
            ShopQuery            shopQuery1  = shopQuery;
            IShopService         shopService = ServiceHelper.Create <IShopService>();
            PageModel <ShopInfo> shops       = shopService.GetShops(shopQuery1);
            List <ShopInfo>      list        = shops.Models.ToList();
            string str = "5";
            Dictionary <long, string> nums  = new Dictionary <long, string>();
            Dictionary <long, string> nums1 = new Dictionary <long, string>();

            foreach (ShopInfo sales in list)
            {
                sales.Sales = shopService.GetSales(sales.Id);
                IQueryable <StatisticOrderCommentsInfo> shopStatisticOrderComments = ServiceHelper.Create <IShopService>().GetShopStatisticOrderComments(sales.Id);
                StatisticOrderCommentsInfo statisticOrderCommentsInfo = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 1
                    select c).FirstOrDefault();
                StatisticOrderCommentsInfo statisticOrderCommentsInfo1 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 9
                    select c).FirstOrDefault();
                StatisticOrderCommentsInfo statisticOrderCommentsInfo2 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 9
                    select c).FirstOrDefault();
                sales.ProductAndDescription = (statisticOrderCommentsInfo != null ? string.Format("{0:F}", statisticOrderCommentsInfo.CommentValue) : str);
                sales.SellerServiceAttitude = (statisticOrderCommentsInfo1 != null ? string.Format("{0:F}", statisticOrderCommentsInfo1.CommentValue) : str);
                sales.SellerDeliverySpeed   = (statisticOrderCommentsInfo2 != null ? string.Format("{0:F}", statisticOrderCommentsInfo2.CommentValue) : str);
                foreach (ShopBrandsInfo himallShopBrand in sales.Himall_ShopBrands)
                {
                    if (nums.ContainsKey(himallShopBrand.BrandId))
                    {
                        continue;
                    }
                    nums.Add(himallShopBrand.BrandId, himallShopBrand.Himall_Brands.Name);
                }
                foreach (ProductInfo himallProduct in sales.Himall_Products)
                {
                    if (nums1.ContainsKey(himallProduct.CategoryId))
                    {
                        continue;
                    }
                    nums1.Add(himallProduct.CategoryId, himallProduct.Himall_Categories.Name);
                }
            }
            PagingInfo pagingInfo = new PagingInfo()
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = shops.Total
            };

            ViewBag.pageInfo   = pagingInfo;
            ViewBag.QueryModel = shopQuery1;
            ViewBag.Brands     = nums;
            ViewBag.Categorys  = nums1;
            return(View(list));
        }
Exemplo n.º 13
0
        public PageModel <ShopInfo> GetShops(ShopQuery shopQueryModel)
        {
            IQueryable <ShopInfo> gradeId = context.ShopInfo.AsQueryable <ShopInfo>();
            long?shopGradeId = shopQueryModel.ShopGradeId;

            if ((shopGradeId.GetValueOrDefault() <= 0 ? false : shopGradeId.HasValue))
            {
                gradeId =
                    from item in gradeId
                    where item.GradeId == shopQueryModel.ShopGradeId.Value
                    select item;
            }
            if (shopQueryModel.BrandId > 0)
            {
                gradeId =
                    from item in gradeId
                    where item.Himall_ShopBrands.Any((ShopBrandsInfo a) => a.BrandId == shopQueryModel.BrandId)
                    select item;
            }
            if (shopQueryModel.CategoryId > 0)
            {
                gradeId =
                    from item in gradeId
                    where item.Himall_Products.Any((ProductInfo a) => a.CategoryId == shopQueryModel.CategoryId)
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(shopQueryModel.ShopName))
            {
                gradeId =
                    from item in gradeId
                    where item.ShopName.Contains(shopQueryModel.ShopName)
                    select item;
            }
            if (!string.IsNullOrWhiteSpace(shopQueryModel.ShopAccount))
            {
                gradeId =
                    from item in gradeId
                    where context.ManagerInfo.Any((ManagerInfo m) => m.UserName.Equals(shopQueryModel.ShopAccount) && m.ShopId != 0 && m.RoleId == 0)
                    select item;
            }
            if (shopQueryModel.Status.HasValue && shopQueryModel.Status.Value != 0)
            {
                ShopInfo.ShopAuditStatus value = shopQueryModel.Status.Value;
                DateTime dateTime = DateTime.Now.Date.AddSeconds(-1);
                ShopInfo.ShopAuditStatus shopAuditStatu = value;
                if (shopAuditStatu == ShopInfo.ShopAuditStatus.HasExpired)
                {
                    gradeId =
                        from d in gradeId
                        where (int)d.ShopStatus == 7 && (d.EndDate < dateTime)
                        select d;
                }
                else
                {
                    gradeId = (shopAuditStatu != ShopInfo.ShopAuditStatus.Open ?
                               from d in gradeId
                               where (int)d.ShopStatus == (int)value
                               select d :
                               from d in gradeId
                               where (int)d.ShopStatus == 7 && (d.EndDate > dateTime)
                               select d);
                }
            }
            Func <IQueryable <ShopInfo>, IOrderedQueryable <ShopInfo> > func = null;

            if (shopQueryModel.OrderBy == 1)
            {
                DbSet <OrderInfo> orderInfo = context.OrderInfo;
                func = (IQueryable <ShopInfo> d) =>
                       from o in d
                       orderby orderInfo.Where((OrderInfo p) => p.ShopId == o.Id && (int)p.OrderStatus == 5).Count() descending
                       select o;
            }
            else
            {
                func = (IQueryable <ShopInfo> d) =>
                       from o in d
                       orderby o.ShopStatus descending
                       select o;
            }
            int num = gradeId.Count();

            gradeId = gradeId.GetPage(out num, shopQueryModel.PageNo, shopQueryModel.PageSize, func);
            foreach (ShopInfo list in gradeId.ToList())
            {
                ManagerInfo managerInfo = context.ManagerInfo.FirstOrDefault((ManagerInfo m) => m.ShopId.Equals(list.Id));
                list.ShopAccount = (managerInfo == null ? "" : managerInfo.UserName);
            }
            return(new PageModel <ShopInfo>()
            {
                Models = gradeId,
                Total = num
            });
        }
Exemplo n.º 14
0
 public PageModel <ShopInfo> GetAuditingShops(ShopQuery shopQueryModel)
 {
     return(null);
 }