private static string BuildWhere(Filter[] filters) { string where = ""; for (int i = 0; i < filters.Length; ++i) { string filter = filters[i].GetFilterString(); if (!string.IsNullOrWhiteSpace(filter)) { if (where.Length == 0) where += "where (" + filter + ") "; else where += "AND (" + filter + ")"; } } return where; }
/// <summary> /// ors two filters into one filter /// </summary> /// <param name="first"></param> /// <param name="second"></param> /// <returns></returns> public static Filter OrFilter(Filter first, Filter second) { return new ColumnFilter(first.TablesNeeded | second.TablesNeeded, first.GetFilterString() + " OR " + second.GetFilterString()); }