2019-02-19 16:58:01 +01:00

52 lines
1.9 KiB
VB.net

Imports DigitalData.Modules.Logging
Public Class frmUserManager
Private _Logger As Logger
Public Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_Logger = My.LogConfig.GetLogger()
End Sub
Private Async Sub frmUserManager_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oUserTable = Await GetAttributeListAsync("User")
Dim oGroupTable = Await GetAttributeListAsync("Group")
Dim oUserGroupTable = Await GetAttributeListAsync("User_Group")
UCUserToGroup.Init(oGroupTable, oUserTable, oUserGroupTable, "GROUP_ID", "USER_ID")
End Sub
Private Async Function GetAttributeListAsync(AttributeName As String) As Task(Of DataTable)
Try
Dim oSQL = $"SELECT * FROM VWICM_{AttributeName.ToUpper}"
Dim oRequest = Await My.Channel.CreateDatabaseRequestAsync($"List Attribute {AttributeName}", False)
Dim oResult = Await My.Channel.ReturnDatatableAsync(oSQL)
Await My.Channel.CloseDatabaseRequestAsync()
Return oResult.Table
Catch ex As Exception
_Logger.Error(ex)
Throw ex
End Try
End Function
Private Async Sub BarButtonUserEdit_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonUserEdit.ItemClick
Dim oDatatable = Await GetAttributeListAsync("User")
Dim oForm As New frmEdit()
oForm.Datatable = oDatatable
oForm.Show()
End Sub
Private Async Sub BarButtonGroupEdit_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonGroupEdit.ItemClick
Dim oDatatable = Await GetAttributeListAsync("Group")
Dim oForm As New frmEdit()
oForm.Datatable = oDatatable
oForm.Show()
End Sub
End Class