public void MoveTab(TabInfo tab, TabMoveType type) { // Get the List of tabs with the same parent IOrderedEnumerable <TabInfo> siblingTabs = this.GetSiblingTabs(tab).OrderBy(t => t.TabOrder); int tabIndex = GetIndexOfTab(tab, siblingTabs); switch (type) { case TabMoveType.Top: this.MoveTabBefore(tab, siblingTabs.First().TabID); break; case TabMoveType.Bottom: this.MoveTabAfter(tab, siblingTabs.Last().TabID); break; case TabMoveType.Up: this.MoveTabBefore(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; case TabMoveType.Down: this.MoveTabAfter(tab, siblingTabs.ElementAt(tabIndex + 1).TabID); break; case TabMoveType.Promote: this.MoveTabAfter(tab, tab.ParentId); break; case TabMoveType.Demote: this.MoveTabToParent(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; } this.ClearCache(tab.PortalID); }
public void MoveTab(TabInfo tab, TabMoveType type) { //Get the List of tabs with the same parent IOrderedEnumerable<TabInfo> siblingTabs = GetSiblingTabs(tab).OrderBy(t => t.TabOrder); int tabIndex = GetIndexOfTab(tab, siblingTabs); switch (type) { case TabMoveType.Top: MoveTabBefore(tab, siblingTabs.First().TabID); break; case TabMoveType.Bottom: MoveTabAfter(tab, siblingTabs.Last().TabID); break; case TabMoveType.Up: MoveTabBefore(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; case TabMoveType.Down: MoveTabAfter(tab, siblingTabs.ElementAt(tabIndex + 1).TabID); break; case TabMoveType.Promote: MoveTabAfter(tab, tab.ParentId); break; case TabMoveType.Demote: MoveTabToParent(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; } ClearCache(tab.PortalID); }
public void MoveTab(TabInfo objTab, TabMoveType type) { List<TabInfo> siblingTabs = GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId); int siblingCount = siblingTabs.Count; int tabIndex = 0; UpdateTabOrder(siblingTabs, 2); switch (type) { case TabMoveType.Top: objTab.TabOrder = 1; UpdateTabOrder(objTab, false); tabIndex = GetIndexOfTab(objTab, siblingTabs); UpdateTabOrder(siblingTabs, 0, tabIndex - 1, 2); break; case TabMoveType.Bottom: objTab.TabOrder = siblingCount * 2 - 1; UpdateTabOrder(objTab, false); tabIndex = GetIndexOfTab(objTab, siblingTabs); UpdateTabOrder(siblingTabs, tabIndex + 1, siblingCount - 1, -2); break; case TabMoveType.Up: tabIndex = GetIndexOfTab(objTab, siblingTabs); if (tabIndex > 0) { TabInfo swapTab = siblingTabs[tabIndex - 1]; SwapAdjacentTabs(objTab, swapTab); } break; case TabMoveType.Down: tabIndex = GetIndexOfTab(objTab, siblingTabs); if (tabIndex < siblingCount - 1) { TabInfo swapTab = siblingTabs[tabIndex + 1]; SwapAdjacentTabs(swapTab, objTab); } break; case TabMoveType.Promote: PromoteTab(objTab, siblingTabs); break; case TabMoveType.Demote: DemoteTab(objTab, siblingTabs); break; } ClearCache(objTab.PortalID); }