예제 #1
0
        /// <summary>
        ///     Check if given facet is selected for the given key.
        /// </summary>
        /// <param name="key">Key string</param>
        /// <param name="allFacets">List of <see cref="CategoryFacet" /> which needs to be checked for</param>
        /// <param name="facetId"><see cref="CategoryFacet" /> id which needs to be check</param>
        /// <returns>Returns true if its selected in given key otherwise returns false</returns>
        public bool IsFacetSelectedInKey(string key, List <CategoryFacet> allFacets, long facetId)
        {
            if (key == string.Empty)
            {
                return(false);
            }

            var result = false;

            var keyparts = CategoryFacetKeyHelper.ParseKeyToList(key);

            for (var i = 0; i < allFacets.Count; i++)
            {
                if (allFacets[i].Id == facetId)
                {
                    if (keyparts[i] > 0)
                    {
                        return(true);
                    }
                }
            }

            return(result);
        }
        public int FindCountProductIdsMatchingKey(string key)
        {
            var choiceIds = CategoryFacetKeyHelper.ParseKeyToList(key);

            return(FindCountOfProductsContainingAllChoiceIds(choiceIds));
        }
        public List <string> FindProductIdsMatchingKey(string key, int pageNumber, int pageSize)
        {
            var choiceIds = CategoryFacetKeyHelper.ParseKeyToList(key);

            return(FindProductsContainingAllChoiceIds(choiceIds, pageNumber, pageSize));
        }