コード例 #1
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult ProductReviewList(string productName, string message, string rateStartTime, string rateEndTime, string sortColumn, string sortDirection, int pid = -1, int pageNumber = 1, int pageSize = 15)
        {
            string condition = AdminProductReviews.AdminGetProductReviewListCondition(pid, message, rateStartTime, rateEndTime);
            string sort = AdminProductReviews.AdminGetProductReviewListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminProductReviews.AdminGetProductReviewCount(condition));

            ProductReviewListModel model = new ProductReviewListModel()
            {
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                ProductReviewList = AdminProductReviews.AdminGetProductReviewList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                Pid = pid,
                ProductName = pid > 0 ? productName : "选择商品",
                Message = message,
                StartTime = rateStartTime,
                EndTime = rateEndTime
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&message={5}&pid={6}&productName={7}&startTime={8}&endTime={9}",
                                                            Url.Action("productreviewlist"),
                                                            pageModel.PageNumber, pageModel.PageSize,
                                                            sortColumn, sortDirection,
                                                            message,
                                                            pid, productName,
                                                            rateStartTime, rateEndTime));
            return View(model);
        }
コード例 #2
0
ファイル: WebPager.cs プロジェクト: JohnsonYuan/BrnShop
        private ViewContext _viewcontext = null; //视图上下文

        #endregion Fields

        #region Constructors

        public WebPager(PageModel pageModel, ViewContext viewContext)
            : base(pageModel)
        {
            _viewcontext = viewContext;

            NameValueCollection queryString = _viewcontext.RequestContext.HttpContext.Request.QueryString;
            foreach (string key in queryString.AllKeys)
            {
                if (key != null)
                    _routevalues.Add(key, queryString[key]);
            }

            if (!_routevalues.ContainsKey(_pageparamname))
                _routevalues.Add(_pageparamname, 1);
        }
コード例 #3
0
        /// <summary>
        /// 分类
        /// </summary>
        public ActionResult AjaxCategory()
        {
            //分类id
            int cateId = WebHelper.GetQueryInt("cateId");
            //品牌id
            int brandId = WebHelper.GetQueryInt("brandId");
            //筛选价格
            int filterPrice = WebHelper.GetQueryInt("filterPrice");
            //筛选属性
            string filterAttr = WebHelper.GetQueryString("filterAttr");
            //是否只显示有货
            int onlyStock = WebHelper.GetQueryInt("onlyStock");
            //排序列
            int sortColumn = WebHelper.GetQueryInt("sortColumn");
            //排序方向
            int sortDirection = WebHelper.GetQueryInt("sortDirection");
            //当前页数
            int page = WebHelper.GetQueryInt("page");

            //分类信息
            CategoryInfo categoryInfo = Categories.GetCategoryById(cateId);
            //分类价格范围列表
            string[] catePriceRangeList = StringHelper.SplitString(categoryInfo.PriceRange, "\r\n");
            //筛选属性处理
            List<int> attrValueIdList = new List<int>();
            string[] filterAttrValueIdList = StringHelper.SplitString(filterAttr, "-");
            foreach (string attrValueId in filterAttrValueIdList)
            {
                int temp = TypeHelper.StringToInt(attrValueId);
                if (temp > 0) attrValueIdList.Add(temp);
            }

            //分页对象
            PageModel pageModel = new PageModel(20, page, Products.GetCategoryProductCount(cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock));
            //视图对象
            AjaxCategoryModel model = new AjaxCategoryModel()
            {
                PageModel = pageModel,
                ProductList = Products.GetCategoryProductList(pageModel.PageSize, pageModel.PageNumber, cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock, sortColumn, sortDirection)
            };

            return Json(model, JsonRequestBehavior.AllowGet);
        }
コード例 #4
0
ファイル: StatController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 在线用户列表
        /// </summary>
        /// <param name="provinceId">省id</param>
        /// <param name="cityId">市id</param>
        /// <param name="regionId">区/县id</param>
        /// <param name="sortColumn">排序列</param>
        /// <param name="sortDirection">排序方向</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult OnlineUserList(string sortColumn, string sortDirection, int provinceId = -1, int cityId = -1, int regionId = -1, int pageNumber = 1, int pageSize = 15)
        {
            int locationType = 0, locationId = 0;
            if (regionId > 0)
            {
                locationType = 2;
                locationId = regionId;
            }
            else if (cityId > 0)
            {
                locationType = 1;
                locationId = cityId;
            }
            else if (provinceId > 0)
            {
                locationType = 0;
                locationId = provinceId;
            }

            string sort = OnlineUsers.GetOnlineUserListSort(sortColumn, sortDirection);
            PageModel pageModel = new PageModel(pageSize, pageNumber, OnlineUsers.GetOnlineUserCount(locationType, locationId));

            OnlineUserListModel model = new OnlineUserListModel()
            {
                OnlineUserList = OnlineUsers.GetOnlineUserList(pageModel.PageSize, pageModel.PageNumber, locationType, locationId, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                ProvinceId = provinceId,
                CityId = cityId,
                RegionId = regionId
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&provinceId={5}&cityId={6}&regionId={7}",
                                                          Url.Action("onlineuserlist"),
                                                          pageModel.PageNumber, pageModel.PageSize,
                                                          sortColumn, sortDirection,
                                                          provinceId, cityId, regionId));
            return View(model);
        }
コード例 #5
0
ファイル: NewsController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 新闻列表
        /// </summary>
        public ActionResult List()
        {
            string newsTitle = WebHelper.GetQueryString("newsTitle");
            int newsTypeId = WebHelper.GetQueryInt("newsTypeId");
            int page = WebHelper.GetQueryInt("page");

            if (!SecureHelper.IsSafeSqlString(newsTitle))
                return PromptView(WorkContext.UrlReferrer, "您搜索的新闻不存在");

            string condition = News.GetNewsListCondition(newsTypeId, newsTitle);
            PageModel pageModel = new PageModel(10, page, News.GetNewsCount(condition));
            NewsListModel model = new NewsListModel()
            {
                PageModel = pageModel,
                NewsList = News.GetNewsList(pageModel.PageSize, pageModel.PageNumber, condition),
                NewsTitle = newsTitle,
                NewsTypeId = newsTypeId,
                NewsTypeList = News.GetNewsTypeList()
            };

            return View(model);
        }
コード例 #6
0
ファイル: LogController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 积分日志列表
        /// </summary>
        /// <param name="accountName">账户名</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult CreditLogList(string accountName, string startTime, string endTime, int pageNumber = 1, int pageSize = 15)
        {
            int uid = AdminUsers.GetUidByAccountName(accountName);

            string condition = AdminCredits.AdminGetCreditLogListCondition(uid, startTime, endTime);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminCredits.AdminGetCreditLogCount(condition));

            CreditLogListModel model = new CreditLogListModel()
            {
                CreditLogList = AdminCredits.AdminGetCreditLogList(pageModel.PageSize, pageModel.PageNumber, condition),
                PageModel = pageModel,
                AccountName = accountName,
                StartTime = startTime,
                EndTime = endTime
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&accountName={3}&startTime={4}&endTime={5}",
                                                          Url.Action("creditloglist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          accountName, startTime, endTime));
            return View(model);
        }
コード例 #7
0
        /// <summary>
        /// 品牌选择列表
        /// </summary>
        /// <param name="brandName">品牌名称</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ContentResult SelectList(string brandName, int pageNumber = 1, int pageSize = 24)
        {
            string condition = AdminBrands.AdminGetBrandListCondition(brandName);
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBrands.AdminGetBrandCount(condition));

            DataTable brandSelectList = AdminBrands.AdminGetBrandSelectList(pageModel.PageSize, pageModel.PageNumber, condition);

            StringBuilder result = new StringBuilder("{");
            result.AppendFormat("\"totalPages\":\"{0}\",\"pageNumber\":\"{1}\",\"items\":[", pageModel.TotalPages, pageModel.PageNumber);
            foreach (DataRow row in brandSelectList.Rows)
                result.AppendFormat("{0}\"id\":\"{1}\",\"name\":\"{2}\"{3},", "{", row["brandid"], row["name"].ToString().Trim(), "}");

            if (brandSelectList.Rows.Count > 0)
                result.Remove(result.Length - 1, 1);

            result.Append("]}");
            return Content(result.ToString());
        }
コード例 #8
0
ファイル: StatController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 商品统计
        /// </summary>
        /// <param name="productName">商品名称</param>
        /// <param name="categoryName">分类名称</param>
        /// <param name="brandName">品牌名称</param>
        /// <param name="sortOptions">排序</param>
        /// <param name="cateId">分类id</param>
        /// <param name="brandId">品牌id</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult ProductStat(string productName, string categoryName, string brandName, string sortColumn, string sortDirection, int cateId = -1, int brandId = -1, int pageNumber = 1, int pageSize = 15)
        {
            string condition = AdminProducts.AdminGetProductListCondition(productName, cateId, brandId, -1);
            string sort = AdminProducts.AdminGetProductListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminProducts.AdminGetProductCount(condition));

            DataTable productList = AdminProducts.AdminGetProductList(pageModel.PageSize, pageModel.PageNumber, condition, sort);
            StringBuilder pidList = new StringBuilder();
            foreach (DataRow row in productList.Rows)
            {
                pidList.AppendFormat("{0},", row["pid"]);
            }

            ProductStatModel model = new ProductStatModel()
            {
                ProductList = pidList.Length > 0 ? AdminProducts.GetProductSummaryList(pidList.Remove(pidList.Length - 1, 1).ToString()) : new DataTable(),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                ProductName = productName,
                CateId = cateId,
                BrandId = brandId,
                CategoryName = string.IsNullOrWhiteSpace(categoryName) ? "全部分类" : categoryName,
                BrandName = string.IsNullOrWhiteSpace(brandName) ? "全部品牌" : brandName
            };
            return View(model);
        }
コード例 #9
0
        /// <summary>
        /// 优惠劵类型列表
        /// </summary>
        /// <param name="couponTypeName">优惠劵类型名称</param>
        /// <param name="type">类型0代表正在发放,1代表正在使用,-1代表全部</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult CouponTypeList(string couponTypeName, int type = -1, int pageNumber = 1, int pageSize = 15)
        {
            string condition = AdminCoupons.AdminGetCouponTypeListCondition(type, couponTypeName);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminCoupons.AdminGetCouponTypeCount(condition));

            CouponTypeListModel model = new CouponTypeListModel()
            {
                CouponTypeList = AdminCoupons.AdminGetCouponTypeList(pageModel.PageSize, pageModel.PageNumber, condition),
                PageModel = pageModel,
                Type = type,
                CouponTypeName = couponTypeName
            };

            List<SelectListItem> itemList = new List<SelectListItem>();
            itemList.Add(new SelectListItem() { Text = "全部", Value = "-1" });
            itemList.Add(new SelectListItem() { Text = "正在发放", Value = "0" });
            itemList.Add(new SelectListItem() { Text = "正在使用", Value = "1" });
            ViewData["typeList"] = itemList;

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&CouponTypeName={3}&type={4}",
                                                          Url.Action("coupontypelist"),
                                                          pageModel.PageNumber, pageModel.PageSize,
                                                          couponTypeName, type));
            return View(model);
        }
コード例 #10
0
        /// <summary>
        /// 品牌列表
        /// </summary>
        /// <param name="brandName">品牌名称</param>
        /// <param name="sortColumn">排序列</param>
        /// <param name="sortDirection">排序方向</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult List(string brandName, string sortColumn, string sortDirection, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminBrands.AdminGetBrandListCondition(brandName);
            string sort = AdminBrands.AdminGetBrandListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBrands.AdminGetBrandCount(condition));

            BrandListModel model = new BrandListModel()
            {
                BrandList = AdminBrands.AdminGetBrandList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                BrandName = brandName
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&brandName={5}",
                                                          Url.Action("list"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          brandName));
            return View(model);
        }
コード例 #11
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult AjaxProductReviewList()
        {
            int pid = WebHelper.GetQueryInt("pid");
            int reviewType = WebHelper.GetQueryInt("reviewType");
            int page = WebHelper.GetQueryInt("page");

            if (reviewType < 0 || reviewType > 3) reviewType = 0;

            PageModel pageModel = new PageModel(10, page, ProductReviews.GetProductReviewCount(pid, reviewType));
            AjaxProductReviewListModel model = new AjaxProductReviewListModel()
            {
                Pid = pid,
                ReviewType = reviewType,
                PageModel = pageModel,
                ProductReviewList = ProductReviews.GetProductReviewList(pid, reviewType, pageModel.PageSize, pageModel.PageNumber)
            };

            return View(model);
        }
コード例 #12
0
        /// <summary>
        /// 订单退款列表
        /// </summary>
        /// <param name="osn">订单编号</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult RefundList(string osn, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminOrderRefunds.GetOrderRefundListCondition(osn);
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminOrderRefunds.GetOrderRefundCount(condition));

            OrderRefundListModel model = new OrderRefundListModel()
            {
                OrderRefundList = AdminOrderRefunds.GetOrderRefundList(pageModel.PageSize, pageModel.PageNumber, condition),
                PageModel = pageModel,
                OSN = osn
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&OSN={3}",
                                                          Url.Action("refundlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          osn));

            return View(model);
        }
コード例 #13
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int pid = WebHelper.GetQueryInt("pid");
            int consultTypeId = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int page = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);
            if (productInfo == null)
                return PromptView("/", "你访问的商品不存在");

            if (!SecureHelper.IsSafeSqlString(consultMessage))
                return PromptView(WorkContext.UrlReferrer, "您搜索的内容不存在");

            PageModel pageModel = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo = productInfo,
                CategoryInfo = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo = Brands.GetBrandById(productInfo.BrandId),
                ConsultTypeId = consultTypeId,
                ConsultMessage = consultMessage,
                PageModel = pageModel,
                ProductConsultList = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.ShopConfig.VerifyPages)
            };

            return View(model);
        }
コード例 #14
0
ファイル: AdminPager.cs プロジェクト: hzl091/BrnShop-1
 public AdminPager(PageModel pageModel)
     : base(pageModel)
 {
 }
コード例 #15
0
        /// <summary>
        /// 买送商品列表
        /// </summary>
        /// <param name="pmId">活动id</param>
        /// <returns></returns>
        public ActionResult BuySendProductList(string productName, int pmId = -1, int pid = -1, int pageSize = 15, int pageNumber = 1)
        {
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminPromotions.AdminGetBuySendProductCount(pmId, pid));

            BuySendProductListModel model = new BuySendProductListModel()
            {
                BuySendProductList = AdminPromotions.AdminGetBuySendProductList(pageSize, pageNumber, pmId, pid),
                PageModel = pageModel,
                PmId = pmId,
                Pid = pid,
                ProductName = string.IsNullOrWhiteSpace(productName) ? "选择商品" : productName
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&pmId={3}&pid={4}&productName={5}",
                                                          Url.Action("buysendproductlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          pmId,
                                                          pid,
                                                          productName));
            return View(model);
        }
コード例 #16
0
        /// <summary>
        /// 买送促销活动列表
        /// </summary>
        /// <returns></returns>
        public ActionResult BuySendPromotionList(string promotionName, string promotionTime, string sortColumn, string sortDirection, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminPromotions.AdminGetBuySendPromotionListCondition(promotionName, promotionTime);
            string sort = AdminPromotions.AdminGetBuySendPromotionListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminPromotions.AdminGetBuySendPromotionCount(condition));

            BuySendPromotionListModel model = new BuySendPromotionListModel()
            {
                BuySendPromotionList = AdminPromotions.AdminGetBuySendPromotionList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                PromotionName = promotionName,
                PromotionTime = promotionTime
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&promotionName={5}&promotionTime={6}",
                                                          Url.Action("buysendpromotionlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn, sortDirection,
                                                          promotionName, promotionTime));
            return View(model);
        }
コード例 #17
0
        /// <summary>
        /// 套装促销活动列表
        /// </summary>
        /// <returns></returns>
        public ActionResult SuitPromotionList(string productName, string promotionName, string promotionTime, string sortColumn, string sortDirection, int pid = -1, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminPromotions.AdminGetSuitPromotionListCondition(pid, promotionName, promotionTime);
            string sort = AdminPromotions.AdminGetSuitPromotionListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminPromotions.AdminGetSuitPromotionCount(condition));

            SuitPromotionListModel model = new SuitPromotionListModel()
            {
                SuitPromotionList = AdminPromotions.AdminGetSuitPromotionList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                Pid = pid,
                ProductName = string.IsNullOrWhiteSpace(productName) ? "选择商品" : productName,
                PromotionName = promotionName,
                PromotionTime = promotionTime
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&pid={5}&productName={6}&promotionName={7}&promotionTime={8}",
                                                          Url.Action("suitpromotionlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn, sortDirection,
                                                          pid, productName, promotionName, promotionTime));
            return View(model);
        }
コード例 #18
0
        /// <summary>
        /// 满赠商品列表
        /// </summary>
        /// <param name="pmId">活动id</param>
        public ActionResult FullSendProductList(int pmId = -1, int type = -1, int pageSize = 15, int pageNumber = 1)
        {
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminPromotions.AdminGetFullSendProductCount(pmId, type));

            FullSendProductListModel model = new FullSendProductListModel()
            {
                FullSendProductList = AdminPromotions.AdminGetFullSendProductList(pageSize, pageNumber, pmId, type),
                PageModel = pageModel,
                PmId = pmId,
                Type = type
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&pmId={3}&type={4}",
                                                          Url.Action("fullsendproductlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          pmId,
                                                          type));
            return View(model);
        }
コード例 #19
0
        /// <summary>
        /// 筛选词列表
        /// </summary>
        /// <param name="searchFilterWord">搜索筛选词</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult List(string searchFilterWord, int pageSize = 15, int pageNumber = 1)
        {
            List<FilterWordInfo> filterWordList = AdminFilterWords.GetFilterWordList();
            if (!string.IsNullOrWhiteSpace(searchFilterWord))
                filterWordList = filterWordList.FindAll(x => x.Match.Contains(searchFilterWord));

            PageModel pageModel = new PageModel(pageSize, pageNumber, filterWordList.Count);

            FilterWordListModel model = new FilterWordListModel()
            {
                FilterWordList = filterWordList,
                PageModel = pageModel,
                SearchFilterWord = searchFilterWord
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&searchFilterWord={3}",
                                                          Url.Action("list"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          searchFilterWord));
            return View(model);
        }
コード例 #20
0
ファイル: StatController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 销售明细
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult SaleList(string startTime, string endTime, int pageNumber = 1, int pageSize = 15)
        {
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminOrders.GetSaleProductCount(startTime, endTime));

            SaleListModel model = new SaleListModel()
            {
                SaleProductList = AdminOrders.GetSaleProductList(pageModel.PageSize, pageModel.PageNumber, startTime, endTime),
                PageModel = pageModel,
                StartTime = startTime,
                EndTime = endTime
            };
            return View(model);
        }
コード例 #21
0
        /// <summary>
        /// 搜索
        /// </summary>
        public ActionResult Search()
        {
            //搜索词
            string keyword = WebHelper.GetQueryString("keyword");
            WorkContext.SearchWord = WebHelper.HtmlEncode(keyword);
            if (keyword.Length == 0)
                return PromptView(WorkContext.UrlReferrer, "请输入搜索词");
            if (!SecureHelper.IsSafeSqlString(keyword))
                return PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在");

            //异步保存搜索历史
            Asyn.UpdateSearchHistory(WorkContext.Uid, keyword);

            //判断搜索词是否为分类名称,如果是则重定向到分类页面
            int cateId = Categories.GetCateIdByName(keyword);
            if (cateId > 0)
            {
                return Redirect(Url.Action("category", new RouteValueDictionary { { "cateId", cateId } }));
            }
            else
            {
                cateId = WebHelper.GetQueryInt("cateId");
            }

            //分类列表
            List<CategoryInfo> categoryList = null;
            //分类信息
            CategoryInfo categoryInfo = null;
            //品牌列表
            List<BrandInfo> brandList = null;

            //品牌id
            int brandId = Brands.GetBrandIdByName(keyword);
            if (brandId > 0)//当搜索词为品牌名称时
            {
                //获取品牌相关的分类
                categoryList = Brands.GetBrandCategoryList(brandId);

                //由于搜索结果的展示是以分类为基础的,所以当分类不存在时直接将搜索结果设为“搜索的商品不存在”
                if (categoryList.Count == 0)
                    return PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在");

                if (cateId > 0)
                {
                    categoryInfo = Categories.GetCategoryById(cateId);
                }
                else
                {
                    //当没有进行分类的筛选时,将分类列表中的首项设为当前选中的分类
                    categoryInfo = categoryList[0];
                    cateId = categoryInfo.CateId;
                }
                brandList = new List<BrandInfo>();
                brandList.Add(Brands.GetBrandById(brandId));
            }
            else//当搜索词为商品关键词时
            {
                //获取商品关键词相关的分类
                categoryList = Searches.GetCategoryListByKeyword(keyword);

                //由于搜索结果的展示是以分类为基础的,所以当分类不存在时直接将搜索结果设为“搜索的商品不存在”
                if (categoryList.Count == 0)
                    return PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在");

                if (cateId > 0)
                {
                    categoryInfo = Categories.GetCategoryById(cateId);
                }
                else
                {
                    categoryInfo = categoryList[0];
                    cateId = categoryInfo.CateId;
                }
                //根据商品关键词获取分类相关的品牌
                brandList = Searches.GetCategoryBrandListByKeyword(cateId, keyword);
                if (brandList.Count == 0)
                    return PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在");
                brandId = WebHelper.GetQueryInt("brandId");
            }
            //最后再检查一遍分类是否存在
            if (categoryInfo == null)
                return PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在");

            //筛选价格
            int filterPrice = WebHelper.GetQueryInt("filterPrice");
            //筛选属性
            string filterAttr = WebHelper.GetQueryString("filterAttr");
            //是否只显示有货
            int onlyStock = WebHelper.GetQueryInt("onlyStock");
            //排序列
            int sortColumn = WebHelper.GetQueryInt("sortColumn");
            //排序方向
            int sortDirection = WebHelper.GetQueryInt("sortDirection");
            //当前页数
            int page = WebHelper.GetQueryInt("page");

            //分类筛选属性及其值列表
            List<KeyValuePair<AttributeInfo, List<AttributeValueInfo>>> cateAAndVList = Categories.GetCategoryFilterAAndVList(cateId);
            //分类价格范围列表
            string[] catePriceRangeList = StringHelper.SplitString(categoryInfo.PriceRange, "\r\n");

            //筛选属性处理
            List<int> attrValueIdList = new List<int>();
            string[] filterAttrValueIdList = StringHelper.SplitString(filterAttr, "-");
            if (filterAttrValueIdList.Length != cateAAndVList.Count)//当筛选属性和分类的筛选属性数目不对应时,重置筛选属性
            {
                if (cateAAndVList.Count == 0)
                {
                    filterAttr = "0";
                }
                else
                {
                    int count = cateAAndVList.Count;
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < count; i++)
                        sb.Append("0-");
                    filterAttr = sb.Remove(sb.Length - 1, 1).ToString();
                }
            }
            else
            {
                foreach (string attrValueId in filterAttrValueIdList)
                {
                    int temp = TypeHelper.StringToInt(attrValueId);
                    if (temp > 0) attrValueIdList.Add(temp);
                }
            }

            //分页对象
            PageModel pageModel = new PageModel(20, page, Searches.GetSearchProductCount(keyword, cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock));
            //视图对象
            SearchModel model = new SearchModel()
            {
                Word = keyword,
                CateId = cateId,
                BrandId = brandId,
                FilterPrice = filterPrice,
                FilterAttr = filterAttr,
                OnlyStock = onlyStock,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                CategoryList = categoryList,
                CategoryInfo = categoryInfo,
                BrandList = brandList,
                CatePriceRangeList = catePriceRangeList,
                AAndVList = cateAAndVList,
                PageModel = pageModel,
                ProductList = Searches.SearchProducts(pageModel.PageSize, pageModel.PageNumber, keyword, cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock, sortColumn, sortDirection)
            };

            return View(model);
        }
コード例 #22
0
ファイル: StatController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 搜索词统计列表
        /// </summary>
        /// <param name="word">搜索词</param>
        /// <param name="sortColumn">排序列</param>
        /// <param name="sortDirection">排序方向</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult SearchWordStatList(string word, string sortColumn, string sortDirection, int pageNumber = 1, int pageSize = 15)
        {
            string sort = AdminSearchHistories.GetSearchWordStatListSort(sortColumn, sortDirection);
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminSearchHistories.GetSearchWordStatCount(word));

            SearchWordStatListModel model = new SearchWordStatListModel()
            {
                SearchWordStatList = AdminSearchHistories.GetSearchWordStatList(pageModel.PageSize, pageModel.PageNumber, word, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                Word = word
            };
            return View(model);
        }
コード例 #23
0
        /// <summary>
        /// 禁止IP列表
        /// </summary>
        /// <param name="ip">ip</param>
        /// <param name="sortOptions">排序</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult List(string ip, string sortColumn, string sortDirection, int pageSize = 15, int pageNumber = 1)
        {
            string sort = AdminBannedIPs.AdminGetBannedIPListSort(sortColumn, sortDirection);
            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminBannedIPs.AdminGetBannedIPCount(ip));

            BannedIPListModel model = new BannedIPListModel()
            {
                BannedIPList = AdminBannedIPs.AdminGetBannedIPList(pageModel.PageSize, pageModel.PageNumber, ip, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                IP = ip
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&ip={5}",
                                                          Url.Action("list"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          ip));
            return View(model);
        }
コード例 #24
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult AjaxProductConsultList()
        {
            int pid = WebHelper.GetQueryInt("pid");
            int consultTypeId = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int page = WebHelper.GetQueryInt("page");

            if (!SecureHelper.IsSafeSqlString(consultMessage))
                return View(new AjaxProductConsultListModel());

            PageModel pageModel = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            AjaxProductConsultListModel model = new AjaxProductConsultListModel()
            {
                Pid = pid,
                ConsultTypeId = consultTypeId,
                ConsultMessage = consultMessage,
                PageModel = pageModel,
                ProductConsultList = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.ShopConfig.VerifyPages)
            };

            return View(model);
        }
コード例 #25
0
        /// <summary>
        /// 优惠劵商品列表
        /// </summary>
        /// <param name="couponTypeId">优惠劵类型id</param>
        /// <returns></returns>
        public ActionResult CouponProductList(int couponTypeId = -1, int pid = -1, int pageSize = 15, int pageNumber = 1)
        {
            CouponTypeInfo couponTypeInfo = AdminCoupons.AdminGetCouponTypeById(couponTypeId);
            if (couponTypeInfo == null)
                return PromptView("优惠劵类型不存在");
            if (couponTypeInfo.LimitProduct == 0)
                return PromptView("此优惠劵类型没有限制商品");

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminCoupons.AdminGetCouponProductCount(couponTypeId));

            CouponProductListModel model = new CouponProductListModel()
            {
                CouponProductList = AdminCoupons.AdminGetCouponProductList(pageSize, pageNumber, couponTypeId),
                PageModel = pageModel,
                CouponTypeId = couponTypeId
            };

            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&couponTypeId={3}",
                                                          Url.Action("couponproductlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          couponTypeId));
            return View(model);
        }
コード例 #26
0
        /// <summary>
        /// 分类
        /// </summary>
        public ActionResult Category()
        {
            //分类id
            int cateId = GetRouteInt("cateId");
            if (cateId == 0)
                cateId = WebHelper.GetQueryInt("cateId");
            //品牌id
            int brandId = GetRouteInt("brandId");
            if (brandId == 0)
                brandId = WebHelper.GetQueryInt("brandId");
            //筛选价格
            int filterPrice = GetRouteInt("filterPrice");
            if (filterPrice == 0)
                filterPrice = WebHelper.GetQueryInt("filterPrice");
            //筛选属性
            string filterAttr = GetRouteString("filterAttr");
            if (filterAttr.Length == 0)
                filterAttr = WebHelper.GetQueryString("filterAttr");
            //是否只显示有货
            int onlyStock = GetRouteInt("onlyStock");
            if (onlyStock == 0)
                onlyStock = WebHelper.GetQueryInt("onlyStock");
            //排序列
            int sortColumn = GetRouteInt("sortColumn");
            if (sortColumn == 0)
                sortColumn = WebHelper.GetQueryInt("sortColumn");
            //排序方向
            int sortDirection = GetRouteInt("sortDirection");
            if (sortDirection == 0)
                sortDirection = WebHelper.GetQueryInt("sortDirection");
            //当前页数
            int page = GetRouteInt("page");
            if (page == 0)
                page = WebHelper.GetQueryInt("page");

            //分类信息
            CategoryInfo categoryInfo = Categories.GetCategoryById(cateId);
            if (categoryInfo == null)
                return PromptView("/", "此分类不存在");

            //分类关联品牌列表
            List<BrandInfo> brandList = Categories.GetCategoryBrandList(cateId);
            //分类筛选属性及其值列表
            List<KeyValuePair<AttributeInfo, List<AttributeValueInfo>>> cateAAndVList = Categories.GetCategoryFilterAAndVList(cateId);
            //分类价格范围列表
            string[] catePriceRangeList = StringHelper.SplitString(categoryInfo.PriceRange, "\r\n");

            //筛选属性处理
            List<int> attrValueIdList = new List<int>();
            string[] filterAttrValueIdList = StringHelper.SplitString(filterAttr, "-");
            if (filterAttrValueIdList.Length != cateAAndVList.Count)//当筛选属性和分类的筛选属性数目不对应时,重置筛选属性
            {
                if (cateAAndVList.Count == 0)
                {
                    filterAttr = "0";
                }
                else
                {
                    int count = cateAAndVList.Count;
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < count; i++)
                        sb.Append("0-");
                    filterAttr = sb.Remove(sb.Length - 1, 1).ToString();
                }
            }
            else
            {
                foreach (string attrValueId in filterAttrValueIdList)
                {
                    int temp = TypeHelper.StringToInt(attrValueId);
                    if (temp > 0) attrValueIdList.Add(temp);
                }
            }

            //分页对象
            PageModel pageModel = new PageModel(20, page, Products.GetCategoryProductCount(cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock));
            //视图对象
            CategoryModel model = new CategoryModel()
            {
                CateId = cateId,
                BrandId = brandId,
                FilterPrice = filterPrice,
                FilterAttr = filterAttr,
                OnlyStock = onlyStock,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                CategoryInfo = categoryInfo,
                BrandList = brandList,
                CatePriceRangeList = catePriceRangeList,
                AAndVList = cateAAndVList,
                PageModel = pageModel,
                ProductList = Products.GetCategoryProductList(pageModel.PageSize, pageModel.PageNumber, cateId, brandId, filterPrice, catePriceRangeList, attrValueIdList, onlyStock, sortColumn, sortDirection)
            };

            return View(model);
        }
コード例 #27
0
        /// <summary>
        /// 订单列表
        /// </summary>
        /// <param name="osn">订单编号</param>
        /// <param name="accountName">账户名</param>
        /// <param name="consignee">收货人</param>
        /// <param name="sortOptions">排序</param>
        /// <param name="orderState">订单状态</param>
        /// <param name="pageSize">每页数</param>
        /// <param name="pageNumber">当前页数</param>
        /// <returns></returns>
        public ActionResult OrderList(string osn, string accountName, string consignee, string sortColumn, string sortDirection, int orderState = 0, int pageSize = 15, int pageNumber = 1)
        {
            //获取用户id
            int uid = Users.GetUidByAccountName(accountName);

            string condition = AdminOrders.GetOrderListCondition(osn, uid, consignee, orderState);
            string sort = AdminOrders.GetOrderListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminOrders.GetOrderCount(condition));

            OrderListModel model = new OrderListModel()
            {
                OrderList = AdminOrders.GetOrderList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                OSN = osn,
                AccountName = accountName,
                Consignee = consignee,
                OrderState = orderState
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&OSN={5}&AccountName={6}&Consignee={7}&OrderState={8}",
                                                          Url.Action("orderlist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn, sortDirection,
                                                          osn, accountName, consignee, orderState));

            List<SelectListItem> itemList = new List<SelectListItem>();
            itemList.Add(new SelectListItem() { Text = "全部", Value = "0" });
            itemList.Add(new SelectListItem() { Text = "已提交", Value = ((int)OrderState.Submitted).ToString() });
            itemList.Add(new SelectListItem() { Text = "等待付款", Value = ((int)OrderState.WaitPaying).ToString() });
            itemList.Add(new SelectListItem() { Text = "待确认", Value = ((int)OrderState.Confirming).ToString() });
            itemList.Add(new SelectListItem() { Text = "已确认", Value = ((int)OrderState.Confirmed).ToString() });
            itemList.Add(new SelectListItem() { Text = "备货中", Value = ((int)OrderState.PreProducting).ToString() });
            itemList.Add(new SelectListItem() { Text = "已发货", Value = ((int)OrderState.Sended).ToString() });
            itemList.Add(new SelectListItem() { Text = "已完成", Value = ((int)OrderState.Completed).ToString() });
            itemList.Add(new SelectListItem() { Text = "已锁定", Value = ((int)OrderState.Locked).ToString() });
            itemList.Add(new SelectListItem() { Text = "已取消", Value = ((int)OrderState.Cancelled).ToString() });
            itemList.Add(new SelectListItem() { Text = "已退货", Value = ((int)OrderState.Returned).ToString() });
            ViewData["orderStateList"] = itemList;

            return View(model);
        }
コード例 #28
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult ProductReviewList()
        {
            int pid = WebHelper.GetQueryInt("pid");
            int reviewType = WebHelper.GetQueryInt("reviewType");
            int page = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);
            if (productInfo == null)
                return PromptView("/", "你访问的商品不存在");

            if (reviewType < 0 || reviewType > 3) reviewType = 0;

            PageModel pageModel = new PageModel(10, page, ProductReviews.GetProductReviewCount(pid, reviewType));
            ProductReviewListModel model = new ProductReviewListModel()
            {
                ProductInfo = productInfo,
                CategoryInfo = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo = Brands.GetBrandById(productInfo.BrandId),
                ReviewType = reviewType,
                PageModel = pageModel,
                ProductReviewList = ProductReviews.GetProductReviewList(pid, reviewType, pageModel.PageSize, pageModel.PageNumber)
            };

            return View(model);
        }
コード例 #29
0
        /// <summary>
        /// 商品评价列表
        /// </summary>
        public ActionResult ProductReviewList()
        {
            int pid = WebHelper.GetQueryInt("pid");
            int reviewType = WebHelper.GetQueryInt("reviewType");
            int page = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);
            if (productInfo == null)
                return PromptView(Url.Action("index", "home"), "你访问的商品不存在");

            if (reviewType < 0 || reviewType > 3) reviewType = 0;

            PageModel pageModel = new PageModel(10, page, ProductReviews.GetProductReviewCount(pid, reviewType));
            ProductReviewListModel model = new ProductReviewListModel()
            {
                ProductInfo = productInfo,
                ReviewType = reviewType,
                PageModel = pageModel,
                ProductReviewList = ProductReviews.GetProductReviewList(pid, reviewType, pageModel.PageSize, pageModel.PageNumber)
            };

            return View(model);
        }
コード例 #30
0
ファイル: NewsController.cs プロジェクト: JohnsonYuan/BrnShop
        /// <summary>
        /// 新闻列表
        /// </summary>
        public ActionResult NewsList(string newsTitle, string sortColumn, string sortDirection, int newsTypeId = 0, int pageSize = 15, int pageNumber = 1)
        {
            string condition = AdminNews.AdminGetNewsListCondition(newsTypeId, newsTitle);
            string sort = AdminNews.AdminGetNewsListSort(sortColumn, sortDirection);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminNews.AdminGetNewsCount(condition));

            NewsListModel model = new NewsListModel()
            {
                NewsList = AdminNews.AdminGetNewsList(pageModel.PageSize, pageModel.PageNumber, condition, sort),
                PageModel = pageModel,
                SortColumn = sortColumn,
                SortDirection = sortDirection,
                NewsTypeId = newsTypeId,
                NewsTitle = newsTitle
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&sortColumn={3}&sortDirection={4}&newsTypeId={5}&newsTitle={6}",
                                                          Url.Action("newslist"),
                                                          pageModel.PageNumber,
                                                          pageModel.PageSize,
                                                          sortColumn,
                                                          sortDirection,
                                                          newsTypeId,
                                                          newsTitle));
            List<SelectListItem> list = new List<SelectListItem>();
            list.Add(new SelectListItem() { Text = "全部类型", Value = "0" });
            foreach (NewsTypeInfo newsTypeInfo in AdminNews.GetNewsTypeList())
            {
                list.Add(new SelectListItem() { Text = newsTypeInfo.Name, Value = newsTypeInfo.NewsTypeId.ToString() });
            }
            ViewData["newsTypeList"] = list;
            return View(model);
        }
コード例 #31
0
        /// <summary>
        /// 优惠劵列表
        /// </summary>
        /// <param name="sn">编号</param>
        /// <param name="couponTypeId">优惠劵类型id</param>
        /// <param name="pageNumber">当前页数</param>
        /// <param name="pageSize">每页数</param>
        /// <returns></returns>
        public ActionResult CouponList(string sn, string accountName, int couponTypeId = -1, int pageNumber = 1, int pageSize = 15)
        {
            int uid = AdminUsers.GetUidByAccountName(accountName);

            string condition = AdminCoupons.AdminGetCouponListCondition(sn, uid, couponTypeId);

            PageModel pageModel = new PageModel(pageSize, pageNumber, AdminCoupons.AdminGetCouponCount(condition));

            CouponListModel model = new CouponListModel()
            {
                CouponList = AdminCoupons.AdminGetCouponList(pageModel.PageSize, pageModel.PageNumber, condition),
                PageModel = pageModel,
                CouponTypeId = couponTypeId,
                AccountName = accountName,
                SN = sn
            };
            ShopUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}&couponTypeId={3}&sn={4}&accountName={5}",
                                                           Url.Action("couponlist"),
                                                           pageModel.PageNumber, pageModel.PageSize,
                                                           couponTypeId, sn, accountName));
            return View(model);
        }