当前位置: 首页>>代码示例>>C#>>正文


C# Catalog.CatalogPagingFilteringModel类代码示例

本文整理汇总了C#中Nop.Web.Models.Catalog.CatalogPagingFilteringModel的典型用法代码示例。如果您正苦于以下问题:C# CatalogPagingFilteringModel类的具体用法?C# CatalogPagingFilteringModel怎么用?C# CatalogPagingFilteringModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CatalogPagingFilteringModel类属于Nop.Web.Models.Catalog命名空间,在下文中一共展示了CatalogPagingFilteringModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ManufacturerModel

 public ManufacturerModel()
 {
     PictureModel = new PictureModel();
     FeaturedProducts = new List<ProductModel>();
     Products = new List<ProductModel>();
     PagingFilteringContext = new CatalogPagingFilteringModel();
 }
开发者ID:pquic,项目名称:qCommerce,代码行数:7,代码来源:ManufacturerModel.cs

示例2: VendorModel

        private ICollection<Branch> _branches; //add by hz

        #endregion Fields

        #region Constructors

        public VendorModel()
        {
            PictureModel = new PictureModel();
            FeaturedProducts = new List<ProductOverviewModel>();
            Products = new List<ProductOverviewModel>();
            PagingFilteringContext = new CatalogPagingFilteringModel();
            Branches = new List<BranchModel>();
        }
开发者ID:priceLiu,项目名称:MulitNop,代码行数:14,代码来源:VendorModel.cs

示例3: ProductsByTagModel

 public ProductsByTagModel()
 {
     Products = new List<ProductModel>();
     PagingFilteringContext = new CatalogPagingFilteringModel();
     AvailableSortOptions = new List<SelectListItem>();
     AvailableViewModes = new List<SelectListItem>();
     PageSizeOptions = new List<SelectListItem>();
 }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:8,代码来源:ProductsByTagModel.cs

示例4: CategoryModel

 public CategoryModel()
 {
     PictureModel = new PictureModel();
     FeaturedProducts = new List<ProductOverviewModel>();
     Products = new List<ProductOverviewModel>();
     PagingFilteringContext = new CatalogPagingFilteringModel();
     SubCategories = new List<SubCategoryModel>();
     CategoryBreadcrumb = new List<CategoryModel>();
 }
开发者ID:Rustemt,项目名称:Nopcommerce-with-Couchbase,代码行数:9,代码来源:CategoryModel.cs

示例5: ManufacturerModel

 public ManufacturerModel()
 {
     PictureModel = new PictureModel();
     FeaturedProducts = new List<ProductModel>();
     Products = new List<ProductModel>();
     PagingFilteringContext = new CatalogPagingFilteringModel();
     AvailableSortOptions = new List<SelectListItem>();
     AvailableViewModes = new List<SelectListItem>();
     PageSizeOptions = new List<SelectListItem>();
 }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:10,代码来源:ManufacturerModel.cs

示例6: CategoryModel

 public CategoryModel()
 {
     PictureModel = new PictureModel();
     FeaturedProducts = new List<ProductModel>();
     Products = new List<ProductModel>();
     PagingFilteringContext = new CatalogPagingFilteringModel();
     SubCategories = new List<SubCategoryModel>();
     CategoryBreadcrumb = new List<CategoryModel>();
     AvailableSortOptions = new List<SelectListItem>();
     AvailableViewModes = new List<SelectListItem>();
     PageSizeOptions = new List<SelectListItem>();
 }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:12,代码来源:CategoryModel.cs

示例7: PrepareViewModes

        protected virtual void PrepareViewModes(CatalogPagingFilteringModel pagingFilteringModel, CatalogPagingFilteringModel command)
        {
            if (pagingFilteringModel == null)
                throw new ArgumentNullException("pagingFilteringModel");

            if (command == null)
                throw new ArgumentNullException("command");

            pagingFilteringModel.AllowProductViewModeChanging = _catalogSettings.AllowProductViewModeChanging;

            var viewMode = !string.IsNullOrEmpty(command.ViewMode)
                ? command.ViewMode
                : _catalogSettings.DefaultViewMode;
            pagingFilteringModel.ViewMode = viewMode;
            if (pagingFilteringModel.AllowProductViewModeChanging)
            {
                var currentPageUrl = _webHelper.GetThisPageUrl(true);
                //grid
                pagingFilteringModel.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Catalog.ViewMode.Grid"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=grid", null),
                    Selected = viewMode == "grid"
                });
                //list
                pagingFilteringModel.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Catalog.ViewMode.List"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=list", null),
                    Selected = viewMode == "list"
                });
            }

        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:34,代码来源:CatalogController.cs

示例8: PrepareSortingOptions

        protected virtual void PrepareSortingOptions(CatalogPagingFilteringModel pagingFilteringModel, CatalogPagingFilteringModel command)
        {
            if (pagingFilteringModel == null)
                throw new ArgumentNullException("pagingFilteringModel");

            if (command == null)
                throw new ArgumentNullException("command");

            pagingFilteringModel.AllowProductSorting = _catalogSettings.AllowProductSorting;
            if (pagingFilteringModel.AllowProductSorting)
            {
                foreach (ProductSortingEnum enumValue in Enum.GetValues(typeof(ProductSortingEnum)))
                {
                    var currentPageUrl = _webHelper.GetThisPageUrl(true);
                    var sortUrl = _webHelper.ModifyQueryString(currentPageUrl, "orderby=" + ((int)enumValue).ToString(), null);

                    var sortValue = enumValue.GetLocalizedEnum(_localizationService, _workContext);
                    pagingFilteringModel.AvailableSortOptions.Add(new SelectListItem()
                    {
                        Text = sortValue,
                        Value = sortUrl,
                        Selected = enumValue == (ProductSortingEnum)command.OrderBy
                    });
                }
            }
        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:26,代码来源:CatalogController.cs

示例9: Search

        public ActionResult Search(SearchModel model, CatalogPagingFilteringModel command)
        {
            //'Continue shopping' URL
            _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer,
                SystemCustomerAttributeNames.LastContinueShoppingPage,
                _webHelper.GetThisPageUrl(false),
                _storeContext.CurrentStore.Id);

            if (model == null)
                model = new SearchModel();

            if (model.Q == null)
                model.Q = "";
            model.Q = model.Q.Trim();



            //sorting
            PrepareSortingOptions(model.PagingFilteringContext, command);
            //view mode
            PrepareViewModes(model.PagingFilteringContext, command);
            //page size
            PreparePageSizeOptions(model.PagingFilteringContext, command,
                _catalogSettings.SearchPageAllowCustomersToSelectPageSize,
                _catalogSettings.SearchPagePageSizeOptions,
                _catalogSettings.SearchPageProductsPerPage);


            var customerRolesIds = _workContext.CurrentCustomer.CustomerRoles
                .Where(cr => cr.Active).Select(cr => cr.Id).ToList();
            string cacheKey = string.Format(ModelCacheEventConsumer.SEARCH_CATEGORIES_MODEL_KEY, _workContext.WorkingLanguage.Id, string.Join(",", customerRolesIds), _storeContext.CurrentStore.Id); 
            var categories = _cacheManager.Get(cacheKey, () =>
            {
                var categoriesModel = new List<SearchModel.CategoryModel>();
                //all categories
                foreach (var c in _categoryService.GetAllCategories())
                {
                    //generate full category name (breadcrumb)
                    string categoryBreadcrumb= "";
                    var breadcrumb = c.GetCategoryBreadCrumb(_categoryService, _aclService, _storeMappingService);
                    for (int i = 0; i <= breadcrumb.Count - 1; i++)
                    {
                        categoryBreadcrumb += breadcrumb[i].GetLocalized(x => x.Name);
                        if (i != breadcrumb.Count - 1)
                            categoryBreadcrumb += " >> ";
                    }
                    categoriesModel.Add(new SearchModel.CategoryModel()
                    {
                        Id = c.Id,
                        Breadcrumb = categoryBreadcrumb
                    });
                }
                return categoriesModel;
            });
            if (categories.Count > 0)
            {
                //first empty entry
                model.AvailableCategories.Add(new SelectListItem()
                    {
                         Value = "0",
                         Text = _localizationService.GetResource("Common.All")
                    });
                //all other categories
                foreach (var c in categories)
                {
                    model.AvailableCategories.Add(new SelectListItem()
                    {
                        Value = c.Id.ToString(),
                        Text = c.Breadcrumb,
                        Selected = model.Cid == c.Id
                    });
                }
            }

            var manufacturers = _manufacturerService.GetAllManufacturers();
            if (manufacturers.Count > 0)
            {
                model.AvailableManufacturers.Add(new SelectListItem()
                {
                    Value = "0",
                    Text = _localizationService.GetResource("Common.All")
                });
                foreach (var m in manufacturers)
                    model.AvailableManufacturers.Add(new SelectListItem()
                    {
                        Value = m.Id.ToString(),
                        Text = m.GetLocalized(x => x.Name),
                        Selected = model.Mid == m.Id
                    });
            }

            IPagedList<Product> products = new PagedList<Product>(new List<Product>(), 0, 1);
            // only search if query string search keyword is set (used to avoid searching or displaying search term min length error message on /search page load)
            if (Request.Params["Q"] != null)
            {
                if (model.Q.Length < _catalogSettings.ProductSearchTermMinimumLength)
                {
                    model.Warning = string.Format(_localizationService.GetResource("Search.SearchTermMinimumLengthIsNCharacters"), _catalogSettings.ProductSearchTermMinimumLength);
                }
                else
//.........这里部分代码省略.........
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:101,代码来源:CatalogController.cs

示例10: GetCatalogSearhModel

        private SearchModel GetCatalogSearhModel(SearchModel model, CatalogPagingFilteringModel command)
        {
            //var model = new SearchModel();
            //string cacheKey = string.Format(ModelCacheEventConsumer.SEARCH_CATEGORIES_MODEL_KEY,
            //_workContext.WorkingLanguage.Id,
            //string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
            //_storeContext.CurrentStore.Id);

            var categoryIds = new List<int>();

            var pvendorIds = new List<int>();
            var customKeys = model.ss ?? new List<string>();
            if (model.sms != null)
                customKeys.AddRange(model.sms);
            if (model.cid > 0)
                {
                categoryIds.Add(model.cid);
                var subcatids = _categoryService.GetAllCategoriesByParentCategoryId(model.cid).Select(c => c.Id).ToArray();
                    categoryIds.AddRange(subcatids);
                }

            var mdId = 0;

            decimal dsizeFrm = model.hm;
            decimal dsizeTo = model.hmx;

            PrepareViewModes(model.PagingFilteringContext, command);

            PreparePageSizeOptions(model.PagingFilteringContext, command,
               _catalogSettings.SearchPageAllowCustomersToSelectPageSize,
               _catalogSettings.SearchPagePageSizeOptions,
               _catalogSettings.SearchPageProductsPerPage);

            model.SelectedDimension = mdId;
            model.SizeFrom = dsizeFrm;
            model.SizeTo = dsizeTo;

            decimal sf = 0;
            decimal sst = 0;
            decimal varience = 10;

            var pgN = model.pg;
            var ipageSize = _catalogSettings.SearchPageProductsPerPage;
            if (command.PageSize == 0)
                command.PageSize = ipageSize;
            if (pgN == 0)
                command.PageNumber = 1;
            else command.PageNumber = pgN;

                var products = _productService.SearchProductsCustom(
                     categoryIds: categoryIds,
                     vendorIds: pvendorIds,
                     customKeys: customKeys,
                   sizeFrom: model.hm,
                   sizeTo: model.hmx,
                     varience: varience,
                     storeId: _storeContext.CurrentStore.Id,
                     visibleIndividuallyOnly: true,
                   keywords:model.q,
                     languageId: _workContext.WorkingLanguage.Id,
                   orderBy: ProductSortingEnum.Position,
                     pageIndex: command.PageNumber - 1,
                   pageSize: command.PageSize,
                   circaDateFrom:model.cdf ?? "",
                   circaDateTo: model.cdt ?? "",
                   color:model.c ?? "",
                   designBy:model.d ?? "",
                   widthFrom:model.wm,
                   widthTo: model.wmx,
                   priceMax:model.pmx,
                   priceMin:model.pm);

                model.Products = PrepareProductOverviewModelsIB(products).OrderBy(p => p.Name).ToList();
                model.PagingFilteringContext.LoadPagedList(products);

            return model;
        }
开发者ID:chamithdev,项目名称:AntiquesWeb,代码行数:77,代码来源:CatalogIBController.cs

示例11: Vendor

        public ActionResult Vendor(int vendorId, CatalogPagingFilteringModel command)
        {
            var vendor = _vendorService.GetVendorById(vendorId);
            if (vendor == null || vendor.Deleted)
                return RedirectToRoute("HomePage");

            //Check whether the current user has a "Manage catalog" permission
            //It allows him to preview a vendor before publishing
            if (!vendor.Published && !_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
                return RedirectToRoute("HomePage");

            //ACL (access control list)
            if (!_aclService.Authorize(vendor))
                return RedirectToRoute("HomePage");

            //'Continue shopping' URL
            _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer, SystemCustomerAttributeNames.LastContinueShoppingPage, _webHelper.GetThisPageUrl(false));

            if (command.PageNumber <= 0) command.PageNumber = 1;

            var model = vendor.ToModel();

            //sorting
            model.PagingFilteringContext.AllowProductSorting = _catalogSettings.AllowProductSorting;
            if (model.PagingFilteringContext.AllowProductSorting)
            {
                foreach (ProductSortingEnum enumValue in Enum.GetValues(typeof(ProductSortingEnum)))
                {
                    var currentPageUrl = _webHelper.GetThisPageUrl(true);
                    var sortUrl = _webHelper.ModifyQueryString(currentPageUrl, "orderby=" + ((int)enumValue).ToString(), null);

                    var sortValue = enumValue.GetLocalizedEnum(_localizationService, _workContext);
                    model.PagingFilteringContext.AvailableSortOptions.Add(new SelectListItem()
                    {
                        Text = sortValue,
                        Value = sortUrl,
                        Selected = enumValue == (ProductSortingEnum)command.OrderBy
                    });
                }
            }

            //view mode
            model.PagingFilteringContext.AllowProductViewModeChanging = _catalogSettings.AllowProductViewModeChanging;
            var viewMode = !string.IsNullOrEmpty(command.ViewMode)
                ? command.ViewMode
                : _catalogSettings.DefaultViewMode;
            if (model.PagingFilteringContext.AllowProductViewModeChanging)
            {
                var currentPageUrl = _webHelper.GetThisPageUrl(true);
                //grid
                model.PagingFilteringContext.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Vendors.ViewMode.Grid"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=grid", null),
                    Selected = viewMode == "grid"
                });
                //list
                model.PagingFilteringContext.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Vendors.ViewMode.List"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=list", null),
                    Selected = viewMode == "list"
                });
            }

            //page size
            model.PagingFilteringContext.AllowCustomersToSelectPageSize = false;
            if (vendor.AllowCustomersToSelectPageSize && vendor.PageSizeOptions != null)
            {
                var pageSizes = vendor.PageSizeOptions.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (pageSizes.Any())
                {
                    // get the first page size entry to use as the default (vendor page load) or if customer enters invalid value via query string
                    if (command.PageSize <= 0 || !pageSizes.Contains(command.PageSize.ToString()))
                    {
                        int temp = 0;

                        if (int.TryParse(pageSizes.FirstOrDefault(), out temp))
                        {
                            if (temp > 0)
                            {
                                command.PageSize = temp;
                            }
                        }
                    }

                    var currentPageUrl = _webHelper.GetThisPageUrl(true);
                    var sortUrl = _webHelper.ModifyQueryString(currentPageUrl, "pagesize={0}", null);
                    sortUrl = _webHelper.RemoveQueryString(sortUrl, "pagenumber");

                    foreach (var pageSize in pageSizes)
                    {
                        int temp = 0;
                        if (!int.TryParse(pageSize, out temp))
                        {
                            continue;
                        }
                        if (temp <= 0)
                        {
//.........这里部分代码省略.........
开发者ID:priceLiu,项目名称:MulitNop,代码行数:101,代码来源:VendorController.cs

示例12: Manufacturer

        public ActionResult Manufacturer(int manufacturerId, CatalogPagingFilteringModel command)
        {
            var manufacturer = _manufacturerService.GetManufacturerById(manufacturerId);
            if (manufacturer == null || manufacturer.Deleted)
                return InvokeHttp404();

            //Check whether the current user has a "Manage catalog" permission
            //It allows him to preview a manufacturer before publishing
            if (!manufacturer.Published && !_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
                return InvokeHttp404();

            //ACL (access control list)
            if (!_aclService.Authorize(manufacturer))
                return InvokeHttp404();

            //Store mapping
            if (!_storeMappingService.Authorize(manufacturer))
                return InvokeHttp404();
            
            //'Continue shopping' URL
            _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer, 
                SystemCustomerAttributeNames.LastContinueShoppingPage, 
                _webHelper.GetThisPageUrl(false),
                _storeContext.CurrentStore.Id);
            
            var model = manufacturer.ToModel();




            //sorting
            PrepareSortingOptions(model.PagingFilteringContext, command);
            //view mode
            PrepareViewModes(model.PagingFilteringContext, command);
            //page size
            PreparePageSizeOptions(model.PagingFilteringContext, command,
                manufacturer.AllowCustomersToSelectPageSize,
                manufacturer.PageSizeOptions,
                manufacturer.PageSize);


            //price ranges
            model.PagingFilteringContext.PriceRangeFilter.LoadPriceRangeFilters(manufacturer.PriceRanges, _webHelper, _priceFormatter);
            var selectedPriceRange = model.PagingFilteringContext.PriceRangeFilter.GetSelectedPriceRange(_webHelper, manufacturer.PriceRanges);
            decimal? minPriceConverted = null;
            decimal? maxPriceConverted = null;
            if (selectedPriceRange != null)
            {
                if (selectedPriceRange.From.HasValue)
                    minPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(selectedPriceRange.From.Value, _workContext.WorkingCurrency);

                if (selectedPriceRange.To.HasValue)
                    maxPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(selectedPriceRange.To.Value, _workContext.WorkingCurrency);
            }



            //featured products
            if (!_catalogSettings.IgnoreFeaturedProducts)
            {
                IPagedList<Product> featuredProducts = null;

                //We cache a value indicating whether we have featured products
                var customerRolesIds = _workContext.CurrentCustomer.CustomerRoles
                    .Where(cr => cr.Active).Select(cr => cr.Id).ToList();
                string cacheKey = string.Format(ModelCacheEventConsumer.MANUFACTURER_HAS_FEATURED_PRODUCTS_KEY, manufacturerId,
                    string.Join(",", customerRolesIds), _storeContext.CurrentStore.Id);
                var hasFeaturedProductsCache = _cacheManager.Get<bool?>(cacheKey);
                if (!hasFeaturedProductsCache.HasValue)
                {
                    //no value in the cache yet
                    //let's load products and cache the result (true/false)
                    featuredProducts = _productService.SearchProducts(
                       manufacturerId: manufacturer.Id,
                       storeId: _storeContext.CurrentStore.Id,
                       visibleIndividuallyOnly: true,
                       featuredProducts: true);
                    hasFeaturedProductsCache = featuredProducts.TotalCount > 0;
                    _cacheManager.Set(cacheKey, hasFeaturedProductsCache, 60);
                }
                if (hasFeaturedProductsCache.Value && featuredProducts == null)
                {
                    //cache indicates that the manufacturer has featured products
                    //let's load them
                    featuredProducts = _productService.SearchProducts(
                       manufacturerId: manufacturer.Id,
                       storeId: _storeContext.CurrentStore.Id,
                       visibleIndividuallyOnly: true,
                       featuredProducts: true);
                }
                if (featuredProducts != null)
                {
                    model.FeaturedProducts = PrepareProductOverviewModels(featuredProducts).ToList();
                }
            }



            //products
            IList<int> filterableSpecificationAttributeOptionIds = null;
//.........这里部分代码省略.........
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:101,代码来源:CatalogController.cs

示例13: Search

        public ActionResult Search(AUSearchModel model, CatalogPagingFilteringModel command)
        {
            //'Continue shopping' URL
            _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer,
                SystemCustomerAttributeNames.LastContinueShoppingPage,
                _webHelper.GetThisPageUrl(false),
                _storeContext.CurrentStore.Id);

            if (model == null)
            {
                model = new AUSearchModel();
            }

            var searchTerms = model.q;
            if (searchTerms == null)
                searchTerms = "";
            searchTerms = searchTerms.Trim();

             

            //sorting
            PrepareSortingOptions(model.PagingFilteringContext, command);
            //view mode
            PrepareViewModes(model.PagingFilteringContext, command);
            //page size
            PreparePageSizeOptions(model.PagingFilteringContext, command,
                _catalogSettings.SearchPageAllowCustomersToSelectPageSize,
                _catalogSettings.SearchPagePageSizeOptions,
                _catalogSettings.SearchPageProductsPerPage);

            //TODO: only show searchable categories that have an actual lot?
            string cacheKey = string.Format(ModelCacheEventConsumer.SEARCH_CATEGORIES_MODEL_KEY,
                _workContext.WorkingLanguage.Id,
                string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                _storeContext.CurrentStore.Id);
             var categories = _cacheManager.Get(cacheKey, () =>
            {
                var categoriesModel = new List<SearchModel.CategoryModel>();
                //all categories
                var allCategories = _categoryService.GetAllCategories();
                foreach (var c in allCategories)
                {
                    //generate full category name (breadcrumb)
                    string categoryBreadcrumb = "";
                    var breadcrumb = c.GetCategoryBreadCrumb(allCategories, _aclService, _storeMappingService);
                    for (int i = 0; i <= breadcrumb.Count - 1; i++)
                    {
                        categoryBreadcrumb += breadcrumb[i].GetLocalized(x => x.Name);
                        if (i != breadcrumb.Count - 1)
                            categoryBreadcrumb += " >> ";
                    }
                    categoriesModel.Add(new SearchModel.CategoryModel
                    {
                        Id = c.Id,
                        Breadcrumb = categoryBreadcrumb
                    });
                }
                return categoriesModel;
            });
            if (categories.Count > 0)
            {
                //first empty entry
                model.AvailableCategories.Add(new SelectListItem
                {
                    Value = "0",
                    Text = _localizationService.GetResource("Common.All")
                });
                //all other categories
                foreach (var c in categories)
                {
                    model.AvailableCategories.Add(new SelectListItem
                    {
                        Value = c.Id.ToString(),
                        Text = c.Breadcrumb,
                        Selected = model.cid == c.Id
                    });
                }
            }


 
            //Load up Countries dropdown only with countries assigned to lots
            string countryCacheKey = string.Format(AUConsignorCacheEventConsumer.ACTIVE_COUNTRY_NAVIGATION_PATTERN_KEY,
               _workContext.WorkingLanguage.Id,
               string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
               _storeContext.CurrentStore.Id);

            var countries = _cacheManager.Get(countryCacheKey, () =>
                {
                    var lotcountries = _consignorService.GetLotCountries();
                    return lotcountries;
                }
                );

            model.AvailableCountries.Add(new SelectListItem
            {
                Value = "0",
                Text = _localizationService.GetResource("Common.All")
            });
            //all other categories
//.........这里部分代码省略.........
开发者ID:HumanSystems,项目名称:nopcommerce-dev,代码行数:101,代码来源:AUPublicController.cs

示例14: Category


//.........这里部分代码省略.........
        //////            VendorId = x.VendorId,
        //////            CustomerGuid = x.CustomerGuid,
        //////            Firstname = (x.Addresses.Count() != 0) ? x.Addresses.First().FirstName : "No Address",
        //////            Lastname = (x.Addresses.Count() != 0) ? x.Addresses.First().LastName : "No Address",
        //////            Address1 = (x.Addresses.Count() != 0) ? x.Addresses.First().Address1 : "No Address",
        //////            Address2 = (x.Addresses.Count() != 0) ? x.Addresses.First().Address2 : "No Address",
        //////            City = (x.Addresses.Count() != 0) ? x.Addresses.First().City : "No Address",
        //////            ZipPostalCode = (x.Addresses.Count() != 0) ? x.Addresses.First().ZipPostalCode : "No Address",
        //////            Username = x.Username,
        //////            Company = (x.Addresses.Count() != 0) ? x.Addresses.First().Company : "No Address",
        //////            Phone = (x.Addresses.Count() != 0) ? x.Addresses.First().PhoneNumber : "No Address",
        //////            Email = x.Email,
        //////            AdminComment = x.AdminComment,
        //////            HasShoppingCartItems = x.HasShoppingCartItems,
        //////            Active = x.Active,
        //////            CreatedOnUtc = x.CreatedOnUtc,
        //////            LastLoginDateUtc = x.LastLoginDateUtc,
        //////            LastActivityDateUtc = x.LastActivityDateUtc
        //////        }),
        //////        Total = vendors.TotalCount
        //////    };


        //////    return Json(gridModel);
        //////}
        //TODO: what is this  DECORATION from Web CatalogController.cs
        // [NopHttpsRequirement(SslRequirement.No)]
        //WARNING!!! This is for the search page breadcrumb only!



        //TODO: what is this  DECORATION from Web CatalogController.cs
       // [NopHttpsRequirement(SslRequirement.No)]
        public ActionResult Category(int categoryId, int? saleId, string children, string allChildren, CatalogPagingFilteringModel command)
        {

            int inSaleId = saleId.GetValueOrDefault();  //NJM: make it 0 if it's null. will be null coming off the Catalog breadcrumb
            bool manageCategoriesBySale = true; //TODO: placeholder to determine type of store and if manage categories by sale

            var category = new Category();

            if (categoryId != 0)  //NJM: may pass as zero if trying to present category page for sale only- off sale navigator or sale breadcrumb
            {
                category = _categoryService.GetCategoryById(categoryId);
                if (category == null || category.Deleted)
                    return InvokeHttp404();

                //Check whether the current user has a "Manage catalog" permission
                //It allows him to preview a category before publishing
                if (!category.Published && !_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
                    return InvokeHttp404();

                //ACL (access control list)
                if (!_aclService.Authorize(category))
                    return InvokeHttp404();

                //Store mapping
                if (!_storeMappingService.Authorize(category))
                    return InvokeHttp404();
            }
            else
            {
               //NJM: TODO Stuff page info for now until you add to AUSale (like Category)
                category.AllowCustomersToSelectPageSize = true;
                category.PageSizeOptions = "6,3,9";
                category.PageSize = 6;
开发者ID:HumanSystems,项目名称:nopcommerce-dev,代码行数:67,代码来源:AUPublicController.cs

示例15: Manufacturer

        public ActionResult Manufacturer(int manufacturerId, CatalogPagingFilteringModel command)
        {
            var manufacturer = _manufacturerService.GetManufacturerById(manufacturerId);
            if (manufacturer == null || manufacturer.Deleted)
                return InvokeHttp404();

            //Check whether the current user has a "Manage catalog" permission
            //It allows him to preview a manufacturer before publishing
            if (!manufacturer.Published && !_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
                return InvokeHttp404();

            //ACL (access control list)
            if (!_aclService.Authorize(manufacturer))
                return InvokeHttp404();

            //Store mapping
            if (!_storeMappingService.Authorize(manufacturer))
                return InvokeHttp404();

            //'Continue shopping' URL
            _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer,
                SystemCustomerAttributeNames.LastContinueShoppingPage,
                _webHelper.GetThisPageUrl(false),
                _storeContext.CurrentStore.Id);

            if (command.PageNumber <= 0) command.PageNumber = 1;

            var model = manufacturer.ToModel();

            //sorting
            model.PagingFilteringContext.AllowProductSorting = _catalogSettings.AllowProductSorting;
            if (model.PagingFilteringContext.AllowProductSorting)
            {
                foreach (ProductSortingEnum enumValue in Enum.GetValues(typeof(ProductSortingEnum)))
                {
                    var currentPageUrl = _webHelper.GetThisPageUrl(true);
                    var sortUrl = _webHelper.ModifyQueryString(currentPageUrl, "orderby=" + ((int)enumValue).ToString(), null);

                    var sortValue = enumValue.GetLocalizedEnum(_localizationService, _workContext);
                    model.PagingFilteringContext.AvailableSortOptions.Add(new SelectListItem()
                    {
                        Text = sortValue,
                        Value = sortUrl,
                        Selected = enumValue == (ProductSortingEnum)command.OrderBy
                    });
                }
            }

            //view mode
            model.PagingFilteringContext.AllowProductViewModeChanging = _catalogSettings.AllowProductViewModeChanging;
            var viewMode = !string.IsNullOrEmpty(command.ViewMode)
                ? command.ViewMode
                : _catalogSettings.DefaultViewMode;
            if (model.PagingFilteringContext.AllowProductViewModeChanging)
            {
                var currentPageUrl = _webHelper.GetThisPageUrl(true);
                //grid
                model.PagingFilteringContext.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Manufacturers.ViewMode.Grid"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=grid", null),
                    Selected = viewMode == "grid"
                });
                //list
                model.PagingFilteringContext.AvailableViewModes.Add(new SelectListItem()
                {
                    Text = _localizationService.GetResource("Manufacturers.ViewMode.List"),
                    Value = _webHelper.ModifyQueryString(currentPageUrl, "viewmode=list", null),
                    Selected = viewMode == "list"
                });
            }

            //page size
            model.PagingFilteringContext.AllowCustomersToSelectPageSize = false;
            if (manufacturer.AllowCustomersToSelectPageSize && manufacturer.PageSizeOptions != null)
            {
                var pageSizes = manufacturer.PageSizeOptions.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (pageSizes.Any())
                {
                    // get the first page size entry to use as the default (manufacturer page load) or if customer enters invalid value via query string
                    if (command.PageSize <= 0 || !pageSizes.Contains(command.PageSize.ToString()))
                    {
                        int temp = 0;

                        if (int.TryParse(pageSizes.FirstOrDefault(), out temp))
                        {
                            if (temp > 0)
                            {
                                command.PageSize = temp;
                            }
                        }
                    }

                    var currentPageUrl = _webHelper.GetThisPageUrl(true);
                    var sortUrl = _webHelper.ModifyQueryString(currentPageUrl, "pagesize={0}", null);
                    sortUrl = _webHelper.RemoveQueryString(sortUrl, "pagenumber");

                    foreach (var pageSize in pageSizes)
                    {
//.........这里部分代码省略.........
开发者ID:nguyentu1982,项目名称:quancu,代码行数:101,代码来源:CatalogController.cs


注:本文中的Nop.Web.Models.Catalog.CatalogPagingFilteringModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。