/// <summary> /// RemoveCoreModule removes a Core Module from the system /// </summary> /// <remarks> /// </remarks> /// <param name="DesktopModuleName">The Friendly Name of the Module to Remove</param> /// <param name="ParentTabName">The Name of the parent Tab/Page for this module</param> /// <param name="TabName">The Name to tab that contains the Module</param> /// <param name="TabRemove">A flag to determine whether to remove the Tab if it has no /// other modules</param> private static void RemoveCoreModule(string DesktopModuleName, string ParentTabName, string TabName, bool TabRemove) { TabController objTabs = new TabController(); ModuleController objModules = new ModuleController(); int intIndex; int intModuleDefId = 0; int intDesktopModuleId; //Find and remove the Module from the Tab switch (ParentTabName) { case "Host": //TODO - when we have a need to remove a Host Module break; case "Admin": PortalController objPortals = new PortalController(); ArrayList arrPortals = objPortals.GetPortals(); //Iterate through the Portals to remove the Module from the Tab for (int intPortal = 0; intPortal < arrPortals.Count; intPortal++) { PortalInfo objPortal = (PortalInfo)(arrPortals[intPortal]); int ParentId = objPortal.AdminTabId; TabInfo objTab = objTabs.GetTabByName(TabName, objPortal.PortalID, ParentId); int intCount = 0; //Get the Modules on the Tab foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(objTab.TabID)) { ModuleInfo objModule = kvp.Value; if (objModule.FriendlyName == DesktopModuleName) { //Delete the Module from the Modules list objModules.DeleteModule(objModule.ModuleID); intModuleDefId = objModule.ModuleDefID; } else { intCount += 1; } } //If Tab has no modules optionally remove tab if (intCount == 0 & TabRemove) { objTabs.DeleteTab(objTab.TabID, objTab.PortalID); } } break; } //Delete all the Module Controls for this Definition ModuleControlController objModuleControls = new ModuleControlController(); ArrayList arrModuleControls = objModuleControls.GetModuleControls(intModuleDefId); for (intIndex = 0; intIndex <= arrModuleControls.Count - 1; intIndex++) { ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intIndex]; objModuleControls.DeleteModuleControl(objModuleControl.ModuleControlID); } //Get the Module Definition ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController(); ModuleDefinitionInfo objModuleDefinition; objModuleDefinition = objModuleDefinitions.GetModuleDefinition(intModuleDefId); intDesktopModuleId = objModuleDefinition.DesktopModuleID; //Delete the Module Definition objModuleDefinitions.DeleteModuleDefinition(intModuleDefId); //Delete the Desktop Module Control DesktopModuleController objDesktopModules = new DesktopModuleController(); objDesktopModules.DeleteDesktopModule(intDesktopModuleId); }
/// <summary> /// cmdDelete_Click runs when the Delete Button is clicked /// </summary> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void cmdDelete_Click( object sender, EventArgs e ) { try { ModuleControlController objModuleControls = new ModuleControlController(); if( ! Null.IsNull( ModuleControlId ) ) { objModuleControls.DeleteModuleControl( ModuleControlId ); } if( DesktopModuleId == - 1 ) { DesktopModuleId = - 2; } Response.Redirect( EditUrl( "desktopmoduleid", DesktopModuleId.ToString() ), true ); } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }