public static SearchType ToSearchType(this AdvancedSearchType aOrgType) { switch (aOrgType) { case AdvancedSearchType.Alladjacent: return(SearchType.Alladjacent); case AdvancedSearchType.Allin25: return(SearchType.Allin25); case AdvancedSearchType.Allorderadjacent: return(SearchType.Allorderadjacent); case AdvancedSearchType.Allword: return(SearchType.Allword); case AdvancedSearchType.Anyword: return(SearchType.Anyword); case AdvancedSearchType.Natural: return(SearchType.Natural); case AdvancedSearchType.Someword: return(SearchType.Someword); default: return(SearchType.None); } }
/// <summary> /// Create an AdvancedSearch by the property name, how to filter the data and values to filter the data /// </summary> /// <param name="propertyName">The name of the entity property to query</param> /// <param name="type">How to query the data</param> /// <param name="valueA">The value to query</param> /// <param name="valueB">A second value to query for the "Between" filter</param> public AdvancedSearch(string propertyName, AdvancedSearchType type, object valueA, object valueB) { this.PropertyName = propertyName; this.TypeOfSearch = type; if (valueA.GetType() == typeof(int) || valueA.GetType() == typeof(int?)) { this.IntValue = (int?)valueA; } else { this.Value = valueA; } this.Value2 = valueB; }
/// <summary> /// Creates an AdvancedSearch by the name of the property to search, how to filter /// the property and a list of values /// </summary> /// <param name="propertyName">The name of the entity property to query</param> /// <param name="type">How to query the data</param> /// <param name="values">The values to filter the property on</param> public AdvancedSearch(string propertyName, AdvancedSearchType type, List <object> values) { this.PropertyName = propertyName; this.TypeOfSearch = type; this.ListValue = values; }