Partial Public Class Dashboard
    Inherits Functions

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sql As String = ""
        Dim ID As String = Request.QueryString("id")
        Authenticate()
        If Page.IsPostBack = False Then
            If ID <> "" Then
                sql = "SELECT ReportServerReports.ID,ReportServerReportCategory.Name AS CategoryName,ReportServerReports.ReportName,PageName,Description FROM "
                sql += " ReportServerReports LEFT JOIN ReportServerReportCategory ON ReportServerReports.ReportCategoryID=ReportServerReportCategory.ID"
                sql += " WHERE ReportServerReports.InActive=0 AND ReportServerReports.ReportCategoryID=" & ID
                If Session("usertype") <> "Admin" Then
                    sql += " AND ReportServerReports.ID IN (SELECT ReportID FROM ReportServerUserReports WHERE UserID=" & Session("userid") & ")"
                End If
                sql += " ORDER BY ReportServerReportCategory.OrderBy,ReportServerReportCategory.Name,ReportServerReports.OrderBy,ReportServerReports.ReportName"
                sqlOrders.SelectCommand = sql
                gvReports.DataSourceID = "sqlOrders"
            Else
                Response.Redirect("/DashboardGroup.aspx")
            End If
        End If
    End Sub

End Class