Example #1
0
        public static IList <tbl_TurList> GetTurListsByKeys(this MtSearchDbDataContext dc, IEnumerable <int> tourKeys, out string hash)
        {
            List <tbl_TurList> result;

            hash = String.Format("{0}_{1}", MethodBase.GetCurrentMethod().Name, String.Join(",", tourKeys));

            if ((result = CacheHelper.GetCacheItem <List <tbl_TurList> >(hash)) != null)
            {
                return(result);
            }

            result = dc.GetAllTurLists().Where(t => tourKeys.Contains(t.TL_KEY)).ToList();

            CacheHelper.AddCacheData(hash, result, new List <string>()
            {
                TableName
            }, Globals.Settings.Cache.MediumCacheTimeout);
            return(result);
        }
Example #2
0
        public static tbl_TurList GetTurListByKey(this MtSearchDbDataContext dc, int tourKey, out string hash)
        {
            tbl_TurList tour;

            hash = String.Format("{0}_{1}", MethodBase.GetCurrentMethod().Name, tourKey);

            if ((tour = CacheHelper.GetCacheItem <tbl_TurList>(hash)) != null)
            {
                return(tour);
            }

            tour = dc.GetAllTurLists().SingleOrDefault(tp => tp.TL_KEY == tourKey);

            //CacheHelper.AddCacheData(hash, tour, new[] { TableName }, Globals.Settings.Cache.MediumCacheTimeout);
            CacheHelper.AddCacheData(hash, tour, new List <string>()
            {
                TableName
            }, Globals.Settings.Cache.MediumCacheTimeout);
            return(tour);
        }