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


C# ModuleController.InitialModulePermission方法代码示例

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


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

示例1: DoAddNewModule

        private int DoAddNewModule(string title, int desktopModuleId, string paneName, int position, int permissionType, string align)
        {
            var objModules = new ModuleController();
            try
            {
                DesktopModuleInfo desktopModule;
                if (!DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId).TryGetValue(desktopModuleId, out desktopModule))
                {
                    throw new ArgumentException("desktopModuleId");
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }

	        var tabModuleId = Null.NullInteger;
            foreach (ModuleDefinitionInfo objModuleDefinition in
                ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
            {
                var objModule = new ModuleInfo();
                objModule.Initialize(PortalSettings.Current.ActiveTab.PortalID);

                objModule.PortalID = PortalSettings.Current.ActiveTab.PortalID;
                objModule.TabID = PortalSettings.Current.ActiveTab.TabID;
                objModule.ModuleOrder = position;
                objModule.ModuleTitle = string.IsNullOrEmpty(title) ? objModuleDefinition.FriendlyName : title;
                objModule.PaneName = paneName;
                objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                if (objModuleDefinition.DefaultCacheTime > 0)
                {
                    objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
                    if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger)
                    {
                        ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true);
                        if ((defaultModule != null))
                        {
                            objModule.CacheTime = defaultModule.CacheTime;
                        }
                    }
                }

				objModules.InitialModulePermission(objModule, objModule.TabID, permissionType);

                if (PortalSettings.Current.ContentLocalizationEnabled)
                {
                    Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId);
                    //set the culture of the module to that of the tab
                    var tabInfo = new TabController().GetTab(objModule.TabID, PortalSettings.Current.PortalId, false);
                    objModule.CultureCode = tabInfo != null ? tabInfo.CultureCode : defaultLocale.Code;
                }
                else
                {
                    objModule.CultureCode = Null.NullString;
                }
                objModule.AllTabs = false;
                objModule.Alignment = align;

                objModules.AddModule(objModule);

				if (tabModuleId == Null.NullInteger)
				{
					tabModuleId = objModule.ModuleID;
				}
				//update the position to let later modules with add after previous one.
	            position = objModules.GetTabModule(objModule.TabModuleID).ModuleOrder + 1;
            }

			return tabModuleId;
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:70,代码来源:ControlBarController.cs

示例2: SaveTabData


//.........这里部分代码省略.........
                {
                    var objModules = new ModuleController();
                    ModuleInfo objModule;
                    CheckBox chkModule;
                    RadioButton optCopy;
                    RadioButton optReference;
                    TextBox txtCopyTitle;

                    foreach (DataGridItem objDataGridItem in grdModules.Items)
                    {
                        chkModule = (CheckBox)objDataGridItem.FindControl("chkModule");
                        if (chkModule.Checked)
                        {
                            var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]);
                            optCopy = (RadioButton)objDataGridItem.FindControl("optCopy");
                            optReference = (RadioButton)objDataGridItem.FindControl("optReference");
                            txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle");

                            objModule = objModules.GetModule(intModuleID, copyTabId, false);
                            ModuleInfo newModule = null;
                            if ((objModule != null))
                            {
                                //Clone module as it exists in the cache and changes we make will update the cached object
                                newModule = objModule.Clone();

                                newModule.TabID = Tab.TabID;
                                newModule.DefaultLanguageGuid = Null.NullGuid;
                                newModule.CultureCode = Tab.CultureCode;
                                newModule.ModuleTitle = txtCopyTitle.Text;

                                if (!optReference.Checked)
                                {
                                    newModule.ModuleID = Null.NullInteger;
                                    objModules.InitialModulePermission(newModule, newModule.TabID, 0);
                                }

                                newModule.ModuleID = objModules.AddModule(newModule);

                                if (optCopy.Checked)
                                {
                                    if (!string.IsNullOrEmpty(newModule.DesktopModule.BusinessControllerClass))
                                    {
                                        var objObject = Reflection.CreateObject(newModule.DesktopModule.BusinessControllerClass, newModule.DesktopModule.BusinessControllerClass);
                                        if (objObject is IPortable)
                                        {
                                            var content = Convert.ToString(((IPortable)objObject).ExportModule(intModuleID));
                                            if (!string.IsNullOrEmpty(content))
                                            {
                                                ((IPortable)objObject).ImportModule(newModule.ModuleID, content, newModule.DesktopModule.Version, UserInfo.UserID);
                                            }
                                        }
                                    }
                                }
                            }

                            if (optReference.Checked)
                            {
                                //Make reference copies on secondary language
                                foreach (var m in objModule.LocalizedModules.Values)
                                {
                                    var newLocalizedModule = m.Clone();
                                    var localizedTab = Tab.LocalizedTabs[m.CultureCode];
                                    newLocalizedModule.TabID = localizedTab.TabID;
                                    newLocalizedModule.CultureCode = localizedTab.CultureCode;
                                    newLocalizedModule.ModuleTitle = txtCopyTitle.Text;
                                    newLocalizedModule.DefaultLanguageGuid = newModule.UniqueId;
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:67,代码来源:ManageTabs.ascx.cs

示例3: DoAddNewModule

        private static void DoAddNewModule(string title, int desktopModuleId, string paneName, int position, int permissionType, string align)
        {
            var objModules = new ModuleController();

            try
            {
                DesktopModuleInfo desktopModule;
                if (!DesktopModuleController.GetDesktopModules(PortalSettings.Current.PortalId).TryGetValue(desktopModuleId, out desktopModule))
                {
                    throw new ArgumentException("desktopModuleId");
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }

            foreach (ModuleDefinitionInfo objModuleDefinition in
                ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
            {
                var objModule = new ModuleInfo();
                objModule.Initialize(PortalSettings.Current.ActiveTab.PortalID);

                objModule.PortalID = PortalSettings.Current.ActiveTab.PortalID;
                objModule.TabID = PortalSettings.Current.ActiveTab.TabID;
                objModule.ModuleOrder = position;
                objModule.ModuleTitle = string.IsNullOrEmpty(title) ? objModuleDefinition.FriendlyName : title;
                objModule.PaneName = paneName;
                objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                if (objModuleDefinition.DefaultCacheTime > 0)
                {
                    objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
                    if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger)
                    {
                        ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true);
                        if ((defaultModule != null))
                        {
                            objModule.CacheTime = defaultModule.CacheTime;
                        }
                    }
                }

                objModules.InitialModulePermission(objModule, objModule.TabID, permissionType);

                if (PortalSettings.Current.ContentLocalizationEnabled)
                {
                    Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId);
                    //check whether original tab is exists, if true then set culture code to default language,
                    //otherwise set culture code to current.
                    if (new TabController().GetTabByCulture(objModule.TabID, PortalSettings.Current.PortalId, defaultLocale) != null)
                    {
                        objModule.CultureCode = defaultLocale.Code;
                    }
                    else
                    {
                        objModule.CultureCode = PortalSettings.Current.CultureCode;
                    }
                }
                else
                {
                    objModule.CultureCode = Null.NullString;
                }
                objModule.AllTabs = false;
                objModule.Alignment = align;

                objModules.AddModule(objModule);
            }
        }
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:68,代码来源:AddModule.ascx.cs


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