示例#1
0
        public ActionResult Index()
        {
            BusinessCache businesscache = RemotingHelp.GetModelObject <BusinessCache>();

            ViewBag.Business = businesscache.GetBusiness().obj;
            return(View());
        }
示例#2
0
        public async override Task LogAsync(bool success, string msg)
        {
            try
            {
                BusinessCache.Clear();
                BusinessCache.Load();
            }
            catch (Exception)
            {
                //ignore
            }

            await LogProvider.LogAsync(msg, success?LogType.Schedule : LogType.Error);
        }
        private static List<string> GetKeywordSynonyms(string keyword, BusinessCache cache)
        {
            var synonymString = string.Empty;

            if (!string.IsNullOrEmpty(keyword))
            {
                var cacheKey = _cacheKeyPrefix + keyword;

                if (cache.Contains(cacheKey))
                {
                    var cacheValue = cache.Get(cacheKey).ToString();
                    return StringToListOfStrings(cacheValue);
                }

                var synonyms = new StringBuilder();
                var jsonValues = GetWebServiceResponse(keyword);

                if (jsonValues.Length > 0)
                {
                    var jsonObject = JObject.Parse(jsonValues);

                    var icd9Property = jsonObject["Icd9"];

                    if (icd9Property != null)
                    {
                        var Icd9Value = icd9Property.First.Value<JProperty>();
                        var name = Icd9Value.Name;

                        var icd9Object = JObject.Parse(icd9Property.ToString());

                        if (icd9Object.First.HasValues)
                        {
                            foreach (var value in icd9Object.First.Values())
                            {
                                synonyms.Append(value + " ");
                            }
                        }

                        synonymString = StripPunctuation(synonyms.ToString()) + " " + name;
                    }

                    //cache keyword synonyms
                    cache.Put(cacheKey, synonymString, CacheSeconds.Larger);
                }
            }

            return StringToListOfStrings(synonymString);
        }
示例#4
0
        public ResultModel GetBusiness()
        {
            BusinessCache bcache = RemotingHelp.GetModelObject <BusinessCache>();

            return(bcache.GetBusiness());
        }
示例#5
0
        public ResultModel AddOrUpdateBusiness(BusinessModel businessModel)
        {
            BusinessCache bcache = RemotingHelp.GetModelObject <BusinessCache>();

            return(bcache.AddOrUpdateBusiness(businessModel));
        }
示例#6
0
文件: Cache.cs 项目: ognjenm/egle
        /// <summary>
        /// Static constructor
        /// </summary>
        static Cache()
        {
            // Declare the list that will hold an instance of each dataCache (This may include DataCacheGroup items)
            dataCaches = new List<ICachedData>();

            // Note: Implement a instance of each implementation of AbstractCache and assign it to an internal property
            // Note: Independent caches can be declared as instances of their dataCache type. For dependant caches add them to a instance of DataCacheGroup first. 
            // Note: Since DatacacheGroup also implements ICachedData it can be added to the dataCaches collection.
            // Note: DO NOT, add a cache as its own instance AND in a DataCacheGroup as it will get invalidated twice when InvalidateAll is called.
            
            BusinessByShortName = new BusinessByShortNameCache();
            dataCaches.Add(BusinessByShortName);

            Business = new BusinessCache();
            dataCaches.Add(Business);
    
            
            // Note: Setup the Cache for the Room Type
            // Note: This runs on a timer and is periodically refreshed
            int? timerInternal = null;
            int? startupDelay = null;
            int? promoTimerInternal = null;
            int? promoStartupDelay = null;
            int? rateCacheCacheInterval = null;
            if (ROOM_TYPE_CACHE_TIMER_STARTUP_DELAY.HasValue)
            {
                startupDelay = (int)ROOM_TYPE_CACHE_TIMER_STARTUP_DELAY.Value.TotalMilliseconds;
            }
            if (ROOM_TYPE_CACHE_TIMER_INTERVAL.HasValue)
            {
                timerInternal = (int)ROOM_TYPE_CACHE_TIMER_INTERVAL.Value.TotalMilliseconds;
            }
            if (PROMO_CACHE_TIMER_INTERVAL.HasValue)
            {
                promoTimerInternal = (int) PROMO_CACHE_TIMER_INTERVAL.Value.TotalMilliseconds;
            }
            if (PROMO_CACHE_TIMER_STARTUP_DELAY.HasValue)
            {
                promoStartupDelay = (int)PROMO_CACHE_TIMER_STARTUP_DELAY.Value.TotalMilliseconds;
            }
            if (RATECACHE_CACHE_TIMER_INTERVAL.HasValue)
            {
                rateCacheCacheInterval = (int) RATECACHE_CACHE_TIMER_INTERVAL.Value.TotalMilliseconds;
            }

            RoomType = new RoomTypeCache(startupDelay, timerInternal, false);
            dataCaches.Add(RoomType);

            PromoCache = new PromotionCache(promoStartupDelay, promoTimerInternal, false);
            dataCaches.Add(PromoCache);

            DictionaryCache = new DictionaryCache(startupDelay, timerInternal, false);
            dataCaches.Add(DictionaryCache);

            RatePlanViewCache = new RatePlanViewCache(startupDelay, timerInternal, false);
            dataCaches.Add(RatePlanViewCache);

            FxRateCache = new FxCacheCache(FXRATE_CACHE_TIMER_INTERVAL);
            dataCaches.Add(FxRateCache);

            CurrencyCache = new CurrencyCacheCache(CURRENCY_CACHE_TIMER_INTERVAL);
            dataCaches.Add(CurrencyCache);

            // if no interval, disable the cache (offline searches)
            RateCacheCache = new RateCacheCache(0, rateCacheCacheInterval, rateCacheCacheInterval.HasValue);
            dataCaches.Add(RateCacheCache);
        }
示例#7
0
        public ActionResult AddOrUpdateBusiness(BusinessModel businessModel)
        {
            BusinessCache bcache = RemotingHelp.GetModelObject <BusinessCache>();

            return(Json(bcache.AddOrUpdateBusiness(businessModel), JsonRequestBehavior.AllowGet));
        }