本文整理汇总了C#中ModuleInfo.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleInfo.Initialize方法的具体用法?C# ModuleInfo.Initialize怎么用?C# ModuleInfo.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleInfo
的用法示例。
在下文中一共展示了ModuleInfo.Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewModule
protected void AddNewModule(string title, int desktopModuleId, string paneName, int position, ViewPermissionType permissionType, string align)
{
TabPermissionCollection objTabPermissions = PortalSettings.ActiveTab.TabPermissions;
PermissionController objPermissionController = new PermissionController();
ModuleController objModules = new ModuleController();
Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
int j;
try
{
DesktopModuleInfo desktopModule = null;
if (!DesktopModuleController.GetDesktopModules(PortalSettings.PortalId).TryGetValue(desktopModuleId, out desktopModule))
{
throw new ArgumentException("desktopModuleId");
}
}
catch (Exception ex)
{
Exceptions.LogException(ex);
}
int UserId = -1;
if (Request.IsAuthenticated)
{
UserInfo objUserInfo = UserController.GetCurrentUserInfo();
UserId = objUserInfo.UserID;
}
foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
{
ModuleInfo objModule = new ModuleInfo();
objModule.Initialize(PortalSettings.PortalId);
objModule.PortalID = PortalSettings.PortalId;
objModule.TabID = PortalSettings.ActiveTab.TabID;
objModule.ModuleOrder = position;
if (String.IsNullOrEmpty(title))
{
objModule.ModuleTitle = objModuleDefinition.FriendlyName;
}
else
{
objModule.ModuleTitle = 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;
}
}
}
switch (permissionType)
{
case ViewPermissionType.View:
objModule.InheritViewPermissions = true;
break;
case ViewPermissionType.Edit:
objModule.InheritViewPermissions = false;
break;
}
ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");
foreach (TabPermissionInfo objTabPermission in objTabPermissions)
{
if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View)
{
continue;
}
ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++)
{
PermissionInfo objSystemModulePermission;
objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j];
if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT")
{
continue;
}
ModulePermissionInfo objModulePermission = AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess)
{
ModulePermissionInfo objModuleViewperm = AddModulePermission(objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true);
}
}
if (objTabPermission.PermissionKey == "EDIT")
{
ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);
for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++)
{
PermissionInfo objCustomModulePermission;
objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j];
AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
}
}
}
objModule.AllTabs = false;
objModule.Alignment = align;
objModules.AddModule(objModule);
}
//.........这里部分代码省略.........