private void HardDeleteTab(TabInfo tab, bool deleteDescendants) { //get tab modules before deleting page var tabModules = _moduleController.GetTabModules(tab.TabID); //hard delete the tab _tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants); //delete modules that do not have other instances foreach (var kvp in tabModules) { //check if all modules instances have been deleted var delModule = _moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false); if (delModule == null || delModule.TabID == Null.NullInteger) { try { _moduleController.DeleteModule(kvp.Value.ModuleID); } catch (Exception exc) { Logger.Error(exc); } } } }
private void HardDeleteTab(TabInfo tab, bool deleteDescendants, StringBuilder errors) { if (TabPermissionController.CanDeletePage(tab) && tab.IsDeleted) { if (tab.HasChildren && !deleteDescendants) { errors.Append(string.Format(LocalizeString("Service_RemoveTabWithChildError"), tab.TabName)); return; } //get tab modules before deleting page var tabModules = _moduleController.GetTabModules(tab.TabID); //hard delete the tab _tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants); //delete modules that do not have other instances foreach (var kvp in tabModules) { //check if all modules instances have been deleted var delModule = _moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false); if (delModule == null || delModule.TabID == Null.NullInteger) { try { _moduleController.DeleteModule(kvp.Value.ModuleID); } catch (Exception exc) { Logger.Error(exc); } } } } else { errors.AppendFormat(!tab.IsDeleted ? LocalizeString("TabNotSoftDeleted") : LocalizeString("CanNotDeleteTab"), tab.TabID); } }