示例#1
0
 private static Dictionary <string, string> GetResourceFile(string resourceFile)
 {
     return(CBO.GetCachedObject <Dictionary <string, string> >(new CacheItemArgs(resourceFile, DataCache.ResourceFilesCacheTimeOut, DataCache.ResourceFilesCachePriority),
                                                               GetResourceFileCallBack,
                                                               true));
 }
示例#2
0
        /// <summary>
        /// Loads the module providers.
        /// </summary>
        /// <param name="portalId"></param>
        /// <returns></returns>
        /// <remarks>Note : similar copy for UI purposes in ConfigurationController.cs.</remarks>
        public static List <ExtensionUrlProvider> GetModuleProviders(int portalId)
        {
            var cacheKey        = string.Format("ExtensionUrlProviders_{0}", portalId);
            var moduleProviders = CBO.GetCachedObject <List <ExtensionUrlProvider> >(
                new CacheItemArgs(
                    cacheKey,
                    60,
                    CacheItemPriority.High,
                    portalId),
                c =>
            {
                var id         = (int)c.Params[0];
                IDataReader dr = DataProvider.Instance().GetExtensionUrlProviders(id);
                try
                {
                    var providers       = new List <ExtensionUrlProvider>();
                    var providerConfigs = CBO.FillCollection(dr, new List <ExtensionUrlProviderInfo>(), false);

                    foreach (var providerConfig in providerConfigs)
                    {
                        var providerType = Reflection.CreateType(providerConfig.ProviderType);
                        if (providerType == null)
                        {
                            continue;
                        }

                        var provider = Reflection.CreateObject(providerType) as ExtensionUrlProvider;
                        if (provider == null)
                        {
                            continue;
                        }

                        provider.ProviderConfig          = providerConfig;
                        provider.ProviderConfig.PortalId = id;
                        providers.Add(provider);
                    }

                    if (dr.NextResult())
                    {
                        // Setup Settings
                        while (dr.Read())
                        {
                            var extensionUrlProviderId = Null.SetNullInteger(dr["ExtensionUrlProviderID"]);
                            var key   = Null.SetNullString(dr["SettingName"]);
                            var value = Null.SetNullString(dr["SettingValue"]);

                            var provider = providers.SingleOrDefault(p => p.ProviderConfig.ExtensionUrlProviderId == extensionUrlProviderId);
                            if (provider != null)
                            {
                                provider.ProviderConfig.Settings[key] = value;
                            }
                        }
                    }

                    if (dr.NextResult())
                    {
                        // Setup Tabs
                        while (dr.Read())
                        {
                            var extensionUrlProviderId = Null.SetNullInteger(dr["ExtensionUrlProviderID"]);
                            var tabId = Null.SetNullInteger(dr["TabID"]);

                            var provider = providers.SingleOrDefault(p => p.ProviderConfig.ExtensionUrlProviderId == extensionUrlProviderId);
                            if (provider != null && !provider.ProviderConfig.TabIds.Contains(tabId))
                            {
                                provider.ProviderConfig.TabIds.Add(tabId);
                            }
                        }
                    }

                    return(providers);
                }
                finally
                {
                    // Close reader
                    CBO.CloseDataReader(dr, true);
                }
            });

            return(moduleProviders);
        }
        private Dictionary <int, BaseResultController> GetSearchResultControllers()
        {
            var cachArg = new CacheItemArgs(SeacrchContollersCacheKey, 120, CacheItemPriority.Default);

            return(CBO.GetCachedObject <Dictionary <int, BaseResultController> >(cachArg, this.GetSearchResultsControllersCallBack));
        }
 public static List <AuthenticationInfo> GetAuthenticationServices()
 {
     return(CBO.GetCachedObject <List <AuthenticationInfo> >(new CacheItemArgs(DataCache.AuthenticationServicesCacheKey, DataCache.AuthenticationServicesCacheTimeOut, DataCache.AuthenticationServicesCachePriority), GetAuthenticationServicesCallBack));
 }
示例#5
0
 /// <summary>
 /// Gets all host settings.
 /// </summary>
 /// <returns>host setting.</returns>
 public Dictionary <string, ConfigurationSetting> GetSettings()
 {
     return
         (CBO.GetCachedObject <Dictionary <string, ConfigurationSetting> >(
              new CacheItemArgs(DataCache.HostSettingsCacheKey, DataCache.HostSettingsCacheTimeOut, DataCache.HostSettingsCachePriority), GetSettingsDictionaryCallBack, true));
 }
示例#6
0
        public ArrayList LoadBanners(int PortalId, int ModuleId, int BannerTypeId, string GroupName, int Banners)
        {
            if (GroupName == null)
            {
                GroupName = Null.NullString;
            }

            //set cache key
            string cacheKey = string.Format(DataCache.BannersCacheKey, PortalId, BannerTypeId, GroupName);

            //get list of active banners
            var bannersList = CBO.GetCachedObject <List <BannerInfo> >(new CacheItemArgs(cacheKey, DataCache.BannersCacheTimeOut, DataCache.BannersCachePriority, PortalId, BannerTypeId, GroupName),
                                                                       LoadBannersCallback);

            //create return collection
            var arReturnBanners = new ArrayList(Banners);

            if (bannersList.Count > 0)
            {
                if (Banners > bannersList.Count)
                {
                    Banners = bannersList.Count;
                }

                //set Random start index based on the list of banners
                int intIndex = new Random().Next(0, bannersList.Count);
                //set counter
                int intCounter = 1;

                while (intCounter <= bannersList.Count && arReturnBanners.Count != Banners)
                {
                    //manage the rotation for the circular collection
                    intIndex += 1;
                    if (intIndex > (bannersList.Count - 1))
                    {
                        intIndex = 0;
                    }

                    //get the banner object
                    BannerInfo objBanner = bannersList[intIndex];

                    //add to return collection
                    arReturnBanners.Add(objBanner);

                    //update banner attributes
                    objBanner.Views += 1;
                    if (Null.IsNull(objBanner.StartDate))
                    {
                        objBanner.StartDate = DateTime.Now;
                    }
                    if (Null.IsNull(objBanner.EndDate) && objBanner.Views >= objBanner.Impressions && objBanner.Impressions != 0)
                    {
                        objBanner.EndDate = DateTime.Now;
                    }
                    DataProvider.Instance().UpdateBannerViews(objBanner.BannerId, objBanner.StartDate, objBanner.EndDate);

                    //expire cached collection of banners if a banner is no longer active
                    if (!IsBannerActive(objBanner))
                    {
                        DataCache.RemoveCache(cacheKey);
                    }
                    intCounter += 1;
                }
            }
            return(arReturnBanners);
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   GetWorkflowStatePermissions gets a Dictionary of WorkflowStatePermissionCollections by
 ///   WorkflowState.
 /// </summary>
 /// -----------------------------------------------------------------------------
 private static Dictionary <int, WorkflowStatePermissionCollection> GetWorkflowStatePermissions()
 {
     return(CBO.GetCachedObject <Dictionary <int, WorkflowStatePermissionCollection> >(new CacheItemArgs(WorkflowStatePermissionCacheKey, WorkflowStatePermissionCachePriority),
                                                                                       GetWorkflowStatePermissionsCallBack));
 }
 /// <inheritdoc/>
 public T GetSettings(int portalId)
 {
     return(CBO.GetCachedObject <T>(new CacheItemArgs(this.CacheKey(portalId), 20, CacheItemPriority.AboveNormal, null, portalId), this.Load, false));
 }
示例#9
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// GetDesktopModulePermissions gets a Dictionary of DesktopModulePermissionCollections by
 /// DesktopModule.
 /// </summary>
 /// <history>
 ///     [cnurse]	01/15/2008   Created
 /// </history>
 /// -----------------------------------------------------------------------------
 private static Dictionary <int, DesktopModulePermissionCollection> GetDesktopModulePermissions()
 {
     return(CBO.GetCachedObject <Dictionary <int, DesktopModulePermissionCollection> >(
                new CacheItemArgs(DataCache.DesktopModulePermissionCacheKey, DataCache.DesktopModulePermissionCachePriority), GetDesktopModulePermissionsCallBack));
 }
 public IEnumerable <ExportImportSetting> GetAllSettings()
 {
     return(CBO.GetCachedObject <List <ExportImportSetting> >(
                new CacheItemArgs(CacheKey, CacheDuration, CacheItemPriority.Normal),
                c => CBO.FillQueryable <ExportImportSetting>(DataProvider.Instance().GetExportImportSettings()).ToList()));
 }
示例#11
0
        /// <summary>
        /// get all redirections defined in system.
        /// </summary>
        /// <returns>List of redirection.</returns>
        public IList <IRedirection> GetAllRedirections()
        {
            var cacheArg = new CacheItemArgs(AllRedirectionsCacheKey, DataCache.RedirectionsCacheTimeOut, DataCache.RedirectionsCachePriority, "");

            return(CBO.GetCachedObject <IList <IRedirection> >(cacheArg, GetAllRedirectionsCallBack));
        }
示例#12
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// GetModuleDefinitions gets a Dictionary of Module Definitions.
 /// </summary>
 /// -----------------------------------------------------------------------------
 public static Dictionary <int, ModuleDefinitionInfo> GetModuleDefinitions()
 {
     return(CBO.GetCachedObject <Dictionary <int, ModuleDefinitionInfo> >(new CacheItemArgs(DataCache.ModuleDefinitionCacheKey,
                                                                                            DataCache.ModuleDefinitionCachePriority),
                                                                          GetModuleDefinitionsCallBack));
 }
示例#13
0
 public IQueryable <Vocabulary> GetVocabularies()
 {
     return(CBO.GetCachedObject <List <Vocabulary> >(new CacheItemArgs(DataCache.VocabularyCacheKey, _CacheTimeOut), GetVocabulariesCallBack).AsQueryable());
 }
示例#14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetWorkFlowStates retrieves a collection of WorkflowStateInfo objects for the Workflow from the cache
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "WorkflowID">The ID of the Workflow</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public ArrayList GetWorkflowStates(int WorkflowID)
        {
            string cacheKey = string.Format(WORKFLOW_CACHE_KEY, WorkflowID);

            return(CBO.GetCachedObject <ArrayList>(new CacheItemArgs(cacheKey, WORKFLOW_CACHE_TIMEOUT, WORKFLOW_CACHE_PRIORITY, WorkflowID), GetWorkflowStatesCallBack));
        }
示例#15
0
 public override ArrayList GetLogTypeInfo()
 {
     return(CBO.GetCachedObject <ArrayList>(
                new CacheItemArgs(LogTypeCacheKey, 20, CacheItemPriority.Normal),
                c => CBO.FillCollection(DataProvider.Instance().GetLogTypeInfo(), typeof(LogTypeInfo))));
 }
 /// <inheritdoc/>
 public T GetSettings(ModuleInfo moduleContext)
 {
     return(CBO.GetCachedObject <T>(new CacheItemArgs(this.CacheKey(moduleContext.TabModuleID), 20, CacheItemPriority.AboveNormal, moduleContext), this.Load, false));
 }
示例#17
0
        public static List <ServerInfo> GetServers()
        {
            var servers = CBO.GetCachedObject <List <ServerInfo> >(new CacheItemArgs(cacheKey, cacheTimeout, cachePriority), GetServersCallBack);

            return(servers);
        }
示例#18
0
        public IEnumerable <SearchType> GetSearchTypes()
        {
            var cachArg = new CacheItemArgs(SearchTypesCacheKey, 120, CacheItemPriority.Default);

            return(CBO.GetCachedObject <IList <SearchType> >(cachArg, GetSearchTypesCallBack));
        }
示例#19
0
 public IQueryable <Vocabulary> GetVocabularies()
 {
     return(CBO.GetCachedObject <IQueryable <Vocabulary> >(new CacheItemArgs(_CacheKey, _CacheTimeOut), GetVocabulariesCallBack));
 }