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


C# ModuleInfo.Initialize方法代码示例

本文整理汇总了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);
     }
//.........这里部分代码省略.........
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:101,代码来源:ControlPanelBase.cs


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