-
Notifications
You must be signed in to change notification settings - Fork 0
/
GridFilterSubstitutor.cs
25 lines (22 loc) · 1.15 KB
/
GridFilterSubstitutor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using DevExpress.Data.Filtering;
using DevExpress.Data.Filtering.Helpers;
namespace DxSample.Filtering {
public class GridFilterSubstitutor : ClientCriteriaLazyPatcherBase.AggregatesCommonProcessingBase {
private static CriteriaOperator WrapIntoCustomFunction(CriteriaOperator param) {
return new FunctionOperator(FunctionOperatorType.Custom,
new ConstantValue("RemoveDiacritics"), param);
}
public static CriteriaOperator Substitute(CriteriaOperator source) {
return new GridFilterSubstitutor().Process(source);
}
public override CriteriaOperator Visit(FunctionOperator theOperator) {
if (theOperator.OperatorType == FunctionOperatorType.StartsWith ||
theOperator.OperatorType == FunctionOperatorType.EndsWith ||
theOperator.OperatorType == FunctionOperatorType.Contains)
return new FunctionOperator(theOperator.OperatorType,
WrapIntoCustomFunction(theOperator.Operands[0]),
WrapIntoCustomFunction(theOperator.Operands[1]));
return base.Visit(theOperator);
}
}
}