Umgebungsvariablen

This commit is contained in:
ms
2025-03-20 10:03:27 +01:00
parent 4993a243c6
commit 0e5472a0f8
4 changed files with 70 additions and 47 deletions

View File

@@ -27,18 +27,31 @@ Public Class cBenutzer
Function FillWithLoggedOnUser(Optional ByVal dcabfrage As Boolean = False, Optional ByVal LDAPa As String = "") '"LDAP://DC=VERAG,DC=OST,DC=DMN")
Try
userPrincipalName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.UserPrincipalName
Name = System.DirectoryServices.AccountManagement.UserPrincipal.Current.Name
Hostname = Environment.MachineName
Catch
Catch ex As Exception
MsgBox("FillWithLoggedOnUser:" & ex.Message)
End Try
Domäne = System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain.ToString
BenutzeranmeldeName = Environment.UserDomainName & "\" & Environment.UserName
Username = Environment.UserName
If dcabfrage = True Then
'Class1.DebugText = userPrincipalName & LDAPa
FillFromDC(userPrincipalName, "userPrincipalName", LDAPa)
FillTimasID()
Try
'Class1.DebugText = userPrincipalName & LDAPa
FillFromDC(userPrincipalName, "userPrincipalName", LDAPa)
FillTimasID()
Catch ex As Exception
MsgBox("dcabfrage: " & ex.Message)
End Try
End If
End Function
@@ -127,13 +140,17 @@ Public Class cBenutzer
End Function
Function FillTimasID()
Dim ds As New DataSet
cSQL.SQL2DS("SELECT mit_timasID FROM ADMIN.dbo.tblMitarbeiter where mit_AliasAD_Username = '" & Me.sAMAccountName & "'", ds)
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows(0).Item(0) > 0 Then
Me.TimasID = ds.Tables(0).Rows(0).Item(0)
Try
Dim ds As New DataSet
cSQL.SQL2DS("SELECT mit_timasID FROM ADMIN.dbo.tblMitarbeiter where mit_AliasAD_Username = '" & Me.sAMAccountName & "'", ds)
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows(0).Item(0) > 0 Then
Me.TimasID = ds.Tables(0).Rows(0).Item(0)
End If
End If
End If
Catch ex As Exception
' MsgBox("FillTimasID: " & ex.Message)
End Try
End Function