public static string GetCompositeExpression( CompositeFilterDescriptor filterDescriptor, Function <FilterDescriptor, object> formatValue) { StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index < filterDescriptor.filters.Count; ++index) { FilterDescriptor filter = filterDescriptor.filters[index]; CompositeFilterDescriptor filterDescriptor1 = filter as CompositeFilterDescriptor; if (filterDescriptor1 != null || !string.IsNullOrEmpty(filter.PropertyName)) { string str1 = filterDescriptor1 != null?CompositeFilterDescriptor.GetCompositeExpression(filterDescriptor1, formatValue) : FilterDescriptor.GetExpression(filter, formatValue); stringBuilder.Append(string.Format("{0}", (object)str1)); string str2 = filterDescriptor.filters.LogicalOperator == FilterLogicalOperator.And ? "AND" : "OR"; if (index < filterDescriptor.filters.Count - 1) { stringBuilder.Append(string.Format(" {0} ", (object)str2)); } } } if (stringBuilder.Length > 0) { stringBuilder.Insert(0, filterDescriptor.NotOperator ? "NOT (" : "("); stringBuilder.Append(")"); } return(stringBuilder.ToString()); }
public static string GetCompositeExpression(CompositeFilterDescriptor filterDescriptor) { return(CompositeFilterDescriptor.GetCompositeExpression(filterDescriptor, (Function <FilterDescriptor, object>)null)); }