Skip to content

Commit

Permalink
#747 enhance date filter - not equals - translation from code to sql
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBlaa committed Apr 3, 2024
1 parent 35bbb41 commit c970984
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Components/UI/BExIS.UI/Helpers/GridHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ private static FilterExpression convert(DataTableFilter filterDescriptor, string
Value = fd.Value
};
}
case DataTableFilterType.no:
{
return new FilterDateTimeItemExpression()
{
Field = new Field() { DataType = DataType.DateTime, Name = label },
Operator = DateTimeOperator.Operation.NotEquals,
Value = fd.Value
};
}
}

return null;
Expand Down
3 changes: 3 additions & 0 deletions Components/Utils/BExIS.Utils.NH/Querying/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public static class DateTimeOperator
{ Operation.LessThanOrEqual, Tuple.Create("<=", "({0}) <= ('{1}')") },
{ Operation.GreaterThan, Tuple.Create(">", "({0}) > ('{1}')") },
{ Operation.GreaterThanOrEqual, Tuple.Create(">=", "({0}) >= ('{1}')") },
{ Operation.NotEquals, Tuple.Create("<>", "{0} <> {1}") }
};

public static Dictionary<Operation, Tuple<string, string>> TranslationToLINQ = new Dictionary<Operation, Tuple<string, string>>()
Expand All @@ -146,6 +147,7 @@ public static class DateTimeOperator
{ Operation.LessThanOrEqual, Tuple.Create("<=", "{0} <= {1}") },
{ Operation.GreaterThan, Tuple.Create(">", "{0} > {1}") },
{ Operation.GreaterThanOrEqual, Tuple.Create(">=", "{0} >= {1}") },
{ Operation.NotEquals, Tuple.Create("<>", "{0} <> {1}") }
};

public enum Operation
Expand All @@ -155,6 +157,7 @@ public enum Operation
LessThanOrEqual = GenericOperation.LessThanOrEqual,
GreaterThan = GenericOperation.GreaterThan,
GreaterThanOrEqual = GenericOperation.GreaterThanOrEqual,
NotEquals = GenericOperation.Not,
}
}

Expand Down

0 comments on commit c970984

Please sign in to comment.