public void AddTextQuery(string name, QueryTextType type, string value) { string itemFilter; switch (type) { case QueryTextType.Equals: itemFilter = "eq"; break; case QueryTextType.StartsWith: itemFilter = "startsWith"; break; case QueryTextType.EndsWith: itemFilter = "endsWith"; break; case QueryTextType.Contains: itemFilter = "ilike"; break; case QueryTextType.WithWildcard: itemFilter = "withWildcards"; break; default: throw new NotSupportedException($"The type {type} does not exist within the QueryTextType enum."); } value = System.Net.WebUtility.UrlEncode(value); string item = $"{itemFilter}({value})"; SetParam(GetParamName(name), item); }
/// <summary> /// Sets the simple operator and value. /// </summary> /// <param name="rootObject">The root object.</param> /// <param name="complexComponentValue">The complex component value.</param> private static void SetTextOperatorAndValue(DataStructureComponentValueQueryType rootObject, IComplexComponentValue complexComponentValue) { string queryOperator = complexComponentValue.TextSearchOperator != null ? complexComponentValue.TextSearchOperator.Operator : DefaultEqualOperator; var queryTextType = new QueryTextType { @operator = queryOperator, TypedValue = complexComponentValue.Value }; var textValue = new TextValue(queryTextType); rootObject.TextValue.Add(textValue); }