    Imports System
    Imports System.Collections
    Imports ASPNET.StarterKit.TimeTracker.BusinessLogicLayer

    Namespace ASPNET.StarterKit.TimeTracker.Web

        ' Usercontrol for the Project and User subtabs on the Administration tab.
        Public MustInherit Class AdminTabs
            Inherits System.Web.UI.UserControl
            Protected tabs As System.Web.UI.WebControls.DataList

    #Region " Web Form Designer Generated Code "

            'This call is required by the Web Form Designer.
             Private Sub InitializeComponent()

            End Sub

            Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
                'CODEGEN: This method call is required by the Web Form Designer
                'Do not modify it using the code editor.
                InitializeComponent()
            End Sub

    #End Region

            Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                Dim tabItems As New ArrayList()
                Dim mainIndex As Integer = IIf(Request("index") Is Nothing, 0, Convert.ToInt32(Request("index")))

                ' Always add the project list tab.  If the user was able to see the Administration tab, they'll
                ' always be able to view this tab.
                tabItems.Add(New TabItem("Projects", "ProjectList.aspx?index=" & mainIndex & "&adminIndex=" & tabItems.Count))

                If TTSecurity.IsInRole(TTUser.UserRoleAdministrator) Then
                    tabItems.Add(New TabItem("Users", "UserList.aspx?index=" & mainIndex & "&adminIndex=" & tabItems.Count))
                End If

                tabs.DataSource = tabItems
                tabs.SelectedIndex = IIf(Request("adminIndex") Is Nothing, 0, Convert.ToInt16(Request("adminIndex")))

                tabs.DataBind()
            End Sub 'Page_Load
        End Class 'AdminTabs
    End Namespace 'ASPNET.StarterKit.TimeTracker.Web