This commit is contained in:
@@ -25,6 +25,7 @@ Filters are saved to the database:
|
||||
- Could be compound for joins like "table.name" (no a prepends the table name)
|
||||
- Special indirect values such as "[TAGS]" which means cross filter with tags
|
||||
- op=one of the values specified in the FilterComparisonOperator class in Biz namespace
|
||||
- Note: no Like on purpose, that would require input, better to hard code a starts with, ends with, contains and not bothering with the negative of those three as I don't see it being widely used
|
||||
- value = string version of direct comparison value or could be a special token meaning more
|
||||
- Never an empty string, empty string is invalid value
|
||||
- All Tokens are a value surrounded by this fragment: "{[XXX]}" where XXX is the token
|
||||
@@ -53,6 +54,7 @@ NOTES ABOUT WHY I DID THE FILTEROPTIONS LIKE I DID:
|
||||
// - Again, a static list of items to check against
|
||||
|
||||
|
||||
|
||||
//Where to store that?
|
||||
//all cases are via list class so really the whole thing is self contained and no need for an interface at all
|
||||
--------------------------------------------------
|
||||
|
||||
@@ -3,13 +3,14 @@ namespace AyaNova.Biz
|
||||
{
|
||||
public static class FilterComparisonOperator
|
||||
{
|
||||
//NOTE: no LIKE or NOT LIKE deliberately
|
||||
//StartsWith and EndsWith and Contains and NotContains cover all the most common cases and avoid needing a special set of LIKE characters people have to type and we have to document
|
||||
public const string Equality = "=";
|
||||
public const string GreaterThan = ">";
|
||||
public const string GreaterThanOrEqualTo = ">=";
|
||||
public const string LessThan = "<";
|
||||
public const string LessThanOrEqualTo = "<=";
|
||||
public const string NotEqual = "!=";
|
||||
public const string NotLike = "!%";
|
||||
public const string StartsWith = "%-";
|
||||
public const string EndsWith = "-%";
|
||||
public const string Contains = "-%-";
|
||||
@@ -29,7 +30,6 @@ namespace AyaNova.Biz
|
||||
operators.Add(LessThan);
|
||||
operators.Add(LessThanOrEqualTo);
|
||||
operators.Add(NotEqual);
|
||||
operators.Add(NotLike);
|
||||
operators.Add(StartsWith);
|
||||
operators.Add(EndsWith);
|
||||
operators.Add(Contains);
|
||||
|
||||
@@ -180,12 +180,6 @@ namespace AyaNova.Biz
|
||||
sb.Append("'");
|
||||
break;
|
||||
|
||||
case "Like":
|
||||
sb.Append("Like '");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
|
||||
case FilterComparisonOperator.NotEqual:
|
||||
sb.Append("<>'");
|
||||
sb.Append(sValue);
|
||||
@@ -193,47 +187,47 @@ namespace AyaNova.Biz
|
||||
break;
|
||||
|
||||
//Following 7 operators added 14-June-2006
|
||||
case "DoesNotContain":
|
||||
case FilterComparisonOperator.NotContains:
|
||||
sb.Append("Not Like '%");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
|
||||
case "Contains":
|
||||
case FilterComparisonOperator.Contains:
|
||||
sb.Append("Like '%");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
|
||||
case "StartsWith":
|
||||
case FilterComparisonOperator.StartsWith:
|
||||
sb.Append("Like '");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
|
||||
case "EndsWith":
|
||||
case FilterComparisonOperator.EndsWith:
|
||||
sb.Append("Like '%");
|
||||
sb.Append(sValue);
|
||||
sb.Append("'");
|
||||
break;
|
||||
|
||||
case "DoesNotStartWith":
|
||||
sb.Append("Not Like '");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
// case "DoesNotStartWith":
|
||||
// sb.Append("Not Like '");
|
||||
// sb.Append(sValue);
|
||||
// sb.Append("%'");
|
||||
// break;
|
||||
|
||||
case "DoesNotEndWith":
|
||||
sb.Append("Not Like '%");
|
||||
sb.Append(sValue);
|
||||
sb.Append("'");
|
||||
break;
|
||||
// case "DoesNotEndWith":
|
||||
// sb.Append("Not Like '%");
|
||||
// sb.Append(sValue);
|
||||
// sb.Append("'");
|
||||
// break;
|
||||
|
||||
case "NotLike":
|
||||
sb.Append("Not Like '");
|
||||
sb.Append(sValue);
|
||||
sb.Append("%'");
|
||||
break;
|
||||
// case "NotLike":
|
||||
// sb.Append("Not Like '");
|
||||
// sb.Append(sValue);
|
||||
// sb.Append("%'");
|
||||
// break;
|
||||
|
||||
default:
|
||||
throw new System.ArgumentOutOfRangeException("OPERATOR_TYPE", sOperator, "GridToSqlCriteria unhandled operator type [" + sOperator + "] IN STRING");
|
||||
|
||||
Reference in New Issue
Block a user