Telefonnummer From AD to Admin Tool
This commit is contained in:
@@ -1121,15 +1121,35 @@ Public Class frmMitarbDetails
|
||||
If txtDurchwahl.Text = "" Then txtDurchwahl.Text = de.Properties("otherTelephone").Value
|
||||
If txtALIASUser.Text = "" Then txtALIASUser.Text = de.Properties("sAMAccountName").Value
|
||||
If txtEmailExtension.Text = "" Then txtEmailExtension.Text = de.Properties("extensionAttribute7").Value
|
||||
Dim phoneNr = de.Properties("telephoneNumber").Value
|
||||
|
||||
|
||||
Dim phoneNr As String = de.Properties("telephoneNumber").Value
|
||||
If phoneNr <> "" Then
|
||||
Dim digitsOnly As String = Regex.Replace(phoneNr, "\D", "")
|
||||
|
||||
Dim pattern = "-.*" 'enfernt alle zeichen nach -
|
||||
Dim myString = Regex.Replace(phoneNr, pattern, "")
|
||||
pattern = "DW.*" 'enfernt alle zeichen nach DW
|
||||
myString = Regex.Replace(myString, pattern, "")
|
||||
If txtTelNr.Text = "" Then txtTelNr.Text = myString.Trim()
|
||||
If digitsOnly.Length > 10 Then
|
||||
Dim digitCount As Integer = 0
|
||||
Dim splitIndex As Integer = -1
|
||||
|
||||
For i As Integer = 0 To phoneNr.Length - 1
|
||||
If Char.IsDigit(phoneNr(i)) Then
|
||||
digitCount += 1
|
||||
If digitCount = 10 Then
|
||||
splitIndex = i
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If splitIndex <> -1 Then
|
||||
If txtTelNr.Text = "" Then txtTelNr.Text = phoneNr.Substring(0, splitIndex + 1).Trim()
|
||||
If txtDurchwahl.Text = "" Then txtDurchwahl.Text = phoneNr.Substring(splitIndex + 1).Trim()
|
||||
Else
|
||||
If txtTelNr.Text = "" Then txtTelNr.Text = phoneNr.Trim()
|
||||
End If
|
||||
Else
|
||||
If txtTelNr.Text = "" Then txtTelNr.Text = phoneNr.Trim()
|
||||
End If
|
||||
End If
|
||||
|
||||
'cboALIASDomain.changeItem(frmAD.activeDirectoryObj.domain)
|
||||
|
||||
Reference in New Issue
Block a user