--- dao/DaoMqPump2/MQFilter/FilterController.cs 2014/05/20 20:05:16 2179 +++ dao/DaoMqPump2/MQFilter/FilterController.cs 2014/05/20 20:12:15 2180 @@ -32,6 +32,8 @@ public static readonly string queueNameMysql = "DAO.ALL"; public static readonly string queueNameStore = "DAO.STORE"; + TimeSpan silentPeriodBegin; + TimeSpan silentPeriodEnd; protected FilterController() { @@ -84,6 +86,24 @@ //////////// + string silentBeginStr = (string)key.GetValue("SilentPeriodBegin"); + if (silentBeginStr == null || silentBeginStr.Length == 0) + { + key.SetValue("SilentPeriodBegin", "", RegistryValueKind.String); + throw new System.ArgumentException("SilentPeriodBegin cannot be null or empty"); + } + silentPeriodBegin = TimeSpan.Parse(silentBeginStr); + + string silentEndStr = (string)key.GetValue("SilentPeriodEnd"); + if (silentEndStr == null || silentEndStr.Length == 0) + { + key.SetValue("SilentPeriodEnd", "", RegistryValueKind.String); + throw new System.ArgumentException("SilentPeriodEnd cannot be null or empty"); + } + silentPeriodEnd = TimeSpan.Parse(silentEndStr); + + //////////// + String tmpFilterTransactions = (string)key.GetValue("FilterTransactions"); if (tmpFilterTransactions == null || tmpFilterTransactions.Length == 0) { @@ -252,9 +272,9 @@ private Boolean saveForLater(Salt2Header header) { - DateTime now = DateTime.Now; - int hour = now.Hour; - if (hour >= 14 && hour < 18) + TimeSpan now = DateTime.Now.TimeOfDay; + + if (now >= silentPeriodBegin && now < silentPeriodEnd) { if (contains(header.transaktionForkortelse, this.filterTranscations) ) //Så længe vi skal være .net3.0 kompatible er LINQ problematisk (LINQ kræver 3.5)