private string SelectionToFilter(FacetSelection selection) { string result = string.Empty; switch (selection.Name.ToLower()) { case "isnew": result = " and IsNew eq true"; break; case "isimport": result = " and IsImport eq true"; break; case "miles": int max = int.Parse(selection.Value) + 10000; result = " and Miles ge " + selection.Value + " and Miles lt " + max; break; case "features": result = " and Features/any(d:d eq '" + selection.Value + "')"; break; case "packages": result = " and Packages/any(d:d eq '" + selection.Value + "')"; break; default: result = " and " + selection.Name + " eq '" + selection.Value + "'"; break; } return(result); }
public void RemoveFacet(string facetToRemove) { string working = facetToRemove.Trim().TrimEnd('|').TrimStart('|'); string[] parts = working.Split(':'); if (parts.Length > 1) { string name = parts[0]; string value = parts[1]; var selection = new FacetSelection() { Name = name, Value = value }; if (this.Selections.Contains(selection)) { this.Selections.Remove(selection); } } }