Ejemplo n.º 1
0
 public databases.baseDS.lastPriceDataDataTable GetLastPriceSum(AppTypes.PriceDataType type,string timeScaleCode)
 {
     try
     {
         DateTime fromDate = DateTime.Today.AddDays(-Settings.sysGlobal.DayScanForLastPrice);
         string cacheName = "lastPrice-" + type.ToString();
         databases.baseDS.lastPriceDataDataTable dataTbl = null;
         object obj = sysDataCache.Find(cacheName);
         if (obj == null)
         {
             dataTbl = databases.DbAccess.GetLastPrice(type,timeScaleCode, fromDate);
             sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
             return dataTbl;
         }
         if ((obj as DataCacheItem).timeStamp + TimeSpan.FromSeconds(Settings.sysDataDelayTimeInSecs).Ticks > DateTime.Now.Ticks)
         {
             return (databases.baseDS.lastPriceDataDataTable)(obj as DataCacheItem).data;
         }
         dataTbl = databases.DbAccess.GetLastPrice(type,timeScaleCode, fromDate);
         sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
         return dataTbl;
     }
     catch (Exception ex)
     {
         WriteSysLogLocal("WS054", ex);
     }
     return null;
 }