Пример #1
0
 ///<summary>Process all Signals and Acks Since a given DateTime.  Only to be used by OpenDentalWebService.  Returns latest valid signal Date/Time.  Can throw exception.</summary>
 public static void RefreshForWeb(ref DateTime sinceDateT)
 {
     //No need to check RemotingRole; no call to db.
     try {
         if (sinceDateT.Year < 1880)
         {
             sinceDateT = MiscData.GetNowDateTime();
         }
         //Get all invalid types since given time.
         List <int> itypes = Signalods.GetInvalidTypes(Signalods.RefreshTimed(sinceDateT));
         if (itypes.Count <= 0)
         {
             return;
         }
         string itypesStr = "";
         for (int i = 0; i < itypes.Count; i++)
         {
             if (i > 0)
             {
                 itypesStr += ",";
             }
             itypesStr += ((int)itypes[i]).ToString();
         }
         //Refresh the cache for the given invalid types.
         Cache.RefreshCache(itypesStr);
         sinceDateT = OpenDentBusiness.MiscData.GetNowDateTime();
     }
     catch (Exception e) {
         //Most likely cause for an exception here would be a thread collision between 2 consumers trying to refresh the cache at the exact same instant.
         //There is a chance that performing as subsequent refresh here would cause yet another collision but it's the best we can do without redesigning the entire cache pattern.
         Cache.Refresh(InvalidType.AllLocal);
         throw new Exception("Server cache may be invalid. Please try again. Error: " + e.Message);
     }
 }