check user login
This commit is contained in:
@@ -44,9 +44,7 @@ Public Class frmMain
|
||||
ConfigManager.Save()
|
||||
Application.Restart()
|
||||
Else
|
||||
FormHelper.ShowErrorMessage(New ApplicationException("No Database configured. Application will close!"), "Form Load")
|
||||
Application.Exit()
|
||||
|
||||
Throw New ApplicationException("No Database configured. Application will close!")
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -61,24 +59,42 @@ Public Class frmMain
|
||||
.Database = Database
|
||||
}
|
||||
|
||||
If Database.DBInitialized = True Then
|
||||
Dim ConfigModel = New ConfigModel(State)
|
||||
State.DbConfig = ConfigModel.LoadConfiguration()
|
||||
State.UserId = ConfigModel.GetUserId()
|
||||
If Database.DBInitialized = False Then
|
||||
Throw New ApplicationException("Could not connect to the database. Application will close!")
|
||||
End If
|
||||
|
||||
Dim ConfigModel = New ConfigModel(State)
|
||||
State.DbConfig = ConfigModel.LoadConfiguration()
|
||||
|
||||
Dim oUserModel = New UserModel(State)
|
||||
State.UserId = oUserModel.SelectUserId()
|
||||
|
||||
Dim oUser = oUserModel.SelectUser()
|
||||
oUser = oUserModel.CheckUserLogin(oUser)
|
||||
|
||||
If oUser.HasAccess = False Then
|
||||
Throw New ApplicationException("User is not activated for this module. Please contact your administrator. Application will close!")
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(State.DbConfig.ExternalProgramName) Then
|
||||
Me.Text = State.DbConfig.ExternalProgramName
|
||||
Text = State.DbConfig.ExternalProgramName
|
||||
End If
|
||||
|
||||
Controller = New EnvelopeListController(State)
|
||||
|
||||
LoadEnvelopeData()
|
||||
|
||||
Catch ex As ApplicationException
|
||||
Logger.Error(ex)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
|
||||
Application.Exit()
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
MsgBox($"Unexpected error: {ex.Message}", MsgBoxStyle.Critical, Text)
|
||||
Application.Exit()
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub LoadEnvelopeData()
|
||||
|
||||
Reference in New Issue
Block a user