Пример #1
0
        /// <summary>
        /// Searches the cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="searchCacheRequestType">Type of the search cache request.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns System.Object.</returns>
        public object SearchCacheObjects(ServiceCacheObjectType cacheObjectType, SearchCacheRequestType searchCacheRequestType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            const string LogMethodName = "OFCOMServiceCacheHelper.SearchCacheObjects";

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Enter " + LogMethodName);
            object results = null;

            try
            {
                this.LoadCacheData <PmseAssignment>(ServiceCacheObjectType.PMSEAssignment);

                if (((int)searchCacheRequestType & (int)SearchCacheRequestType.ByEastingNorthing) == (int)SearchCacheRequestType.ByEastingNorthing)
                {
                    results = pmseAssignmentCache.Where(obj => obj.Easting == serviceCacheRequestParameters.Easting && obj.Northing == serviceCacheRequestParameters.Northing);
                }
            }
            catch (Exception ex)
            {
                this.Logger.Log(TraceEventType.Error, LoggingMessageId.DatabaseCacheMessage, string.Format("Error in {0}: Message {1}", LogMethodName, ex.ToString()));
            }

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Exit " + LogMethodName);

            return(results);
        }
Пример #2
0
        /// <summary>
        /// Searches the cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="searchCacheRequestType">Type of the search cache request.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns System.Object.</returns>
        public object SearchCacheObjects(ServiceCacheObjectType cacheObjectType, SearchCacheRequestType searchCacheRequestType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            const string LogMethodName = "PortalServiceCacheHelper.SearchCacheObjects";

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Enter " + LogMethodName);

            object results = null;

            try
            {
                if (cacheObjectType == ServiceCacheObjectType.RegionPolygons)
                {
                    this.FillRegionPolygonsCacheDictionary();
                    results = regionPolygonsCacheDictionary;
                }
            }
            catch (Exception ex)
            {
                this.Logger.Log(TraceEventType.Error, LoggingMessageId.DatabaseCacheMessage, ex.ToString());
            }

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Exit " + LogMethodName);

            return(results);
        }
Пример #3
0
        /// <summary>
        /// Gets the service cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns List of cache data.</returns>
        public object GetServiceCacheObjects(ServiceCacheObjectType cacheObjectType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            if (cacheObjectType == ServiceCacheObjectType.PMSEAssignment)
            {
                return(this.GetPMSEAssignment(serviceCacheRequestParameters));
            }

            return(null);
        }
Пример #4
0
 /// <summary>
 /// Combines the and get cache.
 /// </summary>
 /// <typeparam name="T">type of object</typeparam>
 /// <param name="cacheObjectType">Type of the cache object.</param>
 private void LoadCacheData <T>(ServiceCacheObjectType cacheObjectType)
 {
     if (cacheObjectType == ServiceCacheObjectType.PMSEAssignment)
     {
         if (pmseAssignmentCache == null)
         {
             pmseAssignmentCache = this.DalcServiceCache.FetchPmseAssignments(Constants.PMSEAssignmentsTable);
         }
     }
 }
Пример #5
0
        /// <summary>
        /// Gets the service cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns List of cache data.</returns>
        public object GetServiceCacheObjects(ServiceCacheObjectType cacheObjectType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            if (cacheObjectType == ServiceCacheObjectType.RegionPolygons)
            {
                if (regionPolygonsCacheDictionary == null)
                {
                    this.FillRegionPolygonsCacheDictionary();
                }

                return(regionPolygonsCacheDictionary);
            }

            return(null);
        }
Пример #6
0
        /// <summary>
        /// Searches the cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="searchCacheRequestType">Type of the search cache request.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns System.Object.</returns>
        public object SearchCacheObjects(ServiceCacheObjectType cacheObjectType, SearchCacheRequestType searchCacheRequestType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            const string LogMethodName = "FCCServiceCacheHelper.SearchCacheObjects";

            List <Incumbent> incumbents = new List <Incumbent>();

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Enter " + LogMethodName);
            object results = null;

            try
            {
                if (cacheObjectType == ServiceCacheObjectType.TvEngData)
                {
                    this.LoadCacheData <CacheObjectTvEngdata>(ServiceCacheObjectType.TvEngData);

                    if (((int)searchCacheRequestType & (int)SearchCacheRequestType.ByCallSign) == (int)SearchCacheRequestType.ByCallSign)
                    {
                        results = tvengCache.Where(obj => obj.CallSign == serviceCacheRequestParameters.CallSign).ToList();
                    }
                    else if (((int)searchCacheRequestType & (int)SearchCacheRequestType.ByVsdService) == (int)SearchCacheRequestType.ByVsdService)
                    {
                        results = tvengCache.Where(obj => obj.VsdService == serviceCacheRequestParameters.VsdService);
                    }
                }
                else if (cacheObjectType == ServiceCacheObjectType.LPAUX)
                {
                    this.LoadCacheData <LPAuxRegistration>(ServiceCacheObjectType.LPAUX);
                    if (((int)searchCacheRequestType & (int)SearchCacheRequestType.None) == (int)SearchCacheRequestType.None)
                    {
                        results = lpauxCache;
                    }
                }
                else if (cacheObjectType == ServiceCacheObjectType.RegionPolygons)
                {
                    this.LoadCacheData <RegionPolygonsCache>(ServiceCacheObjectType.RegionPolygons);
                    results = regionPolygonsCache;
                }
            }
            catch (Exception ex)
            {
                this.Logger.Log(TraceEventType.Error, LoggingMessageId.DatabaseCacheMessage, string.Format("Error in {0}: Message {1}", LogMethodName, ex.ToString()));
            }

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Exit " + LogMethodName);

            return(results);
        }
Пример #7
0
        /// <summary>
        /// Gets the service cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="serviceCacheRequestParameters">The service cache request parameters.</param>
        /// <returns>returns List of cache data.</returns>
        public object GetServiceCacheObjects(ServiceCacheObjectType cacheObjectType, ServiceCacheRequestParameters serviceCacheRequestParameters)
        {
            if (cacheObjectType == ServiceCacheObjectType.TvEngData)
            {
                return(this.GetIncumbents(serviceCacheRequestParameters));
            }

            if (cacheObjectType == ServiceCacheObjectType.LPAUX)
            {
                return(this.GetLPAuxRegistrations(serviceCacheRequestParameters));
            }

            if (cacheObjectType == ServiceCacheObjectType.RegionPolygons)
            {
                this.FillRegionPolygonsCache();
                return(regionPolygonsCache);
            }

            return(null);
        }
Пример #8
0
        /// <summary>
        /// Updates the cache objects.
        /// </summary>
        /// <param name="cacheObjectType">Type of the cache object.</param>
        /// <param name="updateType">Type of the update.</param>
        /// <param name="cacheItem">The cache item.</param>
        public void UpdateCacheObjects(ServiceCacheObjectType cacheObjectType, ServiceCacheUpdateType updateType, object cacheItem)
        {
            const string LogMethodName = "FCCServiceCacheHelper.UpdateCacheObjects";

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Enter " + LogMethodName);
            try
            {
                if (cacheObjectType == ServiceCacheObjectType.LPAUX)
                {
                    if (updateType == ServiceCacheUpdateType.Add)
                    {
                        lpauxCache.Add((LPAuxRegistration)cacheItem);
                    }
                }
            }
            catch (Exception ex)
            {
                this.Logger.Log(TraceEventType.Error, LoggingMessageId.DatabaseCacheMessage, string.Format("Error in {0}: Message {1}", LogMethodName, ex.ToString()));
            }

            this.Logger.Log(TraceEventType.Information, LoggingMessageId.DatabaseCacheMessage, "Exit " + LogMethodName);
        }
Пример #9
0
 /// <summary>
 /// Combines the and get cache.
 /// </summary>
 /// <typeparam name="T">type of object</typeparam>
 /// <param name="cacheObjectType">Type of the cache object.</param>
 private void LoadCacheData <T>(ServiceCacheObjectType cacheObjectType)
 {
     if (cacheObjectType == ServiceCacheObjectType.TvEngData)
     {
         if (tvengCache == null)
         {
             tvengCache = Utils.ReadDumpedFile <CacheObjectTvEngdata>(cacheObjectType.ToString());
         }
     }
     else if (cacheObjectType == ServiceCacheObjectType.LPAUX)
     {
         if (lpauxCache == null)
         {
             this.FillLpAuxCache();
         }
     }
     else if (cacheObjectType == ServiceCacheObjectType.RegionPolygons)
     {
         if (regionPolygonsCache == null)
         {
             this.FillRegionPolygonsCache();
         }
     }
 }