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 static int FindCountForKey(string key, List <ProductFacetCount> counts) { string sqlKey = CategoryFacetKeyHelper.ParseKeyToSqlList(key); return(FindCountForSqlKey(sqlKey, counts)); }