Пример #1
0
        /// <summary>
        /// Fetch all lookup master and types if not present in cache
        /// </summary>
        private static void GetAllLookupsIfNoCache()
        {
            if (!(MemoryCache.Default.Contains(ConstantTexts.LookupTypeCacheKey) || MemoryCache.Default.Contains(ConstantTexts.LookupMasterCacheKey)))
            {
                List <DOCMN_LookupMaster> lstDOCMN_LookupMaster;
                List <DOCMN_LookupType>   lstDOCMN_LookupType;
                BLLookup       objBLLookup = new BLLookup();
                ExceptionTypes exResult    = objBLLookup.GetAllLookups(null, out lstDOCMN_LookupType, out lstDOCMN_LookupMaster);

                lstDOCMN_LookupType = lstDOCMN_LookupType.Where(x => x.IsActive == true).ToList();
                AddToCache(ConstantTexts.LookupTypeCacheKey, lstDOCMN_LookupType, DateTime.Now.AddHours(1));
                lstDOCMN_LookupMaster = lstDOCMN_LookupMaster.Where(x => x.IsActive == true).ToList();
                AddToCache(ConstantTexts.LookupMasterCacheKey, lstDOCMN_LookupMaster, DateTime.Now.AddHours(1));
            }
        }
Пример #2
0
        /// <summary>
        /// Fetch all lookup master and types if not present in cache
        /// </summary>
        private static void GetAllLookupsIfNoCache()
        {
            if (System.Web.HttpContext.Current.Cache[ConstantTexts.LookupTypeCacheKey] == null ||
                System.Web.HttpContext.Current.Cache[ConstantTexts.LookupMasterCacheKey] == null)
            {
                List <DOCMN_LookupMaster> lstDOCMN_LookupMaster;
                List <DOCMN_LookupType>   lstDOCMN_LookupType;
                BLLookup       objBLLookup = new BLLookup();
                ExceptionTypes exResult    = objBLLookup.GetAllLookups(null, out lstDOCMN_LookupType, out lstDOCMN_LookupMaster);

                AddToCache(ConstantTexts.LookupTypeCacheKey, lstDOCMN_LookupType);
                lstDOCMN_LookupMaster = lstDOCMN_LookupMaster.Where(x => x.IsActive == true).ToList();
                AddToCache(ConstantTexts.LookupMasterCacheKey, lstDOCMN_LookupMaster);
            }
        }