Files
2017-03-08 11:21:27 +01:00

112 lines
4.6 KiB
VB.net

Imports Microsoft.VisualBasic
Imports System
Imports System.Configuration
Imports System.Web.Configuration
Imports System.Web
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Web
Imports DevExpress.Web
Imports Nuvolar.Module
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Public Class [Global]
Inherits System.Web.HttpApplication
Public Sub New()
InitializeComponent()
End Sub
Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
AddHandler ASPxWebControl.CallbackError, AddressOf Application_Error
#If EASYTEST Then
DevExpress.ExpressApp.Web.TestScripts.TestScriptsManager.EasyTestEnabled = True
#End If
End Sub
Protected Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
WebApplication.SetInstance(Session, New NuvolarAspNetApplication())
#If EASYTEST Then
If (Not ConfigurationManager.ConnectionStrings.Item("EasyTestConnectionString") Is Nothing) Then
WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings.Item("EasyTestConnectionString").ConnectionString
End If
#End If
If (Not ConfigurationManager.ConnectionStrings.Item("ConnectionString") Is Nothing) Then
WebApplication.Instance.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
End If
'/// IDEIGLENESEN !!!
'If System.Diagnostics.Debugger.IsAttached Then
' WebApplication.Instance.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways
'End If
AddHandler WebApplication.Instance.LastLogonParametersWriting, AddressOf WebApplication_LastLogonParametersWriting
AddHandler WebApplication.Instance.CreateCustomUserModelDifferenceStore, AddressOf WebApplication_CreateCustomUserModelDifferenceStore
AddHandler WebApplication.Instance.LoggingOff, AddressOf WebApplication_LoggingOff
WebApplication.Instance.Setup()
WebApplication.Instance.Start()
End Sub
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim filePath As String = HttpContext.Current.Request.PhysicalPath
If (Not String.IsNullOrEmpty(filePath)) AndAlso (filePath.IndexOf("Images") >= 0) AndAlso (Not System.IO.File.Exists(filePath)) Then
HttpContext.Current.Response.End()
End If
End Sub
Protected Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
ErrorHandling.Instance.ProcessApplicationError()
End Sub
Protected Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
WebApplication.LogOff(Session)
WebApplication.DisposeInstance(Session)
End Sub
Protected Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Private Sub WebApplication_LastLogonParametersWriting(sender As Object, e As LastLogonParametersWritingEventArgs)
e.SettingsStorage.SaveOption("", "UserName", (CType(e.LogonObject, AuthenticationStandardLogonParameters)).UserName)
e.SettingsStorage.SaveOption("", "DBConnection", GLOBAL_SQLDatabase)
e.SettingsStorage.SaveOption("", "SQLServer", GLOBAL_SQLServer)
e.SettingsStorage.SaveOption("", "Company", GLOBAL_Company)
Select Case GLOBAL_SQLType
Case eSQLType.MSSQL
e.SettingsStorage.SaveOption("", "SQLType", "MSSQL")
Case eSQLType.MySQL
e.SettingsStorage.SaveOption("", "SQLType", "MySQL")
Case eSQLType.PostgreSQL
e.SettingsStorage.SaveOption("", "SQLType", "PostgreSQL")
End Select
e.Handled = True
End Sub
Private Sub WebApplication_CreateCustomUserModelDifferenceStore(sender As Object, e As CreateCustomModelDifferenceStoreEventArgs)
Dim userDiffs As New UserStore(CType(sender, WebApplication))
e.Store = userDiffs
e.Handled = True
End Sub
Private Sub WebApplication_LoggingOff(sender As Object, e As LoggingOffEventArgs)
End Sub
#Region "Web Form Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
End Sub
#End Region
End Class