private bool IsIncluded(IntFilterCondition filterCondition, int?filter, string entryToCheck) { var included = true; //Until removed. Negative logic is applied here. if (!int.TryParse(entryToCheck, out int intEntry) || !filter.HasValue) { return(included); } switch (filterCondition) { case IntFilterCondition.Equal: { if (filter != intEntry) { included = false; } break; } case IntFilterCondition.GreaterThan: { if (filter >= intEntry) // <= because we are using negative logic here. { included = false; } break; } case IntFilterCondition.LessThan: { if (filter <= intEntry) // >= because we are using negative logic here. { included = false; } break; } case IntFilterCondition.NotEqual: { if (filter == intEntry) { included = false; } break; } } return(included); }
} // End Enum IntFilterCondition protected void SetIntFilter(int?value, IntFilterCondition condition, int column) { int[] com = new[] { ComparisonOperators.Equal , ComparisonOperators.NotEqual , ComparisonOperators.GreaterThan , ComparisonOperators.LessThan }; if ((null != value)) { long?v = value; this.m_Rdr.SetFilter(column, LogicalOperators.AND, com[(int)condition], v); } // End if ((null != value)) } // End Sub SetIntFilter
private bool IsIncluded(IntFilterCondition filterCondition, int?filter, string entryToCheck) { bool included = true; //Until removed. Negative logic is applied here. int intEntry; if ((Int32.TryParse(entryToCheck, out intEntry)) && (filter.HasValue)) { if (filterCondition == IntFilterCondition.Equal) { if (filter != intEntry) { included = false; } } else if (filterCondition == IntFilterCondition.GreaterThan) { if (filter >= intEntry) // <= because we are using negative logic here. { included = false; } } else if (filterCondition == IntFilterCondition.LessThan) { if (filter <= intEntry) // >= because we are using negative logic here. { included = false; } } else if (filterCondition == IntFilterCondition.NotEqual) { if (filter == intEntry) { included = false; } } } return(included); }