lots of bugfixing for lookupgrid
This commit is contained in:
@@ -52,8 +52,8 @@ Public Class ActiveDirectoryInterface
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oGroupId As Int64 = Nothing
|
||||
|
||||
Dim oFirebirdSync As New SyncUsers.FirebirdSync(_logConfig, _firebird)
|
||||
Dim oSQLSync As New SyncUsers.MSSQLSync(_logConfig, _mssql)
|
||||
Dim oFirebirdSync As New SyncUsers.SyncUsersFirebird(_logConfig, _firebird)
|
||||
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, _mssql)
|
||||
Dim oSyncedUsersFirebird, oSyncedUsersMSSQL As List(Of ADUser)
|
||||
|
||||
Try
|
||||
|
||||
@@ -3,7 +3,7 @@ Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace SyncUsers
|
||||
Public Class FirebirdSync
|
||||
Public Class SyncUsersFirebird
|
||||
Implements ISyncUsers
|
||||
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace SyncUsers
|
||||
Public Class MSSQLSync
|
||||
Public Class SyncUsersMSSQL
|
||||
Implements ISyncUsers
|
||||
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _mssql As MSSQLServer
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As Database.MSSQLServer)
|
||||
Private Const ADDED_WHO = "Active Directory Sync"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
_mssql = MSSQL
|
||||
@@ -88,7 +90,7 @@ Namespace SyncUsers
|
||||
|
||||
Private Sub AddUserToGroup(UserId As Integer, GroupId As Integer) Implements ISyncUsers.AddUserToGroup
|
||||
Try
|
||||
Dim oSQL As String = $"INSERT INTO TBDD_GROUPS_USER (USER_ID, GROUP_ID) VALUES ({UserId}, {GroupId})"
|
||||
Dim oSQL As String = $"INSERT INTO TBDD_GROUPS_USER (USER_ID, GROUP_ID, ADDED_WHO) VALUES ({UserId}, {GroupId}, '{ADDED_WHO}')"
|
||||
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
|
||||
|
||||
If oResult = False Then
|
||||
@@ -135,7 +137,7 @@ Namespace SyncUsers
|
||||
|
||||
Private Function CreateUser(User As ADUser) As Integer Implements ISyncUsers.CreateUser
|
||||
Try
|
||||
Dim oSQL As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL) VALUES ('{User.GivenName}', '{User.Surname}', '{User.samAccountName}', '{User.Email}')"
|
||||
Dim oSQL As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL, ADDED_WHO) VALUES ('{User.GivenName}', '{User.Surname}', '{User.samAccountName}', '{User.Email}', '{ADDED_WHO}')"
|
||||
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
|
||||
|
||||
If oResult = True Then
|
||||
@@ -154,7 +156,7 @@ Namespace SyncUsers
|
||||
Dim oCustomAttributes = User.CustomAttributes
|
||||
|
||||
For Each oAttribute In oCustomAttributes
|
||||
Dim oSQL As String = $"UPDATE TBDD_USER SET {oAttribute.MSSQLColumn} = '{oAttribute.Value}' WHERE GUID = {UserId}"
|
||||
Dim oSQL As String = $"UPDATE TBDD_USER SET {oAttribute.MSSQLColumn} = '{oAttribute.Value}', CHANGED_WHO = '{ADDED_WHO}' WHERE GUID = {UserId}"
|
||||
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
|
||||
|
||||
If oResult = False Then
|
||||
|
||||
Reference in New Issue
Block a user