lots of bugfixing for lookupgrid
This commit is contained in:
@@ -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