This commit is contained in:
Jonathan Jenne 2022-03-28 16:43:06 +02:00
commit 63aa197421
3 changed files with 49 additions and 24 deletions

View File

@ -97,7 +97,13 @@ Public Class frmAdmin_UserImport
Logger.Warn("User [{0}] could not be imported!", oRow.samAccountName)
End If
Else
oSkipped += 1
If UpdatetUser(oRow.samAccountName, oRow.Surname, oRow.GivenName, oRow.Email) Then
oImported += 1
Else
Logger.Warn("User [{0}] could not be updated!", oRow.samAccountName)
oSkipped += 1
End If
End If
Next
@ -187,13 +193,24 @@ Public Class frmAdmin_UserImport
VALUES ('{prename}','{name}','{username}','{email}','{oAddedWho}')"
Dim oResult = My.DatabaseECM.ExecuteNonQuery(oSql)
Return True
Return oResult
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function UpdatetUser(username As String, prename As String, name As String, email As String)
Try
Dim oAddedWho As String = Environment.UserName
Dim oSql As String = $"UPDATE TBDD_USER SET PRENAME = '{prename}', NAME = '{name}', EMAIL = , CHANGED_WHO = '{Environment.UserName}' WHERE USERNAME = '{username}')"
Dim oResult = My.DatabaseECM.ExecuteNonQuery(oSql)
Return oResult
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function InsertGroup(name As String, Optional ECM_FK_ID As Integer = 1, Optional adSync As Boolean = True, Optional internal As Boolean = False, Optional active As Boolean = True)
Try
Dim addedWho As String = Environment.UserName

View File

@ -16,23 +16,29 @@ Public Class ClassFolderwatcher
End Sub
Public Function Restart_FolderWatch() As Boolean
Try
If FWFolderWatcher.EnableRaisingEvents = True Then
'Gestartet also Stoppen
FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False
If Directory.Exists(My.Application.Globix.CurrentFolderWatchPath) Then
Try
If FWFolderWatcher.EnableRaisingEvents = True Then
'Gestartet also Stoppen
FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False
FWFolderWatcher = StartFolderwatcherForPath(My.Application.Globix.CurrentFolderWatchPath)
My.Application.Globix.Folderwatchstarted = True
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
End If
Return True
Catch ex As Exception
Logger.Info($"Error in Restart_FolderWatch: {ex.Message}")
Logger.Error(ex.Message)
FWFolderWatcher = StartFolderwatcherForPath(My.Application.Globix.CurrentFolderWatchPath)
My.Application.Globix.Folderwatchstarted = True
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
End If
Return True
Catch ex As Exception
Logger.Info($"Error in Restart_FolderWatch: {ex.Message}")
Logger.Error(ex.Message)
Return False
End Try
Else
Logger.Info($"Attention: Check the fodlerwatchinit-Module...My.Application.Globix.CurrentFolderWatchPath is not existing [{My.Application.Globix.CurrentFolderWatchPath}]")
Return False
End Try
End If
End Function
Public Sub Restart_FolderWatchSCAN()
Try
@ -53,7 +59,7 @@ Public Class ClassFolderwatcher
End Sub
Public Function StartStop_FolderWatch()
Try
If FWFolderWatcher Is Nothing OrElse FWFolderWatcher.EnableRaisingEvents = False Then
If FWFolderWatcher Is Nothing Then 'OrElse FWFolderWatcher.EnableRaisingEvents = False
' Folderwatch neu instanzieren
FWFolderWatcher = StartFolderwatcherForPath(My.Application.Globix.CurrentFolderWatchPath)
My.Application.Globix.Folderwatchstarted = True
@ -132,13 +138,13 @@ Public Class ClassFolderwatcher
End Function
Private Function StartFolderwatcherForPath(pPath As String) As FileSystemWatcher
Logger.Debug("Folder Watcher starting up for Path [{0}]", pPath)
Dim oWatcher = New FileSystemWatcher(pPath, "*.*") With {
.IncludeSubdirectories = False,
.EnableRaisingEvents = True
}
AddHandler oWatcher.Created, AddressOf OnCreated
Logger.Debug("Folder Watcher started for Path [{0}]", pPath)
Return oWatcher
End Function

View File

@ -39,7 +39,7 @@ Public Class frmGlobixBasicConfig
System.IO.Directory.CreateDirectory(pMypath)
End If
Catch ex As Exception
Logger.Info(" >> Unexpected error in CheckFolder: " & pMypath)
Logger.Info(">> Unexpected error in CheckFolder: " & pMypath)
Logger.Error(ex.Message)
Logger.Info(" >> " & ex.Message)
If My.Application.User.Language = "de-DE" Then
@ -51,9 +51,9 @@ Public Class frmGlobixBasicConfig
Exit Sub
End Try
Dim folderwatch = My.DatabaseECM.GetScalarValue("SELECT GUID FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'")
Dim folderwatch = My.DatabaseECM.GetScalarValue("SELECT COALESCE(MAX(GUID),999999) FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'")
Dim oSql As String
If folderwatch Is Nothing Then
If folderwatch = 999999 Then
oSql = "INSERT INTO TBGI_FOLDERWATCH_USER (USER_ID, FOLDER_PATH, FOLDER_TYPE, ADDED_WHO) VALUES (" & My.Application.User.UserId & ",'" & pMypath & "','" & FOLDER_TYPE & "','" & My.Application.User.UserName & "')"
Else
oSql = "UPDATE TBGI_FOLDERWATCH_USER SET FOLDER_PATH = '" & pMypath & "', CHANGED_WHO = '" & My.Application.User.UserName & "' where GUID = " & folderwatch
@ -62,12 +62,14 @@ Public Class frmGlobixBasicConfig
folderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'")
If FOLDER_TYPE = "SCAN" Then
My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = folderwatch
My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = pMypath
Me.TextEditScanfolder.Text = My.Application.Globix.CURRENT_SCAN_FOLDERWATCH
Else
My.Application.Globix.CurrentFolderWatchPath = folderwatch
My.Application.Globix.CurrentFolderWatchPath = pMypath
Me.TextEditHotfolder.Text = My.Application.Globix.CurrentFolderWatchPath
End If
Else
Logger.Error($"Unexpected error in Adding Folder to TBGI_FOLDERWATCH_USER [{oSql}]")
End If
If My.Application.Globix.Folderwatchstarted = True And FOLDER_TYPE = "DEFAULT" Then
clsFW.Restart_FolderWatch()