79 lines
3.7 KiB
VB.net
79 lines
3.7 KiB
VB.net
Imports Microsoft.VisualBasic
|
|
Imports System
|
|
Imports System.Collections.Generic
|
|
Imports System.ComponentModel
|
|
Imports DevExpress.ExpressApp.Win
|
|
Imports DevExpress.ExpressApp.Updating
|
|
Imports DevExpress.ExpressApp
|
|
Imports System.Configuration
|
|
Imports DevExpress.ExpressApp.Security
|
|
Imports SISBusiness.Module
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports SISBusiness.Module.Win
|
|
Imports DevExpress.ExpressApp.Xpo
|
|
|
|
Partial Public Class SISBusinessWindowsFormsApplication
|
|
Inherits WinApplication
|
|
Implements IApplicationFactory
|
|
Friend WithEvents SystemModule1 As DevExpress.ExpressApp.SystemModule.SystemModule
|
|
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)
|
|
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)
|
|
Select Case _ChangeLogon.SQLType
|
|
Case eSQLType.MSSQL
|
|
connstr = " User ID=sisuser; "
|
|
connstr &= " Password=pcl718;"
|
|
connstr &= " Pooling=false;"
|
|
connstr &= " Data Source=" & _ChangeLogon.SQLServer & ";"
|
|
connstr &= " Initial Catalog=" & _ChangeLogon.DBConnection
|
|
_plattform = "MS SQL"
|
|
Case eSQLType.MySQL
|
|
connstr = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString(_ChangeLogon.SQLServer, "root", "pcl718", _ChangeLogon.DBConnection)
|
|
_plattform = "MySQL"
|
|
Case eSQLType.PostgreSQL
|
|
connstr = DevExpress.Xpo.DB.PostgreSqlConnectionProvider.GetConnectionString(_ChangeLogon.SQLServer, "root", "pcl718", _ChangeLogon.DBConnection)
|
|
_plattform = "postgreSQL"
|
|
Case Else
|
|
connstr = " User ID=sisuser; "
|
|
connstr &= " Password=pcl718;"
|
|
connstr &= " Pooling=false;"
|
|
connstr &= " Data Source=" & _ChangeLogon.SQLServer & ";"
|
|
connstr &= " Initial Catalog=" & _ChangeLogon.DBConnection
|
|
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
|
|
Protected Overrides Function OnLogonFailed(ByVal logonParameters As Object, ByVal e As Exception) As Boolean
|
|
If WinChangeDatabaseHelper.SkipLogonDialog Then
|
|
Return True
|
|
End If
|
|
Return MyBase.OnLogonFailed(logonParameters, e)
|
|
End Function
|
|
Public Shared Function CreateApplication() As SISBusinessWindowsFormsApplication
|
|
Dim winApplication As New SISBusinessWindowsFormsApplication
|
|
|
|
CType(winApplication.Security, SecurityBase).Authentication = New WinChangeDatabaseStandardAuthentication()
|
|
Return winApplication
|
|
End Function
|
|
|
|
Private Function IApplicationFactory_CreateApplication() As WinApplication Implements IApplicationFactory.CreateApplication
|
|
Return CreateApplication()
|
|
End Function
|
|
Protected Overrides Function GetModelAssemblyFilePath() As String
|
|
Return Nothing
|
|
End Function
|
|
End Class
|
|
|