113 lines
5.1 KiB
VB.net
113 lines
5.1 KiB
VB.net
Imports Microsoft.VisualBasic
|
|
Imports System
|
|
Imports System.Collections.Generic
|
|
Imports System.ComponentModel
|
|
Imports DevExpress.ExpressApp.Web
|
|
Imports SISBusiness.Module.Web
|
|
Imports System.Web
|
|
Imports DevExpress.Xpo.DB.Helpers
|
|
Imports DevExpress.ExpressApp
|
|
Imports SISBusiness.Module
|
|
Imports System.Web.Security
|
|
Imports DevExpress.Xpo.DB
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.ExpressApp.Security
|
|
|
|
Partial Public Class SISBusinessAspNetApplication
|
|
Inherits WebApplication
|
|
Protected Overrides Sub ReadSecuredLogonParameters()
|
|
MyBase.ReadSecuredLogonParameters() ' the "UserName" is restored in the base method.
|
|
End Sub
|
|
Private canReadSecuredLogonParameters_Renamed As Boolean = True
|
|
Protected Overrides Function CanReadSecuredLogonParameters() As Boolean
|
|
If (Not canReadSecuredLogonParameters_Renamed) Then
|
|
Return False
|
|
End If
|
|
Return MyBase.CanReadSecuredLogonParameters()
|
|
End Function
|
|
Protected Overrides Function OnLogonFailed(ByVal logonParameters As Object, ByVal e As Exception) As Boolean
|
|
If CanReadSecuredLogonParameters() Then
|
|
FormsAuthentication.SignOut()
|
|
canReadSecuredLogonParameters_Renamed = False
|
|
Try
|
|
Start()
|
|
Finally
|
|
canReadSecuredLogonParameters_Renamed = True
|
|
End Try
|
|
Return True
|
|
Else
|
|
Return MyBase.OnLogonFailed(logonParameters, e)
|
|
End If
|
|
End Function
|
|
Protected Overrides Sub ReadLastLogonParametersCore(ByVal storage As DevExpress.ExpressApp.Utils.SettingsStorage, ByVal logonObject As Object)
|
|
Dim standardLogonParameters As AuthenticationStandardLogonParameters = TryCast(logonObject, AuthenticationStandardLogonParameters)
|
|
If (standardLogonParameters IsNot Nothing) AndAlso String.IsNullOrEmpty(standardLogonParameters.UserName) Then
|
|
MyBase.ReadLastLogonParametersCore(storage, logonObject)
|
|
Try
|
|
TryCast(logonObject, ChangeLogon).DBConnection = TryCast(storage, DevExpress.ExpressApp.Utils.SettingsStorageOnCookies).LoadOption("", "DBConnection")
|
|
TryCast(logonObject, ChangeLogon).SQLServer = TryCast(storage, DevExpress.ExpressApp.Utils.SettingsStorageOnCookies).LoadOption("", "SQLServer")
|
|
Select Case TryCast(storage, DevExpress.ExpressApp.Utils.SettingsStorageOnCookies).LoadOption("", "SQLType")
|
|
Case "MSSQL"
|
|
TryCast(logonObject, ChangeLogon).SQLType = eSQLType.MSSQL
|
|
Case "PostgreSQL"
|
|
TryCast(logonObject, ChangeLogon).SQLType = eSQLType.PostgreSQL
|
|
Case "MySQL"
|
|
TryCast(logonObject, ChangeLogon).SQLType = eSQLType.MySQL
|
|
End Select
|
|
Catch
|
|
End Try
|
|
End If
|
|
End Sub
|
|
Protected Overrides Sub OnLoggingOn(ByVal args As LogonEventArgs)
|
|
Dim connstr As String
|
|
Dim _ChangeLogon As ChangeLogon
|
|
Dim _plattform As String = ""
|
|
MyBase.OnLoggingOn(args)
|
|
_ChangeLogon = TryCast(args.LogonParameters, ChangeLogon)
|
|
|
|
GLOBAL_SQLType = _ChangeLogon.SQLType
|
|
GLOBAL_SQLServer = _ChangeLogon.SQLServer
|
|
GLOBAL_SQLDatabase = _ChangeLogon.DBConnection
|
|
|
|
Select Case _ChangeLogon.SQLType
|
|
Case eSQLType.MSSQL
|
|
connstr = " User ID=sa; "
|
|
connstr &= " Password=pcl718;"
|
|
connstr &= " Pooling=false;"
|
|
connstr &= " Data Source=" & _ChangeLogon.SQLServer & ";"
|
|
connstr &= " Initial Catalog=" & _ChangeLogon.DBConnection
|
|
_plattform = "MS SQL"
|
|
GLOBAL_SQLUser = "sa"
|
|
GLOBAL_SQLPassword = "pcl718"
|
|
Case eSQLType.MySQL
|
|
connstr = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString(_ChangeLogon.SQLServer, "root", "pcl718", _ChangeLogon.DBConnection)
|
|
_plattform = "MySQL"
|
|
GLOBAL_SQLUser = "root"
|
|
GLOBAL_SQLPassword = "pcl718"
|
|
Case eSQLType.PostgreSQL
|
|
connstr = DevExpress.Xpo.DB.PostgreSqlConnectionProvider.GetConnectionString(_ChangeLogon.SQLServer, "root", "pcl718", _ChangeLogon.DBConnection)
|
|
_plattform = "postgreSQL"
|
|
GLOBAL_SQLUser = "root"
|
|
GLOBAL_SQLPassword = "pcl718"
|
|
Case Else
|
|
connstr = " User ID=sa; "
|
|
connstr &= " Password=pcl718;"
|
|
connstr &= " Pooling=false;"
|
|
connstr &= " Data Source=" & _ChangeLogon.SQLServer & ";"
|
|
connstr &= " Initial Catalog=" & _ChangeLogon.DBConnection
|
|
GLOBAL_SQLUser = "sa"
|
|
GLOBAL_SQLPassword = "pcl718"
|
|
End Select
|
|
|
|
Me.ConnectionString = connstr
|
|
'GLOBAL_ConnectionString = connstr
|
|
'GLOBAL_WINFormCaption = "SISBusiness Framework version: " & Application.ProductVersion
|
|
'GLOBAL_WINFormCaption += ", (" & _plattform & ") Server: " & UCase(_ChangeLogon.SQLServer) & ", Database: " & UCase(_ChangeLogon.DBConnection)
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
End Class
|