Imports Nuvolar.Module.GeneralFunction
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Sql

Public Class DashboardViewer
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.ASPxDashboardViewer1.DashboardXmlFile = GLOBAL_DASHBOARD_XML_DashboardXmlFile
    End Sub

    Private Sub ASPxDashboardViewer1_ConfigureDataConnection(sender As Object, e As ConfigureDataConnectionEventArgs) Handles ASPxDashboardViewer1.ConfigureDataConnection
        Select Case GLOBAL_DASHBOARD_XML_SQLType
            Case "MSSQL"
                Dim _ConnectionParameters_MSSQL As New MsSqlConnectionParameters
                _ConnectionParameters_MSSQL.UserName = GLOBAL_DASHBOARD_XML_UserName
                _ConnectionParameters_MSSQL.Password = GLOBAL_DASHBOARD_XML_Password
                _ConnectionParameters_MSSQL.ServerName = GLOBAL_DASHBOARD_XML_ServerName
                _ConnectionParameters_MSSQL.DatabaseName = GLOBAL_DASHBOARD_XML_DatabaseName
                e.ConnectionParameters = _ConnectionParameters_MSSQL
            Case "MYSQL"
                Dim _ConnectionParameters_MYSQL As New MySqlConnectionParameters
                _ConnectionParameters_MYSQL.UserName = GLOBAL_DASHBOARD_XML_UserName
                _ConnectionParameters_MYSQL.Password = GLOBAL_DASHBOARD_XML_Password
                _ConnectionParameters_MYSQL.ServerName = GLOBAL_DASHBOARD_XML_ServerName
                _ConnectionParameters_MYSQL.DatabaseName = GLOBAL_DASHBOARD_XML_DatabaseName
                e.ConnectionParameters = _ConnectionParameters_MYSQL
            Case "PSQL"
                Dim _ConnectionParameters_PSQL As New PostgreSqlConnectionParameters
                _ConnectionParameters_PSQL.UserName = GLOBAL_DASHBOARD_XML_UserName
                _ConnectionParameters_PSQL.Password = GLOBAL_DASHBOARD_XML_Password
                _ConnectionParameters_PSQL.ServerName = GLOBAL_DASHBOARD_XML_ServerName
                _ConnectionParameters_PSQL.DatabaseName = GLOBAL_DASHBOARD_XML_DatabaseName
                e.ConnectionParameters = _ConnectionParameters_PSQL
        End Select
    End Sub
End Class