Zooflow: Add Active Directory User Import
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
Imports DigitalData.GUIs.Common.Base
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.GUIs.Common.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class frmAdmin_User
|
||||
Implements IAdminForm
|
||||
@@ -8,7 +11,10 @@ Public Class frmAdmin_User
|
||||
Public Property HasChanges As Boolean Implements IAdminForm.HasChanges
|
||||
|
||||
Public Property IsInsert As Boolean Implements IAdminForm.IsInsert
|
||||
Public Property ErrorHandler As BaseErrorHandler
|
||||
|
||||
Private Property ErrorHandler As BaseErrorHandler
|
||||
Private Property Pages As ClassDetailPageManager
|
||||
Private Property Logger As Logger
|
||||
|
||||
Public Sub New(pPrimaryKey As Integer, Optional pIsInsert As Boolean = False)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -18,6 +24,7 @@ Public Class frmAdmin_User
|
||||
PrimaryKey = pPrimaryKey
|
||||
IsInsert = pIsInsert
|
||||
ErrorHandler = New BaseErrorHandler(My.LogConfig, My.LogConfig.GetLogger, Me)
|
||||
Logger = My.LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Private Sub frmAdmin_User_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
@@ -25,17 +32,39 @@ Public Class frmAdmin_User
|
||||
TBDD_USERTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString
|
||||
|
||||
If IsInsert Then
|
||||
DSDD_Stammdaten.TBDD_USER.ADDED_WHOColumn.DefaultValue = My.Application.User.UserName
|
||||
TBDD_USERBindingSource.AddNew()
|
||||
Else
|
||||
TBDD_USERTableAdapter.Fill(DSDD_Stammdaten.TBDD_USER, PrimaryKey)
|
||||
|
||||
End If
|
||||
Catch ex As System.Exception
|
||||
|
||||
' Add Focus Handler to all controls in all LayoutControls
|
||||
Pages = New ClassDetailPageManager(My.LogConfig, Me, New List(Of LayoutControl) From {LayoutControl1})
|
||||
Pages.Add(New ClassDetailPageManager.PrimaryPage(IsInsert) With {
|
||||
.Name = "Benutzer",
|
||||
.BindingSource = TBDD_USERBindingSource,
|
||||
.DataTable = DSDD_Stammdaten.TBDD_USER,
|
||||
.AddedWhoEdit = txtAddedWho,
|
||||
.ChangedWhoEdit = txtChangedWho
|
||||
})
|
||||
|
||||
Pages.PrepareLoad()
|
||||
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function DeleteData() As Boolean Implements IAdminForm.DeleteData
|
||||
#Region "DELETE ----------------------------------------------"
|
||||
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
||||
If DeleteData() Then
|
||||
Close()
|
||||
Else
|
||||
txtStatus.Caption = $"Error while deleting!"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function DeleteData() As Boolean Implements IAdminForm.DeleteData
|
||||
Try
|
||||
TBDD_USERTableAdapter.Delete(PrimaryKey)
|
||||
Return True
|
||||
@@ -44,31 +73,32 @@ Public Class frmAdmin_User
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Function SaveData() As Boolean
|
||||
Try
|
||||
TBDD_USERBindingSource.EndEdit()
|
||||
|
||||
If DSDD_Stammdaten.TBDD_USER.GetChanges() IsNot Nothing Then
|
||||
HasChanges = True
|
||||
|
||||
If IsInsert Then
|
||||
txtAddedWho.EditValue = My.Application.User.UserName
|
||||
Else
|
||||
txtChangedWho.EditValue = My.Application.User.UserName
|
||||
End If
|
||||
|
||||
TBDD_USERBindingSource.EndEdit()
|
||||
TBDD_USERTableAdapter.Update(DSDD_Stammdaten.TBDD_USER)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
ErrorHandler.ShowErrorMessage(ex, "DeleteData")
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
#End Region
|
||||
|
||||
#Region "SAVE ----------------------------------------------"
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
SaveData()
|
||||
End Sub
|
||||
|
||||
Private Sub frmAdmin_User_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown
|
||||
If e.KeyCode = Keys.F5 Then
|
||||
SaveData()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SaveData()
|
||||
If Pages.PrepareSave() = True Then
|
||||
Try
|
||||
Dim oPage = Pages.Current
|
||||
TBDD_USERTableAdapter.Update(oPage.DataTable)
|
||||
oPage.IsInsert = False
|
||||
txtStatus.Caption = $"{oPage.Name} gespeichert!"
|
||||
Catch ex As Exception
|
||||
ErrorHandler.ShowErrorMessage(ex, "ItemClick")
|
||||
End Try
|
||||
Else
|
||||
txtStatus.Caption = $"Keine Änderungen"
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user