本文整理汇总了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;
}
示例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;
示例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);
}
}