当前位置: 首页>>代码示例>>C#>>正文


C# ModuleController.GetSearchModules方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetSearchModules方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetSearchModules方法的具体用法?C# ModuleController.GetSearchModules怎么用?C# ModuleController.GetSearchModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Modules.ModuleController的用法示例。


在下文中一共展示了ModuleController.GetSearchModules方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetModuleList

        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        protected SearchContentModuleInfoCollection GetModuleList( int PortalID )
        {
            SearchContentModuleInfoCollection Results = new SearchContentModuleInfoCollection();

            ModuleController objModules = new ModuleController();
            ArrayList arrModules = objModules.GetSearchModules( PortalID );
            Hashtable businessControllers = new Hashtable();
            Hashtable htModules = new Hashtable();

            ModuleInfo objModule;
            foreach( ModuleInfo tempLoopVar_objModule in arrModules )
            {
                objModule = tempLoopVar_objModule;
                if( ! htModules.ContainsKey( objModule.ModuleID ) )
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.BusinessControllerClass];

                        //If nothing create a new instance
                        if( objController == null )
                        {
                            objController = Framework.Reflection.CreateObject( objModule.BusinessControllerClass, objModule.BusinessControllerClass );

                            //Add to hashtable
                            businessControllers.Add( objModule.BusinessControllerClass, objController );
                        }

                        //Double-Check that module supports ISearchable
                        if( objController is ISearchable )
                        {
                            SearchContentModuleInfo ContentInfo = new SearchContentModuleInfo();
                            ContentInfo.ModControllerType = (ISearchable)objController;
                            ContentInfo.ModInfo = objModule;
                            Results.Add( ContentInfo );
                        }
                    }
                    catch( Exception ex )
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                    finally
                    {
                        htModules.Add( objModule.ModuleID, objModule.ModuleID );
                    }
                }
            }

            return Results;
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:61,代码来源:ModuleIndexer.cs

示例2: GetSearchModules

        protected IEnumerable<ModuleInfo> GetSearchModules(int portalId, bool allModules)
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();
            var businessControllers = new Hashtable();
            var searchModuleIds = new HashSet<int>();
            var searchModules = new List<ModuleInfo>();
            //Only get modules that are set to be Indexed.
            var modules = moduleController.GetSearchModules(portalId).Cast<ModuleInfo>().Where(m => m.TabModuleSettings["AllowIndex"] == null || bool.Parse(m.TabModuleSettings["AllowIndex"].ToString()));

            foreach (var module in modules.Where(module => !searchModuleIds.Contains(module.ModuleID)))
            {
                try
                {
                    var tab = tabController.GetTab(module.TabID, portalId, false);
                    //Only index modules on tabs that are set to be Indexed.
                    if (tab.TabSettings["AllowIndex"] == null || (tab.TabSettings["AllowIndex"] != null && bool.Parse(tab.TabSettings["AllowIndex"].ToString())))
                    {
                        //Check if the business controller is in the Hashtable
                        var controller = businessControllers[module.DesktopModule.BusinessControllerClass];
                        if (!String.IsNullOrEmpty(module.DesktopModule.BusinessControllerClass))
                        {
                            //If nothing create a new instance
                            if (controller == null)
                            {
                                //Add to hashtable
                                controller = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);
                                businessControllers.Add(module.DesktopModule.BusinessControllerClass, controller);
                            }
                        }

                        //Check if module inherits from ModuleSearchBase or include all modules to index module metadata.
                        if (controller is ModuleSearchBase || allModules) searchModules.Add(module);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    ThrowLogError(module, ex);
                }
                finally
                {
                    searchModuleIds.Add(module.ModuleID);
                }
            }
            return searchModules;
        }
开发者ID:uXchange,项目名称:Dnn.Platform,代码行数:47,代码来源:ModuleIndexer.cs

示例3: GetModuleList

        protected SearchContentModuleInfoCollection GetModuleList(int portalId)
        {
            var results = new SearchContentModuleInfoCollection();
            var objModules = new ModuleController();
            var arrModules = objModules.GetSearchModules(portalId);
            var businessControllers = new Hashtable();
            var htModules = new Hashtable();
            
            foreach (var module in arrModules.Cast<ModuleInfo>().Where(module => !htModules.ContainsKey(module.ModuleID)))
            {
                try
                {
                    //Check if the business controller is in the Hashtable
                    var controller = businessControllers[module.DesktopModule.BusinessControllerClass];
                    if (!String.IsNullOrEmpty(module.DesktopModule.BusinessControllerClass))
                    {
                        //If nothing create a new instance
                        if (controller == null)
                        {
                            //Add to hashtable
                            controller = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);                              
                            businessControllers.Add(module.DesktopModule.BusinessControllerClass, controller);
                        }                            
                        //Double-Check that module supports ISearchable

                        //Check if module inherits from ModuleSearchBase                        
                        if (controller is ISearchable && !(controller is ModuleSearchBase))
                        {
                            var contentInfo = new SearchContentModuleInfo {ModControllerType = (ISearchable) controller, ModInfo = module};
                            results.Add(contentInfo);
                        }                           
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    ThrowLogError(module, ex);
                }
                finally
                {
                    htModules.Add(module.ModuleID, module.ModuleID);
                }
            }
            return results;
        }
开发者ID:uXchange,项目名称:Dnn.Platform,代码行数:45,代码来源:ModuleIndexer.cs

示例4: SearchContentSourceCallback

        internal virtual object SearchContentSourceCallback(CacheItemArgs cacheItem)
        {
            var searchTypes = CBO.FillCollection<SearchType>(DataProvider.GetAllSearchTypes());

            var results = new List<SearchContentSource>();

            foreach (var crawler in searchTypes)
            {
                switch (crawler.SearchTypeName)
                {
                    case "module": // module crawler

                        // get searchable module definition list
                        var portalId = int.Parse(cacheItem.CacheKey.Split('-')[1]);
                        var moduleController = new ModuleController();
                        var modules = moduleController.GetSearchModules(portalId);
                        var modDefIds = new HashSet<int>();

                        foreach (ModuleInfo module in modules)
                        {
                            if (!modDefIds.Contains(module.ModuleDefID)) modDefIds.Add(module.ModuleDefID);
                        }
                        
                        var list = modDefIds.Select(ModuleDefinitionController.GetModuleDefinitionByID).ToList();

                        foreach (var def in list)
                        {
                            var text = Localization.Localization.GetSafeJSString("Module_" + def.DefinitionName, LocalizedResxFile);
                            if (string.IsNullOrEmpty(text))
                            {
                                text = def.FriendlyName;
                            }
                            var result = new SearchContentSource
                            {
                                SearchTypeId = crawler.SearchTypeId,
                                SearchTypeName = crawler.SearchTypeName,
                                IsPrivate = crawler.IsPrivate,
                                ModuleDefinitionId =  def.ModuleDefID,
                                LocalizedName = text
                            };

                            results.Add(result);
                        }

                        break;

                    default:

                        var localizedName = Localization.Localization.GetSafeJSString("Crawler_" + crawler.SearchTypeName, LocalizedResxFile);
                        if (string.IsNullOrEmpty(localizedName))
                        {
                            localizedName = crawler.SearchTypeName;
                        }

                        results.Add(new SearchContentSource
                        {
                            SearchTypeId = crawler.SearchTypeId,
                            SearchTypeName = crawler.SearchTypeName,
                            IsPrivate = crawler.IsPrivate,
                            ModuleDefinitionId = 0,
                            LocalizedName = localizedName
                        });
                        break;
                }
            }

            return results;

        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:69,代码来源:InternalSearchControllerImpl.cs

示例5: GetModuleList

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        protected SearchContentModuleInfoCollection GetModuleList(int PortalID)
        {
            var Results = new SearchContentModuleInfoCollection();
            var objModules = new ModuleController();
            ArrayList arrModules = objModules.GetSearchModules(PortalID);
            var businessControllers = new Hashtable();
            var htModules = new Hashtable();
            foreach (ModuleInfo objModule in arrModules)
            {
                if (!htModules.ContainsKey(objModule.ModuleID))
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.DesktopModule.BusinessControllerClass];
                        if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass))
                        {
							//If nothing create a new instance
                            if (objController == null)
                            {
                                objController = Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);
                                
								//Add to hashtable
								businessControllers.Add(objModule.DesktopModule.BusinessControllerClass, objController);
                            }
                            
							//Double-Check that module supports ISearchable
							if (objController is ISearchable)
                            {
                                var ContentInfo = new SearchContentModuleInfo();
                                ContentInfo.ModControllerType = (ISearchable) objController;
                                ContentInfo.ModInfo = objModule;
                                Results.Add(ContentInfo);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Instrumentation.DnnLog.Error(ex);

                        try
                        {
                            string strMessage = string.Format("Error Creating BusinessControllerClass '{0}' of module({1}) id=({2}) in tab({3}) and portal({4}) ",
                                                              objModule.DesktopModule.BusinessControllerClass,
                                                              objModule.DesktopModule.ModuleName,
                                                              objModule.ModuleID,
                                                              objModule.TabID,
                                                              objModule.PortalID);
                            throw new Exception(strMessage, ex);
                        }
                        catch (Exception ex1)
                        {
                            Exceptions.Exceptions.LogException(ex1);
                        }
                    }
                    finally
                    {
                        htModules.Add(objModule.ModuleID, objModule.ModuleID);
                    }
                }
            }
            return Results;
        }
开发者ID:biganth,项目名称:Curt,代码行数:75,代码来源:ModuleIndexer.cs


注:本文中的DotNetNuke.Entities.Modules.ModuleController.GetSearchModules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。