'Option Explicit On 
'Option Strict On
'Option Compare Text

Imports System.Data.SqlClient
Imports System.Web.Security
Public MustInherit Class LeftPage
    Inherits System.Web.UI.UserControl
    Protected WithEvents pnlTeacherOpts As System.Web.UI.WebControls.Panel
    Protected WithEvents pnlAdminOpts As System.Web.UI.WebControls.Panel
    Protected WithEvents Linkbutton2 As System.Web.UI.WebControls.LinkButton
    Protected WithEvents pnlPTOAdminOpts As System.Web.UI.WebControls.Panel
    Protected WithEvents LogOutBtn As System.Web.UI.WebControls.LinkButton

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> 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
        If CType(Session.Item("LoginType"), String) = "administrator" Then
            'show the admin options in the top menu only
            pnlAdminOpts.Visible = True
            pnlTeacherOpts.Visible = False
            pnlPTOAdminOpts.Visible = False
            Exit Sub
            'End If

        ElseIf CType(Session.Item("LoginType"), String) = "teacher" Then
            'show the teacher options in the top menu only
            pnlAdminOpts.Visible = False
            pnlTeacherOpts.Visible = True
            pnlPTOAdminOpts.Visible = False
            Exit Sub

        ElseIf CType(Session.Item("LoginType"), String) = "ptoadmin" Then
            'show the teacher options in the top menu only
            pnlAdminOpts.Visible = False
            pnlTeacherOpts.Visible = False
            pnlPTOAdminOpts.Visible = True
            Exit Sub

        Else
            Session.Abandon()
            FormsAuthentication.SignOut()
            Response.Redirect("login.aspx")
        End If
        'if no session then go to login page


    End Sub

    Private Sub lnkAdminLogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Redirect("default.aspx")
    End Sub

    Private Sub lnkTeacherLogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Redirect("../Teachers/default.aspx")
    End Sub

    Private Sub imgLogOut_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Redirect("default.aspx")
    End Sub

    Private Sub LogOutBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogOutBtn.Click
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Redirect("default.aspx")
    End Sub

    Private Sub Linkbutton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Linkbutton2.Click
        Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Redirect("default.aspx")
    End Sub
End Class
