public List <ProductFacetCount> FindCountsOfVisibleFacets(string key, List <CategoryFacet> allFacets, List <ProductProperty> properties) { List <long> visibleFacets = FindVisibleFacetsIdsForKey(key, allFacets); List <string> sqlKeys = new List <string>(); for (int i = 0; i < allFacets.Count; i++) { if (visibleFacets.Contains(allFacets[i].Id)) { if (!IsFacetSelectedInKey(key, allFacets, allFacets[i].Id)) { // It's a visible facet, not selected // so generate all possible SQL keys for choices var p = (from pr in properties where pr.Id == allFacets[i].PropertyId select pr).SingleOrDefault(); if (p != null) { foreach (ProductPropertyChoice c in p.Choices) { string updatedKey = CategoryFacetKeyHelper.ReplaceKeyValue(key, i, c.Id); sqlKeys.Add(CategoryFacetKeyHelper.ParseKeyToSqlList(updatedKey)); } } } } } return(FindProductCountsForKeys(sqlKeys)); }
public bool IsFacetSelectedInKey(string key, List <CategoryFacet> allFacets, long facetId) { if (key == string.Empty) { return(false); } bool result = false; List <long> keyparts = CategoryFacetKeyHelper.ParseKeyToList(key); for (int i = 0; i < allFacets.Count; i++) { if (allFacets[i].Id == facetId) { if (keyparts[i] > 0) { return(true); } } } return(result); }
public static int FindCountForKey(string key, List <ProductFacetCount> counts) { string sqlKey = CategoryFacetKeyHelper.ParseKeyToSqlList(key); return(FindCountForSqlKey(sqlKey, counts)); }
public int FindCountProductIdsMatchingKey(string key) { List <long> choiceIds = CategoryFacetKeyHelper.ParseKeyToList(key); return(FindCountOfProductsContainingAllChoiceIds(choiceIds)); }
public List <string> FindProductIdsMatchingKey(string key, int pageNumber, int pageSize) { List <long> choiceIds = CategoryFacetKeyHelper.ParseKeyToList(key); return(FindProductsContainingAllChoiceIds(choiceIds, pageNumber, pageSize)); }