/// -----------------------------------------------------------------------------
        /// <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>
        /// <history>
        /// [cnurse]	10/14/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        private static void RemoveCoreModule(string DesktopModuleName, string ParentTabName, string TabName, bool TabRemove)
        {
            int ParentId = 0;
            int intModuleDefId = Null.NullInteger;
            int intDesktopModuleId = 0;

            //Find and remove the Module from the Tab
            switch (ParentTabName)
            {
                case "Host":
                    TabController objTabs = new TabController();
                    TabInfo objTab = objTabs.GetTabByName("Host", Null.NullInteger, Null.NullInteger);

                    if (objTab != null)
                    {
                        intModuleDefId = RemoveModule(DesktopModuleName, TabName, objTab.TabID, TabRemove);
                    }
                    break;
                case "Admin":
                    PortalController objPortals = new PortalController();
                    PortalInfo objPortal = default(PortalInfo);

                    ArrayList arrPortals = objPortals.GetPortals();
                    int intPortal = 0;

                    //Iterate through the Portals to remove the Module from the Tab
                    for (intPortal = 0; intPortal <= arrPortals.Count - 1; intPortal++)
                    {
                        objPortal = (PortalInfo)arrPortals[intPortal];
                        ParentId = objPortal.AdminTabId;
                        intModuleDefId = RemoveModule(DesktopModuleName, TabName, ParentId, TabRemove);
                    }
                    break;
            }

            DesktopModuleInfo objDesktopModule = null;
            if (intModuleDefId == Null.NullInteger)
            {
                objDesktopModule = DesktopModuleController.GetDesktopModuleByModuleName(DesktopModuleName, Null.NullInteger);
                intDesktopModuleId = objDesktopModule.DesktopModuleID;
            }
            else
            {
                //Get the Module Definition
                ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                ModuleDefinitionInfo objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(intModuleDefId);
                if (objModuleDefinition != null)
                {
                    intDesktopModuleId = objModuleDefinition.DesktopModuleID;
                    objDesktopModule = DesktopModuleController.GetDesktopModule(intDesktopModuleId, Null.NullInteger);
                }
            }

            if (objDesktopModule != null)
            {
                //Delete the Desktop Module
                DesktopModuleController objDesktopModules = new DesktopModuleController();
                objDesktopModules.DeleteDesktopModule(intDesktopModuleId);

                //Delete the Package
                PackageController.DeletePackage(objDesktopModule.PackageID);

            }
        }
 public static void DeletePackage(PackageInfo package)
 {
     switch (package.PackageType)
     {
         case "Auth_System":
             Authentication.AuthenticationInfo authSystem = Authentication.AuthenticationController.GetAuthenticationServiceByPackageID(package.PackageID);
             if (authSystem != null)
             {
                 Authentication.AuthenticationController.DeleteAuthentication(authSystem);
             }
             break;
         case "CoreLanguagePack":
             LanguagePackInfo languagePack = Localization.LanguagePackController.GetLanguagePackByPackage(package.PackageID);
             if (languagePack != null)
             {
                 LanguagePackController.DeleteLanguagePack(languagePack);
             }
             break;
         case "Module":
             DesktopModuleController controller = new DesktopModuleController();
             DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(package.PackageID);
             if (desktopModule != null)
             {
                 controller.DeleteDesktopModule(desktopModule);
             }
             break;
         case "SkinObject":
             SkinControlInfo skinControl = SkinControlController.GetSkinControlByPackageID(package.PackageID);
             if (skinControl != null)
             {
                 SkinControlController.DeleteSkinControl(skinControl);
             }
             break;
     }
     DeletePackage(package.PackageID);
 }
 public static void DeleteDesktopModule(string moduleName)
 {
     DesktopModuleInfo desktopModule = GetDesktopModuleByModuleName(moduleName, Null.NullInteger);
     if (desktopModule != null)
     {
         DesktopModuleController controller = new DesktopModuleController();
         controller.DeleteDesktopModule(desktopModule.DesktopModuleID);
         PackageController.DeletePackage(desktopModule.PackageID);
     }
 }