Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports DevExpress.ExpressApp.Web
Imports DevExpress.ExpressApp.Xpo
Imports DevExpress.ExpressApp
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering

Partial Public Class SISBusinessAspNetApplication
    Inherits WebApplication
    Private module1 As DevExpress.ExpressApp.SystemModule.SystemModule
    Private module2 As DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule
    Private module3 As SISBusiness.Module.SISBusinessModule
    Private module4 As SISBusiness.Module.Web.SISBusinessAspNetModule
    Private module5 As DevExpress.ExpressApp.Validation.ValidationModule
    Private module6 As DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule
    Private securityModule1 As DevExpress.ExpressApp.Security.SecurityModule
    Friend WithEvents AuditTrailModule1 As DevExpress.ExpressApp.AuditTrail.AuditTrailModule
    Friend WithEvents CloneObjectModule1 As DevExpress.ExpressApp.CloneObject.CloneObjectModule
    Friend WithEvents ConditionalAppearanceModule1 As DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule
    Friend WithEvents ViewVariantsModule1 As DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule
    Friend WithEvents AuthenticationStandard1 As DevExpress.ExpressApp.Security.AuthenticationStandard
    Friend WithEvents SecurityComplex1 As DevExpress.ExpressApp.Security.SecurityComplex
    Friend WithEvents ChartAspNetModule1 As DevExpress.ExpressApp.Chart.Web.ChartAspNetModule
    Friend WithEvents ChartModule1 As DevExpress.ExpressApp.Chart.ChartModule
    Friend WithEvents FileAttachmentsAspNetModule1 As DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule
    Friend WithEvents HtmlPropertyEditorAspNetModule1 As DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule
    Friend WithEvents KpiModule1 As DevExpress.ExpressApp.Kpi.KpiModule
    Friend WithEvents PivotChartAspNetModule1 As DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule
    Friend WithEvents PivotChartModuleBase1 As DevExpress.ExpressApp.PivotChart.PivotChartModuleBase
    Friend WithEvents PivotGridAspNetModule1 As DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule
    Friend WithEvents PivotGridModule1 As DevExpress.ExpressApp.PivotGrid.PivotGridModule
    Friend WithEvents ReportsAspNetModule1 As DevExpress.ExpressApp.Reports.Web.ReportsAspNetModule
    Friend WithEvents ReportsModule1 As DevExpress.ExpressApp.Reports.ReportsModule
    Friend WithEvents SchedulerAspNetModule1 As DevExpress.ExpressApp.Scheduler.Web.SchedulerAspNetModule
    Friend WithEvents SchedulerModuleBase1 As DevExpress.ExpressApp.Scheduler.SchedulerModuleBase
    Friend WithEvents TreeListEditorsAspNetModule1 As DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule
    Friend WithEvents TreeListEditorsModuleBase1 As DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase

    Private sqlConnection1 As System.Data.SqlClient.SqlConnection

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub SISBusinessAspNetApplication_DatabaseVersionMismatch(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs) Handles MyBase.DatabaseVersionMismatch
#If EASYTEST Then
        e.Updater.Update()
        e.Handled = True
#Else
        If System.Diagnostics.Debugger.IsAttached Then
            e.Updater.Update()
            e.Handled = True
        Else
            Throw New InvalidOperationException( _
             "The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application." & Constants.vbCrLf & _
             "This error occurred  because the automatic database update was disabled when the application was started without debugging." & Constants.vbCrLf & _
             "To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " & _
             "source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " & _
             "or manually create a database using the 'DBUpdater' tool." & Constants.vbCrLf & _
             "Anyway, refer to the 'Update Application and Database Versions' help topic at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm " & _
             "for more detailed information. If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/")
        End If
#End If
    End Sub
    Protected Overrides Sub CreateDefaultObjectSpaceProvider(args As CreateCustomObjectSpaceProviderEventArgs)
        args.ObjectSpaceProvider = New XPObjectSpaceProvider(args.ConnectionString, args.Connection)
    End Sub
    Private Sub InitializeComponent()
        Me.module1 = New DevExpress.ExpressApp.SystemModule.SystemModule()
        Me.module2 = New DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule()
        Me.module3 = New SISBusiness.[Module].SISBusinessModule()
        Me.module4 = New SISBusiness.[Module].Web.SISBusinessAspNetModule()
        Me.module5 = New DevExpress.ExpressApp.Validation.ValidationModule()
        Me.module6 = New DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule()
        Me.securityModule1 = New DevExpress.ExpressApp.Security.SecurityModule()
        Me.sqlConnection1 = New System.Data.SqlClient.SqlConnection()
        Me.AuditTrailModule1 = New DevExpress.ExpressApp.AuditTrail.AuditTrailModule()
        Me.CloneObjectModule1 = New DevExpress.ExpressApp.CloneObject.CloneObjectModule()
        Me.ConditionalAppearanceModule1 = New DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule()
        Me.ViewVariantsModule1 = New DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule()
        Me.AuthenticationStandard1 = New DevExpress.ExpressApp.Security.AuthenticationStandard()
        Me.SecurityComplex1 = New DevExpress.ExpressApp.Security.SecurityComplex()
        Me.ChartAspNetModule1 = New DevExpress.ExpressApp.Chart.Web.ChartAspNetModule()
        Me.ChartModule1 = New DevExpress.ExpressApp.Chart.ChartModule()
        Me.FileAttachmentsAspNetModule1 = New DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule()
        Me.HtmlPropertyEditorAspNetModule1 = New DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule()
        Me.KpiModule1 = New DevExpress.ExpressApp.Kpi.KpiModule()
        Me.PivotChartAspNetModule1 = New DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule()
        Me.PivotChartModuleBase1 = New DevExpress.ExpressApp.PivotChart.PivotChartModuleBase()
        Me.PivotGridAspNetModule1 = New DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule()
        Me.PivotGridModule1 = New DevExpress.ExpressApp.PivotGrid.PivotGridModule()
        Me.ReportsAspNetModule1 = New DevExpress.ExpressApp.Reports.Web.ReportsAspNetModule()
        Me.ReportsModule1 = New DevExpress.ExpressApp.Reports.ReportsModule()
        Me.SchedulerAspNetModule1 = New DevExpress.ExpressApp.Scheduler.Web.SchedulerAspNetModule()
        Me.SchedulerModuleBase1 = New DevExpress.ExpressApp.Scheduler.SchedulerModuleBase()
        Me.TreeListEditorsAspNetModule1 = New DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule()
        Me.TreeListEditorsModuleBase1 = New DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase()
        CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        '
        'module5
        '
        Me.module5.AllowValidationDetailsAccess = True
        '
        'sqlConnection1
        '
        Me.sqlConnection1.ConnectionString = "Data Source=(local);Initial Catalog=SISBusiness;Integrated Security=SSPI;Pooling=" & _
    "false"
        Me.sqlConnection1.FireInfoMessageEventOnUserErrors = False
        '
        'AuditTrailModule1
        '
        Me.AuditTrailModule1.AuditDataItemPersistentType = GetType(DevExpress.Persistent.BaseImpl.AuditDataItemPersistent)
        '
        'ViewVariantsModule1
        '
        Me.ViewVariantsModule1.GenerateVariantsNode = True
        Me.ViewVariantsModule1.ShowAdditionalNavigation = False
        '
        'AuthenticationStandard1
        '
        'Me.AuthenticationStandard1.LogonParametersType = GetType(DevExpress.ExpressApp.Security.AuthenticationStandardLogonParameters)
        Me.AuthenticationStandard1.LogonParametersType = GetType(SISBusiness.Module.ChangeLogon)
        '
        'SecurityComplex1
        '
        Me.SecurityComplex1.Authentication = Me.AuthenticationStandard1
        Me.SecurityComplex1.RoleType = GetType(DevExpress.Persistent.BaseImpl.Role)
        Me.SecurityComplex1.UserType = GetType(DevExpress.Persistent.BaseImpl.User)
        '
        'PivotChartModuleBase1
        '
        Me.PivotChartModuleBase1.ShowAdditionalNavigation = False
        '
        'ReportsModule1
        '
        Me.ReportsModule1.EnableInplaceReports = True
        Me.ReportsModule1.ReportDataType = GetType(DevExpress.Persistent.BaseImpl.ReportData)
        '
        'SISBusinessAspNetApplication
        '
        Me.ApplicationName = "SISBusiness"
        Me.Connection = Me.sqlConnection1
        Me.Modules.Add(Me.module1)
        Me.Modules.Add(Me.module2)
        Me.Modules.Add(Me.module6)
        Me.Modules.Add(Me.AuditTrailModule1)
        Me.Modules.Add(Me.CloneObjectModule1)
        Me.Modules.Add(Me.ConditionalAppearanceModule1)
        Me.Modules.Add(Me.module5)
        Me.Modules.Add(Me.ViewVariantsModule1)
        Me.Modules.Add(Me.securityModule1)
        Me.Modules.Add(Me.module3)
        Me.Modules.Add(Me.ChartModule1)
        Me.Modules.Add(Me.ChartAspNetModule1)
        Me.Modules.Add(Me.FileAttachmentsAspNetModule1)
        Me.Modules.Add(Me.HtmlPropertyEditorAspNetModule1)
        Me.Modules.Add(Me.KpiModule1)
        Me.Modules.Add(Me.PivotChartModuleBase1)
        Me.Modules.Add(Me.PivotChartAspNetModule1)
        Me.Modules.Add(Me.PivotGridModule1)
        Me.Modules.Add(Me.PivotGridAspNetModule1)
        Me.Modules.Add(Me.ReportsModule1)
        Me.Modules.Add(Me.ReportsAspNetModule1)
        Me.Modules.Add(Me.SchedulerModuleBase1)
        Me.Modules.Add(Me.SchedulerAspNetModule1)
        Me.Modules.Add(Me.module4)
        Me.Modules.Add(Me.TreeListEditorsModuleBase1)
        Me.Modules.Add(Me.TreeListEditorsAspNetModule1)
        Me.Security = Me.SecurityComplex1
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()

    End Sub

    Protected Overrides Sub OnLoggedOn(args As DevExpress.ExpressApp.LogonEventArgs)
        MyBase.OnLoggedOn(args)
        CType(MyBase.ShowViewStrategy, ShowViewStrategy).CollectionsEditMode = _
        DevExpress.ExpressApp.Editors.ViewEditMode.Edit

        Dim _onew As Xpo.XPObjectSpace = Me.ObjectSpaceProvider.CreateObjectSpace()
        Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
        Dim _User As DevExpress.Persistent.BaseImpl.User = _onew.FindObject(Of DevExpress.Persistent.BaseImpl.User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUserId))
        SISBusiness.Module.LockingModule.ReleaseAllLocking(_uow, _User)
    End Sub
    Protected Overrides Sub OnLoggingOff(args As LoggingOffEventArgs)

        'Dim _onew As Xpo.XPObjectSpace = Me.ObjectSpaceProvider.CreateObjectSpace()
        'Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
        'Dim _User As DevExpress.Persistent.BaseImpl.User = _onew.FindObject(Of DevExpress.Persistent.BaseImpl.User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUserId))
        'SISBusiness.Module.LockingModule.ReleaseAllLocking(_uow, _User)

        'MyBase.OnLoggingOff(args)
    End Sub

End Class


