-
Notifications
You must be signed in to change notification settings - Fork 2
/
NotBeginsWith.cs
57 lines (56 loc) · 1.93 KB
/
NotBeginsWith.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using DevExpress.Data.Filtering;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DXSample.CustomFunctions {
public class NotBeginsWithFunction : ICustomFunctionDisplayAttributes {
public const string FunctionName = "NotBeginsWith";
static readonly NotBeginsWithFunction instance = new NotBeginsWithFunction();
public static void Register() {
CriteriaOperator.RegisterCustomFunction(instance);
}
public static bool Unregister() {
return CriteriaOperator.UnregisterCustomFunction(instance);
}
public FunctionCategory Category {
get { return FunctionCategory.Text; }
}
public string Description {
get { return "<description>"; }
}
public bool IsValidOperandCount(int count) {
return count == 2;
}
public bool IsValidOperandType(int operandIndex, int operandCount, Type type) {
return type == typeof(string);
}
public int MaxOperandCount {
get { return 2; }
}
public int MinOperandCount {
get { return 2; }
}
public object Evaluate(params object[] operands) {
if(operands[0] != null && operands[1] != null) {
string str1 = operands[0].ToString();
string str2 = operands[1].ToString();
return !str1.StartsWith(str2, StringComparison.InvariantCultureIgnoreCase);
}
return false;
}
public string Name {
get { return FunctionName; }
}
public string DisplayName {
get { return "Not begins with"; }
}
public object Image {
get {return "FontSizeDecrease;Office2013"; }
}
public Type ResultType(params Type[] operands) {
return typeof(bool);
}
}
}