19.07.2023
This commit is contained in:
@@ -11,7 +11,8 @@ Public Class frmMain
|
||||
Private ConfigManager As ConfigManager(Of Config)
|
||||
Private DbConfig As DbConfig
|
||||
|
||||
Private UserId As Integer = 0
|
||||
Private State As State
|
||||
Private Controller As EnvelopeListController
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Dim oLogPath = IO.Path.Combine(Application.LocalUserAppDataPath, "Log")
|
||||
@@ -22,14 +23,26 @@ Public Class frmMain
|
||||
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath)
|
||||
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
Dim oUserId = 0
|
||||
|
||||
If Database.DBInitialized = True Then
|
||||
DbConfig = GetDatabaseConfig()
|
||||
|
||||
Dim oUserId = Database.GetScalarValue($"SELECT GUID FROM TBDD_USER WHERE USERNAME = '{Environment.UserName}'")
|
||||
UserId = CInt(oUserId)
|
||||
oUserId = Database.GetScalarValue($"SELECT GUID FROM TBDD_USER WHERE USERNAME = '{Environment.UserName}'")
|
||||
End If
|
||||
|
||||
State = New State With {
|
||||
.UserId = CInt(oUserId),
|
||||
.Config = ConfigManager.Config,
|
||||
.DbConfig = DbConfig,
|
||||
.LogConfig = LogConfig,
|
||||
.Database = Database
|
||||
}
|
||||
|
||||
Controller = New EnvelopeListController(State)
|
||||
|
||||
GridEnvelopes.DataSource = Controller.ListEnvelopes()
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
@@ -50,16 +63,17 @@ Public Class frmMain
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
Dim oForm As New frmEnvelopeEditor() With {
|
||||
.State = New State With {
|
||||
.UserId = UserId,
|
||||
.Config = ConfigManager.Config,
|
||||
.DbConfig = DbConfig,
|
||||
.LogConfig = LogConfig,
|
||||
.Database = Database
|
||||
}
|
||||
}
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
|
||||
Dim oForm As New frmEnvelopeEditor() With {.State = State}
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub btnEditEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditEnvelope.ItemClick
|
||||
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
||||
If oSelectedRows.Count > 0 Then
|
||||
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(oSelectedRows(0))
|
||||
Dim oForm As New frmEnvelopeEditor() With {.State = State, .Envelope = oEnvelope}
|
||||
oForm.ShowDialog()
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user