public static string GetFilterString( FilterDescriptor descriptor, GridViewComboBoxColumn lookupColumn, int maxTextLength) { if (descriptor == null) { return(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterOperatorNoFilter")); } StringBuilder sb = new StringBuilder(); GridFilterStringProvider.CreateFilterStringValues(descriptor, ref sb, lookupColumn); if (maxTextLength > 0 && sb.Length > maxTextLength) { sb.Remove(maxTextLength, sb.Length - maxTextLength); sb.Append("..."); } return(sb.ToString()); }
private static void CreateFilterStringValues( FilterDescriptor descriptor, ref StringBuilder sb, GridViewComboBoxColumn lookupColumn) { if (descriptor is CompositeFilterDescriptor) { bool flag = false; CompositeFilterDescriptor filterDescriptor1 = (CompositeFilterDescriptor)descriptor; if (filterDescriptor1.NotOperator) { sb.Append(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterCompositeNotOperator")); sb.Append(" "); flag = true; } foreach (FilterDescriptor filterDescriptor2 in (Collection <FilterDescriptor>)filterDescriptor1.FilterDescriptors) { if (sb.Length > 0 && !flag) { string str = string.Empty; switch (filterDescriptor1.LogicalOperator) { case FilterLogicalOperator.And: str = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterLogicalOperatorAnd"); break; case FilterLogicalOperator.Or: str = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterLogicalOperatorOr"); break; } sb.Append(str); sb.Append(' '); } flag = false; GridFilterStringProvider.CreateFilterStringValues(filterDescriptor2, ref sb, lookupColumn); } } else { sb.Append(GridFilterStringProvider.GetLocalizedFilterOperator(descriptor.Operator)); if (descriptor.Operator == FilterOperator.None || descriptor.Operator == FilterOperator.IsNull || descriptor.Operator == FilterOperator.IsNotNull) { return; } sb.Append(": \""); if (lookupColumn == null) { sb.Append(descriptor.Value); } else { object lookupValue = descriptor.Value; if (lookupColumn != null && lookupColumn.FilteringMode == GridViewFilteringMode.ValueMember) { lookupValue = lookupColumn.GetLookupValue(descriptor.Value); } if (lookupValue != null) { sb.Append(lookupValue); } else { sb.Append(descriptor.Value); } } sb.Append("\" "); } }
public static string GetFilterString( FilterDescriptor descriptor, GridViewComboBoxColumn lookupColumn) { return(GridFilterStringProvider.GetFilterString(descriptor, lookupColumn, 0)); }
public static string GetFilterString(FilterDescriptor descriptor) { return(GridFilterStringProvider.GetFilterString(descriptor, (GridViewComboBoxColumn)null, 0)); }