本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetTabModule方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetTabModule方法的具体用法?C# ModuleController.GetTabModule怎么用?C# ModuleController.GetTabModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetTabModule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
public override void Remove(int tabModuleId)
{
var controller = new ModuleController();
ModuleInfo tabModule = controller.GetTabModule(tabModuleId);
int portalId = tabModule.PortalID;
if (portalId == Null.NullInteger)
{
portalId = PortalSettings.Current.PortalId;
}
string cacheFolder = GetCacheFolder(portalId);
var filesNotDeleted = new StringBuilder();
int i = 0;
foreach (string File in Directory.GetFiles(cacheFolder, tabModuleId + "_*.*"))
{
if (!FileSystemUtils.DeleteFileWithWait(File, 100, 200))
{
filesNotDeleted.Append(File + ";");
}
else
{
i += 1;
}
}
if (filesNotDeleted.Length > 0)
{
throw new IOException("Deleted " + i + " files, however, some files are locked. Could not delete the following files: " + filesNotDeleted);
}
}
示例2: 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;
}