Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 string Name => FunctionName;
- public string DisplayName => "Does not begin with";
- public object Image => "FontSizeDecrease;Office2013";
- public string Description => "Hides records when the field begins with the given value";
- public FunctionCategory Category => FunctionCategory.Text;
- public int MinOperandCount => 2;
- public int MaxOperandCount => 2;
- public bool IsValidOperandCount(int count) => count == 2;
- public bool IsValidOperandType(int operandIndex, int operandCount, Type type) =>
- typeof(string);
- public Type ResultType(params Type[] operands) => typeof(bool);
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement