Example #1
0
 ///<summary>Must be called after Preference cache has been filled.
 ///Deletes all signals older than 2 days if this has not been run within the last week.  Will fail silently if anything goes wrong.</summary>
 public static void ClearOldSignals()
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod());
         return;
     }
     try {
         if (Prefs.GetContainsKey(PrefName.SignalLastClearedDate.ToString()) &&
             PrefC.GetDateT(PrefName.SignalLastClearedDate) > MiscData.GetNowDateTime().AddDays(-7)) //Has already been run in the past week. This is all server based time.
         {
             return;                                                                                 //Do not run this process again.
         }
         string command = "";
         if (DataConnection.DBtype == DatabaseType.MySql)                                          //easier to read that using the DbHelper Functions and it also matches the ConvertDB3 script
         {
             command = "DELETE FROM signalod WHERE SigDateTime < DATE_ADD(NOW(),INTERVAL -2 DAY)"; //Itypes only older than 2 days
             Db.NonQ(command);
         }
         else                                                                           //oracle
         {
             command = "DELETE FROM signalod WHERE SigDateTime < CURRENT_TIMESTAMP -2"; //Itypes only older than 2 days
             Db.NonQ(command);
         }
         SigMessages.ClearOldSigMessages();                                            //Clear messaging buttons which use to be stored in the signal table.
         //SigElements.DeleteOrphaned();
         Prefs.UpdateDateT(PrefName.SignalLastClearedDate, MiscData.GetNowDateTime()); //Set Last cleared to now.
     }
     catch (Exception) {
         //fail silently
     }
 }
Example #2
0
 ///<summary>Used by an outside developer.</summary>
 public static bool ContainsKey(string prefName)
 {
     return(Prefs.GetContainsKey(prefName));
 }