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)
|
- 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
|
- 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
|
- 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
|
- value = string version of direct comparison value or could be a special token meaning more
|
||||||
- Never an empty string, empty string is invalid value
|
- Never an empty string, empty string is invalid value
|
||||||
- All Tokens are a value surrounded by this fragment: "{[XXX]}" where XXX is the token
|
- 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
|
// - Again, a static list of items to check against
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Where to store that?
|
//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
|
//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
|
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 Equality = "=";
|
||||||
public const string GreaterThan = ">";
|
public const string GreaterThan = ">";
|
||||||
public const string GreaterThanOrEqualTo = ">=";
|
public const string GreaterThanOrEqualTo = ">=";
|
||||||
public const string LessThan = "<";
|
public const string LessThan = "<";
|
||||||
public const string LessThanOrEqualTo = "<=";
|
public const string LessThanOrEqualTo = "<=";
|
||||||
public const string NotEqual = "!=";
|
public const string NotEqual = "!=";
|
||||||
public const string NotLike = "!%";
|
|
||||||
public const string StartsWith = "%-";
|
public const string StartsWith = "%-";
|
||||||
public const string EndsWith = "-%";
|
public const string EndsWith = "-%";
|
||||||
public const string Contains = "-%-";
|
public const string Contains = "-%-";
|
||||||
@@ -29,7 +30,6 @@ namespace AyaNova.Biz
|
|||||||
operators.Add(LessThan);
|
operators.Add(LessThan);
|
||||||
operators.Add(LessThanOrEqualTo);
|
operators.Add(LessThanOrEqualTo);
|
||||||
operators.Add(NotEqual);
|
operators.Add(NotEqual);
|
||||||
operators.Add(NotLike);
|
|
||||||
operators.Add(StartsWith);
|
operators.Add(StartsWith);
|
||||||
operators.Add(EndsWith);
|
operators.Add(EndsWith);
|
||||||
operators.Add(Contains);
|
operators.Add(Contains);
|
||||||
|
|||||||
@@ -180,12 +180,6 @@ namespace AyaNova.Biz
|
|||||||
sb.Append("'");
|
sb.Append("'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Like":
|
|
||||||
sb.Append("Like '");
|
|
||||||
sb.Append(sValue);
|
|
||||||
sb.Append("%'");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FilterComparisonOperator.NotEqual:
|
case FilterComparisonOperator.NotEqual:
|
||||||
sb.Append("<>'");
|
sb.Append("<>'");
|
||||||
sb.Append(sValue);
|
sb.Append(sValue);
|
||||||
@@ -193,47 +187,47 @@ namespace AyaNova.Biz
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
//Following 7 operators added 14-June-2006
|
//Following 7 operators added 14-June-2006
|
||||||
case "DoesNotContain":
|
case FilterComparisonOperator.NotContains:
|
||||||
sb.Append("Not Like '%");
|
sb.Append("Not Like '%");
|
||||||
sb.Append(sValue);
|
sb.Append(sValue);
|
||||||
sb.Append("%'");
|
sb.Append("%'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Contains":
|
case FilterComparisonOperator.Contains:
|
||||||
sb.Append("Like '%");
|
sb.Append("Like '%");
|
||||||
sb.Append(sValue);
|
sb.Append(sValue);
|
||||||
sb.Append("%'");
|
sb.Append("%'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "StartsWith":
|
case FilterComparisonOperator.StartsWith:
|
||||||
sb.Append("Like '");
|
sb.Append("Like '");
|
||||||
sb.Append(sValue);
|
sb.Append(sValue);
|
||||||
sb.Append("%'");
|
sb.Append("%'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "EndsWith":
|
case FilterComparisonOperator.EndsWith:
|
||||||
sb.Append("Like '%");
|
sb.Append("Like '%");
|
||||||
sb.Append(sValue);
|
sb.Append(sValue);
|
||||||
sb.Append("'");
|
sb.Append("'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DoesNotStartWith":
|
// case "DoesNotStartWith":
|
||||||
sb.Append("Not Like '");
|
// sb.Append("Not Like '");
|
||||||
sb.Append(sValue);
|
// sb.Append(sValue);
|
||||||
sb.Append("%'");
|
// sb.Append("%'");
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case "DoesNotEndWith":
|
// case "DoesNotEndWith":
|
||||||
sb.Append("Not Like '%");
|
// sb.Append("Not Like '%");
|
||||||
sb.Append(sValue);
|
// sb.Append(sValue);
|
||||||
sb.Append("'");
|
// sb.Append("'");
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case "NotLike":
|
// case "NotLike":
|
||||||
sb.Append("Not Like '");
|
// sb.Append("Not Like '");
|
||||||
sb.Append(sValue);
|
// sb.Append(sValue);
|
||||||
sb.Append("%'");
|
// sb.Append("%'");
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new System.ArgumentOutOfRangeException("OPERATOR_TYPE", sOperator, "GridToSqlCriteria unhandled operator type [" + sOperator + "] IN STRING");
|
throw new System.ArgumentOutOfRangeException("OPERATOR_TYPE", sOperator, "GridToSqlCriteria unhandled operator type [" + sOperator + "] IN STRING");
|
||||||
|
|||||||
Reference in New Issue
Block a user