xusc 3 weeks ago
parent
commit
27acf4c523
  1. 64
      src/aspnet-core/ICS.Common/Extension/LinqExpressionExt.cs

64
src/aspnet-core/ICS.Common/Extension/LinqExpressionExt.cs

@ -20,59 +20,57 @@ namespace ICS.Common.Extension
Expression<Func<T, bool>> condition = null;
try
{
if (filterConditionList != null && filterConditionList.Count > 0)
foreach (FilterModel filterCondition in filterConditionList)
{
foreach (FilterModel filterCondition in filterConditionList)
if (string.IsNullOrEmpty(filterCondition.ColumnAction))
{
if (string.IsNullOrEmpty(filterCondition.ColumnAction))
continue;
}
if (filterCondition.ColumnDataType != ConfigColumnDataType.type_string.ToString())
{
if (string.IsNullOrEmpty(filterCondition.ColumnValue))
{
continue;
}
if (filterCondition.ColumnDataType != ConfigColumnDataType.type_string.ToString())
}
else
{
if (ConfigColumnAction.Contains.ToString().Equals(filterCondition.ColumnAction)
|| ConfigColumnAction.NotContains.ToString().Equals(filterCondition.ColumnAction))
{
if (string.IsNullOrEmpty(filterCondition.ColumnValue))
{
continue;
}
}
else
}
Expression<Func<T, bool>> tempCondition = CreateLambda<T>(filterCondition);
if (condition == null)
{
condition = tempCondition;
}
else
{
if (tempCondition == null)
{
if (ConfigColumnAction.Contains.ToString().Equals(filterCondition.ColumnAction)
|| ConfigColumnAction.NotContains.ToString().Equals(filterCondition.ColumnAction))
{
if (string.IsNullOrEmpty(filterCondition.ColumnValue))
{
continue;
}
}
continue;
}
if (ConfigColumnLogic.AND.ToString().Equals(filterCondition.ColumnLogic))
{
condition = condition.And(tempCondition);
}
Expression<Func<T, bool>> tempCondition = CreateLambda<T>(filterCondition);
if (condition == null)
else if (ConfigColumnLogic.OR.ToString().Equals(filterCondition.ColumnLogic))
{
condition = tempCondition;
condition = condition.Or(tempCondition);
}
else
{
if (tempCondition == null)
{
continue;
}
if (ConfigColumnLogic.AND.ToString().Equals(filterCondition.ColumnLogic))
{
condition = condition.And(tempCondition);
}
else if (ConfigColumnLogic.OR.ToString().Equals(filterCondition.ColumnLogic))
{
condition = condition.Or(tempCondition);
}
else
{
}
}
}
}
}
catch (Exception ex)
{
@ -167,7 +165,7 @@ namespace ICS.Common.Extension
else if (ConfigColumnAction.LessThanOrEqual.ToString().Equals(filterCondition.ColumnAction))
{
if (ConfigColumnDataType.type_int.ToString() == filterCondition.ColumnDataType
|| ConfigColumnDataType.type_decimal.ToString() == filterCondition.ColumnDataType
|| ConfigColumnDataType.type_decimal.ToString() == filterCondition.ColumnDataType
|| ConfigColumnDataType.type_datetime.ToString() == filterCondition.ColumnDataType)
return Expression.Lambda<Func<T, bool>>(Expression.LessThanOrEqual(member, constant), parameter);
else

Loading…
Cancel
Save