From 9d460fa40f48c547c7661d58e20a747ce12b7820 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 3 Dec 2018 20:48:10 +0000 Subject: [PATCH] --- server/AyaNova/biz/FilterSpecialTokens.cs | 160 ++++++++++++++++++ .../AyaNova/biz/FilterSqlCriteriaBuilder.cs | 1 + 2 files changed, 161 insertions(+) create mode 100644 server/AyaNova/biz/FilterSpecialTokens.cs diff --git a/server/AyaNova/biz/FilterSpecialTokens.cs b/server/AyaNova/biz/FilterSpecialTokens.cs new file mode 100644 index 00000000..20334106 --- /dev/null +++ b/server/AyaNova/biz/FilterSpecialTokens.cs @@ -0,0 +1,160 @@ +using System.Collections.Generic; +namespace AyaNova.Biz +{ + public static class FilterSpecialToken + { + + + // switch (UICompareValue) + // { + // //These date ones are simple + // case "[YESTERDAY]": + // case "[TODAY]": + // case "[TOMORROW]": + // case "[LAST WEEK]": + // case "[THIS WEEK]": + // case "[NEXT WEEK]": + // case "[LAST MONTH]": + // case "[THIS MONTH]": + // case "[NEXT MONTH]": + // case "[14DAYWINDOW]": + // //case 2067 + // case "[PAST]": + // case "[FUTURE]": + // case "[LASTYEAR]": + // case "[THISYEAR]": + // case "[INTHELAST3MONTHS]": + // case "[INTHELAST6MONTHS]": + // case "[INTHELASTYEAR]": + // sCompareValue = UICompareValue; + // sCompareOperator = "Custom"; + // sCompareValue2 = ""; + // sCompareOperator2 = ""; + // break; + + + // case "AH": + // sCompareOperator = "LessThanOrEqualTo";sCompareValue = "Hz"; + // sCompareOperator2 = "";sCompareValue2 = ""; + // break; + // case "IP": + // sCompareOperator = "GreaterThanOrEqualTo";sCompareValue = "I"; + // sCompareOperator2 = "LessThanOrEqualTo";sCompareValue2 = "Pz"; + // break; + // case "QZ": + // sCompareOperator = "GreaterThanOrEqualTo"; sCompareValue = "Q"; + // sCompareOperator2 = "";sCompareValue2 = ""; + // break; + // case "03": + // sCompareOperator = "LessThanOrEqualTo"; sCompareValue = "3z"; + // sCompareOperator2 = ""; sCompareValue2 = ""; + // break; + // case "46": + // sCompareOperator = "GreaterThanOrEqualTo"; sCompareValue = "4"; + // sCompareOperator2 = "LessThanOrEqualTo"; sCompareValue2 = "6z"; + // break; + // case "79": + // sCompareOperator = "GreaterThanOrEqualTo"; sCompareValue = "7"; + // sCompareOperator2 = "LessThanOrEqualTo"; sCompareValue2 = "9z"; + // break; + + // case "<0": + // sCompareOperator = "LessThan"; sCompareValue = "0"; + // sCompareOperator2 = ""; sCompareValue2 = ""; + // break; + // case "=0": + // sCompareOperator = "Equals"; sCompareValue = "0"; + // sCompareOperator2 = ""; sCompareValue2 = ""; + // break; + // case ">0": + // sCompareOperator = "GreaterThan"; sCompareValue = "0"; + // sCompareOperator2 = ""; sCompareValue2 = ""; + // break; + + + // } + + + + public const string Yesterday = "{[yesterday]}"; + public const string Today = "{[today]}"; + public const string Tomorrow = "{[tomorrow]}"; + public const string LastWeek = "{[lastweek]}"; + public const string ThisWeek = "{[thisweek]}"; + public const string NextWeek = "{[nextweek]}"; + public const string LastMonth = "{[lastmonth]}"; + public const string ThisMonth = "{[thismonth]}"; + public const string NextMonth = "{[nextmonth]}"; + public const string FourteenDayWindow = "{[14daywindow]}"; + public const string Past = "{[past]}"; + public const string Future = "{[future]}"; + public const string LastYear = "{[lastyear]}"; + public const string ThisYear = "{[thisyear]}"; + public const string InTheLast3Months = "{[last3months]}"; + public const string InTheLast6Months = "{[last6months]}"; + public const string InTheLastYear = "{[lastyear]}"; + public const string AH = "{[ah]}"; + public const string IP = "{[ip]}"; + public const string QZ = "{[qz]}"; + public const string ZeroToThree = "{[03]}"; + public const string FourToSix = "{[46]}"; + public const string SevenToNine = "{[79]}"; + public const string LessThanZero = "{[<0]}"; + // public const string Zero = "{[0]}"; + public const string GreaterThanZero = "{[>0]}"; + + //https://www.klipfolio.com/resources/articles/kpi-timeframe-comparison-metrics + //Quarters: https://www.investopedia.com/terms/q/quarter.asp + //More business time frames + public const string LastQuarter = "{[lastquarter]}"; + public const string YearToDate = "{[yeartodate]}"; + public const string QuarterToDate = "{[quartertodate]}"; + public const string MonthToDate = "{[monthtodate]}";//Isn't this just "thismonth"? + public const string Past90Days = "{[past90days]}"; + public const string Past30Days = "{[past30days]}"; + public const string Past24Hours = "{[past24hours]}"; + + //The standard calendar quarters that make up the year are: January, February, and March (Q1); April, May, and June (Q2); July, August, and September (Q3); and October, November, and December (Q4). A quarter is often shown with its relevant year, as in Q1 2018 or Q1/18 which represents the first quarter of the year 2018. + public const string Q1ThisYear = "{[q1thisyear]}"; + public const string Q2ThisYear = "{[q1thisyear]}"; + public const string Q3ThisYear = "{[q1thisyear]}"; + public const string Q4ThisYear = "{[q1thisyear]}"; + public const string Q1LastYear = "{[q1lastyear]}"; + public const string Q2LastYear = "{[q2lastyear]}"; + public const string Q3LastYear = "{[q3lastyear]}"; + public const string Q4LastYear = "{[q4lastyear]}"; + + + + + + + + public static List operators = null; + public static List Operators + { + get + { + if (operators == null) + { + operators = new List(); + operators.Add(Equality); + operators.Add(GreaterThan); + operators.Add(GreaterThanOrEqualTo); + operators.Add(LessThan); + operators.Add(LessThanOrEqualTo); + operators.Add(NotEqual); + operators.Add(NotLike); + operators.Add(StartsWith); + operators.Add(EndsWith); + operators.Add(Contains); + operators.Add(NotContains); + + } + return operators; + } + } + + + } +} diff --git a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs index 271506b6..f0de3487 100644 --- a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs +++ b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs @@ -54,6 +54,7 @@ namespace AyaNova.Biz //handle null values separately + if (sValue == "") { //strings in grids are rarely null, almost always just an empty string