This commit is contained in:
ms
2021-07-01 08:39:14 +02:00
parent 1870307007
commit 67f2a10607
15 changed files with 247 additions and 52 deletions

View File

@@ -1,6 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.5.13.1" newVersion="5.5.13.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.Pdf" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.3.10.0" newVersion="6.3.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Dynamsoft.PDF" publicKeyToken="298ad97013b423eb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.510" newVersion="8.0.0.510" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> </configuration>

View File

@@ -7,12 +7,13 @@ Public Class Class1
Public sAppPath As String = Application.StartupPath Public sAppPath As String = Application.StartupPath
'Public Shared DBConString As String = "Server=NBMIESENBECK\SPIELWIESE;Initial Catalog=Doku;User ID=sa;Password=verag#3;Connection Timeout=5;" 'Public Shared DBConString As String = "Server=NBMIESENBECK\SPIELWIESE;Initial Catalog=Doku;User ID=sa;Password=verag#3;Connection Timeout=5;"
Public Shared DBConString As String Public Shared DBConString As String
Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=AppUser;Password=yp/THDd?xM+pZ$;Connection Timeout=5;"
Public Shared DBADMINBuchhaltung As String = "Data Source=SQLGuide01.verag.ost.dmn;Initial Catalog=ADMIN;Integrated Security=false;User ID=sa;Password=BmWr501956;" Public Shared DBADMINBuchhaltung As String = "Data Source=SQLGuide01.verag.ost.dmn;Initial Catalog=ADMIN;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;"
Public Shared DBAdmin As String = "[SQLGuide01.verag.ost.dmn].ADMIN" Public Shared DBAdmin As String = "[SQLGuide01.verag.ost.dmn].ADMIN"
Public Shared DBDoku As String = "Server=SQLGuide01.verag.ost.dmn\Verag;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" 'Public Shared DBDoku As String = "Server=SQLGuide01.verag.ost.dmn\Verag;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared DBDoku As String = "Server=SQLGuide01.verag.ost.dmn\Verag;Initial Catalog=Doku;User ID=AppUser;Password=yp/THDd?xM+pZ$;Connection Timeout=5;"
'Public Shared DBDoku As String = "Server=dokusql.verag.ost.dmn\sqlexpress;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" 'Public Shared DBDoku As String = "Server=dokusql.verag.ost.dmn\sqlexpress;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
Public Shared DBDokuTest As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" Public Shared DBDokuTest As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=AppUser;Password=yp/THDd?xM+pZ$;Connection Timeout=5;"
'Public Shared FilePath As String = "\\192.168.0.253\backup\temp_Sebastian\Spielwiese\Doku" 'Public Shared FilePath As String = "\\192.168.0.253\backup\temp_Sebastian\Spielwiese\Doku"
Public Shared FilePath As String ' = "\\192.168.0.90\f\EDV-Wartung\Dokumentation" Public Shared FilePath As String ' = "\\192.168.0.90\f\EDV-Wartung\Dokumentation"
Public Shared Absender As String = "Absender Standard" Public Shared Absender As String = "Absender Standard"

View File

@@ -1,5 +1,6 @@
Imports System.Net Imports System.Net
Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices
Imports Dhcp
Public Class DHCP Public Class DHCP
@@ -110,15 +111,29 @@ Public Class DHCP
ReDim DHCP_Clients(Client_Array.NumElements - 1) ReDim DHCP_Clients(Client_Array.NumElements - 1)
For i = 0 To Client_Array.NumElements - 1 For i = 0 To Client_Array.NumElements - 1
' pt = IntPtr.Zero '''keine Ahnung, nur ein Test, kann wieder weg
pt = Marshal.ReadIntPtr(Client_Array.Clients, j) pt = Marshal.ReadIntPtr(Client_Array.Clients, j)
DHCP_Clients(i) = Marshal.PtrToStructure(pt, GetType(DHCP_CLIENT_INFO)) 'DHCP_Clients(i) = Marshal.PtrToStructure(pt, GetType(DHCP_CLIENT_INFO))
pt = IntPtr.Zero pt = IntPtr.Zero
j = j + 4 j = j + 4
'Form1.Label1.Text &= DHCP_Clients(i).ClientName & " - " & DHCP_Clients(i).ClientIpAddress & " - " & Scobe_C - ((DHCP_Clients(i).ClientIpAddress * -1) + d) & vbCrLf 'Form1.Label1.Text &= DHCP_Clients(i).ClientName & " - " & DHCP_Clients(i).ClientIpAddress & " - " & Scobe_C - ((DHCP_Clients(i).ClientIpAddress * -1) + d) & vbCrLf
Next i Next i
' MsgBox("")
End Sub End Sub
Public Shared Function DHCP1(dhcps As String)
Dim dhcpsrv As DhcpServer = DhcpServer.Connect(dhcps)
Dim scope = dhcpsrv.Scopes.First()
Dim activeClients = scope.Clients '.Where(Function(c) c.AddressState = DhcpServerClientAddressStates.Active)
Return activeClients
End Function
Friend Shared Function StringIPAddressToUInt32(Address As String) As UInteger Friend Shared Function StringIPAddressToUInt32(Address As String) As UInteger

View File

@@ -15,6 +15,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>\\192.168.0.91\f\Programme\Doku\</PublishUrl> <PublishUrl>\\192.168.0.91\f\Programme\Doku\</PublishUrl>
<Install>false</Install> <Install>false</Install>
<InstallFrom>Unc</InstallFrom> <InstallFrom>Unc</InstallFrom>
@@ -32,10 +33,9 @@
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<DefineDebug>true</DefineDebug> <DefineDebug>true</DefineDebug>
@@ -93,6 +93,9 @@
<Reference Include="ClosedXML, Version=0.94.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ClosedXML, Version=0.94.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ClosedXML.0.94.2\lib\net46\ClosedXML.dll</HintPath> <HintPath>..\packages\ClosedXML.0.94.2\lib\net46\ClosedXML.dll</HintPath>
</Reference> </Reference>
<Reference Include="DhcpServerApi, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DhcpServerApi.0.3.0.0\lib\net40\DhcpServerApi.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=2.7.2.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL"> <Reference Include="DocumentFormat.OpenXml, Version=2.7.2.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.2.7.2\lib\net46\DocumentFormat.OpenXml.dll</HintPath> <HintPath>..\packages\DocumentFormat.OpenXml.2.7.2\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference> </Reference>

View File

@@ -645,29 +645,113 @@ Public Class Main
End Function End Function
Private Sub CmdTest_Click(sender As Object, e As EventArgs) Handles CmdTest.Click Private Sub CmdTest_Click(sender As Object, e As EventArgs) Handles CmdTest.Click
DHCP.DHCP1("192.168.0.98")
End Sub End Sub
Private Sub CMdTest2_Click(sender As Object, e As EventArgs) Handles CMdTest2.Click Private Sub CMdTest2_Click(sender As Object, e As EventArgs) Handles CMdTest2.Click
Dim testuser As New cDomUser DeleteGastWLANUser("ABABAB")
testuser.getDomUser("mit_email", "ms@verag.ag") End Sub
Private Sub btnTest3_Click(sender As Object, e As EventArgs) Handles btnTest3.Click
Dim i As Integer = 0
Dim c As String
' For meh As Integer = 0 To 1
Dim a, b As String
a = UsernamePasswordGenerator("u")
b = UsernamePasswordGenerator("p")
c &= a & " - " & b & vbCrLf
AddGastWLANUser(a, b)
'Next
Dim frm As New frmLeer WriteToFile(Application.StartupPath & "\WLAN.txt", c)
frm.Text = "Benutzerverwaltung" 'MsgBox(a & vbCrLf & b)
Dim usrcntrl As New uscntr_DomUser End Sub
usrcntrl.DomUser = testuser
usrcntrl.Dock = DockStyle.Fill : frm.PanMain.Controls.Add(usrcntrl)
frm.Size = usrcntrl.Size
frm.Show()
AddHandler frm.FormClosing, Function() Public Function UsernamePasswordGenerator(x As String, Optional ByVal Zeichenanzahl As Integer = 6) As String ' wenn u dann Username, sonst Password
Dim str As String
Dim up As String
If x = "u" Then
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Else
str = "0123456789"
End If
Dim r As New Random
For i As Integer = 0 To Zeichenanzahl - 1
up &= str(r.Next(0, str.Length)).ToString
Next
Return up
'MsgBox(up)
End Function
Private Function AddGastWLANUser(Username As String, Optional ByVal Password As String = "verag1", Optional ByVal Zugangsdaten As String = "WLANAdmin@192.168.0.97 -pw 6a0D5Ys93uugLi3uVciV", Optional ByVal AblaufZeit As Integer = 2)
If Not File.Exists(Application.StartupPath & "\AddWLANUser.bat") Then File.Create(Application.StartupPath & "\AddWLANUser.bat")
Dim AddWLANUser As String = Application.StartupPath & "\AddWLANUser.bat"
Dim exptime As String = Date.Now.AddHours(AblaufZeit).ToString("yyyy-MM-dd HH:mm")
Dim battext As String = ""
battext = "(
echo configure terminal
echo dynamic-guest username " & Username & "
echo password " & Password & "
echo expire-time " & exptime & "
echo group Fahrer_Gruppe
echo exit
echo exit
echo exit
) | plink -ssh " & Zugangsdaten & "
exit"
WriteToFile(AddWLANUser, battext)
Threading.Thread.Sleep(1500)
Dim Add As New Process
Add.StartInfo.FileName = Application.StartupPath & "\RunNHide.exe"
Add.StartInfo.Arguments = AddWLANUser
Add.Start()
End Function End Function
End Sub Private Function DeleteGastWLANUser(Username As String, Optional ByVal Zugangsdaten As String = "WLANAdmin@192.168.0.97 -pw 6a0D5Ys93uugLi3uVciV")
Private Sub btnTest3_Click(sender As Object, e As EventArgs) Handles btnTest3.Click If Not File.Exists(Application.StartupPath & "\DELWLANUser.bat") Then File.Create(Application.StartupPath & "\DELWLANUser.bat")
RestartServices("TS12.verag.ost.dmn", "Druckerwarteschlange") Dim DELWLANUser As String = Application.StartupPath & "\DELWLANUser.bat"
End Sub Dim battext As String = ""
battext = "(
echo configure terminal
echo no dynamic-guest " & Username & "
echo exit
echo exit
echo exit
) | plink -ssh " & Zugangsdaten & "
exit"
WriteToFile(DELWLANUser, battext)
Threading.Thread.Sleep(1500)
Dim del As New Process
del.StartInfo.FileName = Application.StartupPath & "\RunNHide.exe"
del.StartInfo.Arguments = DELWLANUser
del.Start()
'Process.Start(Application.StartupPath & "\RunNHide.exe " & DELWLANUser)
End Function
Public Shared Function WriteToFile(filepath As String, texttowrite As String)
Try
Dim objWriter As New System.IO.StreamWriter(filepath)
objWriter.Write(texttowrite)
objWriter.Close()
Catch ex As Exception
MsgBox(filepath & vbCrLf & " konnte nicht geschrieben werden." & vbCrLf & ex.Message)
End Try
End Function
Public Sub RestartServices(Servername As String, Dienst As String) Public Sub RestartServices(Servername As String, Dienst As String)
@@ -715,21 +799,30 @@ Public Class Main
Public Function GetDHCPClients(Netzwerk As String, DHCPServer As String, Fill As Boolean, ByRef ds As DataSet) Public Function GetDHCPClients(Netzwerk As String, DHCPServer As String, Fill As Boolean, ByRef ds As DataSet)
Dim NWShort As String Dim DHCPClientList = DHCP.DHCP1(DHCPServer)
'Dim NWShort As String
Dim DHCPClientIP As String Dim DHCPClientIP As String
Dim dhcpclients() As DHCP.DHCP_CLIENT_INFO 'Dim dhcpclients() As DHCP.DHCP_CLIENT_INFO
LblDebugInfo.Text &= "" LblDebugInfo.Text &= ""
Dim a As UInteger = DHCP.StringIPAddressToUInt32(Netzwerk) 'Dim a As UInteger = DHCP.StringIPAddressToUInt32(Netzwerk)
Dim b As UInteger = DHCP.StringIPAddressToUInt32("255.255.255.255") 'Dim b As UInteger = DHCP.StringIPAddressToUInt32("255.255.255.255")
DHCP.ListSubnetClients(DHCPServer, Netzwerk, dhcpclients) 'DHCP.ListSubnetClients(DHCPServer, Netzwerk, dhcpclients)
DHCP.StringNWAdressToNWAdressSHORT(Netzwerk, NWShort) 'DHCP.StringNWAdressToNWAdressSHORT(Netzwerk, NWShort)
'Dim test As String
'For Each client In DHCPClientList
' test &= client.name & vbCrLf
'Next
Try Try
For i = 0 To DHCP.Client_Array.NumElements - 1 For Each dhcpclient In DHCPClientList 'DHCP.Client_Array.NumElements - 1
DHCPClientIP = NWShort & (b - ((dhcpclients(i).ClientIpAddress * -1) + a - 1)).ToString DHCPClientIP = dhcpclient.IpAddress.ToString 'NWShort & (b - ((dhcpclient.IpAddress * -1) + a - 1)).ToString
''----------------------------------------Fill True: Wenn DHCP Clients bereits im DS enthalten sind werden diese Hosts geändert. ''----------------------------------------Fill True: Wenn DHCP Clients bereits im DS enthalten sind werden diese Hosts geändert.
' If Fill = True Then ' If Fill = True Then
@@ -737,7 +830,7 @@ Public Class Main
HostRow = ds.Tables(0).Select("IPAdresse = '" & DHCPClientIP & "'") HostRow = ds.Tables(0).Select("IPAdresse = '" & DHCPClientIP & "'")
' MsgBox(DHCPClientIP & HostRow.Length) ' MsgBox(DHCPClientIP & HostRow.Length)
If HostRow.Length > 0 Then If HostRow.Length > 0 Then
HostRow(0)("FQDN") = "*" & dhcpclients(i).ClientName HostRow(0)("FQDN") = "*" & dhcpclient.Name
HostRow(0)("QINFO") = "DHCP Client" HostRow(0)("QINFO") = "DHCP Client"
@@ -752,10 +845,10 @@ Public Class Main
Dim newrow As DataRow = ds.Tables(0).NewRow() Dim newrow As DataRow = ds.Tables(0).NewRow()
newrow("IPAdresse") = DHCPClientIP newrow("IPAdresse") = DHCPClientIP
newrow("FQDN") = "*" & dhcpclients(i).ClientName newrow("FQDN") = "*" & dhcpclient.Name
newrow("QINFO") = "DHCP Client" newrow("QINFO") = "DHCP Client"
newrow("DHCP") = "1" newrow("DHCP") = "1"
newrow("Host") = (b - ((dhcpclients(i).ClientIpAddress * -1) + a - 1)).ToString newrow("Host") = Class1.IP2Host(dhcpclient.ipaddress.ToString) '(b - ((dhcpclient.IPAddress * -1) + a - 1)).ToString
ds.Tables(0).Rows.Add(newrow) ds.Tables(0).Rows.Add(newrow)
'End If 'End If

View File

@@ -10,9 +10,9 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyTitle("Dokumentation")> <Assembly: AssemblyTitle("Dokumentation")>
<Assembly: AssemblyDescription("")> <Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")> <Assembly: AssemblyCompany("Verag AG")>
<Assembly: AssemblyProduct("Dokumentation")> <Assembly: AssemblyProduct("Dokumentation")>
<Assembly: AssemblyCopyright("Copyright © 2018")> <Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")> <Assembly: AssemblyVersion("0.0.1.72")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("0.0.1.72")>

View File

@@ -289,7 +289,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.69 ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.72 ähnelt.
'''</summary> '''</summary>
Friend ReadOnly Property Version() As String Friend ReadOnly Property Version() As String
Get Get

View File

@@ -155,7 +155,7 @@
<value>..\Resources\Admin.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Admin.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Version" xml:space="preserve"> <data name="Version" xml:space="preserve">
<value>0.0.1.69</value> <value>0.0.1.72</value>
</data> </data>
<data name="Link" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Link" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@@ -46,6 +46,7 @@ Partial Class frmLeer
Me.ClientSize = New System.Drawing.Size(246, 450) Me.ClientSize = New System.Drawing.Size(246, 450)
Me.Controls.Add(Me.PanMain) Me.Controls.Add(Me.PanMain)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.KeyPreview = True
Me.Name = "frmLeer" Me.Name = "frmLeer"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "frmLeer" Me.Text = "frmLeer"

View File

@@ -2,4 +2,9 @@
Private Sub frmLeer_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub frmLeer_Load(sender As Object, e As EventArgs) Handles Me.Load
' Me.Location = New Point(MousePosition.X - Me.Size.Width / 2, MousePosition.Y - Me.Size.Height / 2) ' Me.Location = New Point(MousePosition.X - Me.Size.Width / 2, MousePosition.Y - Me.Size.Height / 2)
End Sub End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then Me.Close()
End Sub
End Class End Class

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="ClosedXML" version="0.94.2" targetFramework="net472" /> <package id="ClosedXML" version="0.94.2" targetFramework="net472" />
<package id="DhcpServerApi" version="0.3.0.0" targetFramework="net472" />
<package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net472" /> <package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net472" />
<package id="Dynamsoft.DotNet.TWAIN" version="8.0.0" targetFramework="net472" /> <package id="Dynamsoft.DotNet.TWAIN" version="8.0.0" targetFramework="net472" />
<package id="ExcelNumberFormat" version="1.0.3" targetFramework="net472" /> <package id="ExcelNumberFormat" version="1.0.3" targetFramework="net472" />

View File

@@ -149,7 +149,7 @@ Partial Class uscntr_DomUser
Me.txtEMailAdresse.Margin = New System.Windows.Forms.Padding(8, 3, 8, 3) Me.txtEMailAdresse.Margin = New System.Windows.Forms.Padding(8, 3, 8, 3)
Me.txtEMailAdresse.Name = "txtEMailAdresse" Me.txtEMailAdresse.Name = "txtEMailAdresse"
Me.txtEMailAdresse.Size = New System.Drawing.Size(244, 20) Me.txtEMailAdresse.Size = New System.Drawing.Size(244, 20)
Me.txtEMailAdresse.TabIndex = 5 Me.txtEMailAdresse.TabIndex = 1
' '
'Label2 'Label2
' '

View File

@@ -133,7 +133,7 @@ Partial Class uscntr_DomUserList
Me.TextBox1.Margin = New System.Windows.Forms.Padding(8) Me.TextBox1.Margin = New System.Windows.Forms.Padding(8)
Me.TextBox1.Name = "TextBox1" Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(158, 20) Me.TextBox1.Size = New System.Drawing.Size(158, 20)
Me.TextBox1.TabIndex = 2 Me.TextBox1.TabIndex = 1
' '
'Label1 'Label1
' '
@@ -150,7 +150,7 @@ Partial Class uscntr_DomUserList
Me.cbDomain.Location = New System.Drawing.Point(231, 26) Me.cbDomain.Location = New System.Drawing.Point(231, 26)
Me.cbDomain.Name = "cbDomain" Me.cbDomain.Name = "cbDomain"
Me.cbDomain.Size = New System.Drawing.Size(211, 21) Me.cbDomain.Size = New System.Drawing.Size(211, 21)
Me.cbDomain.TabIndex = 0 Me.cbDomain.TabIndex = 2
' '
'Panel2 'Panel2
' '

View File

@@ -1,12 +1,16 @@
Imports System.Windows.Forms Imports System.Windows.Forms
Public Class uscntr_DomUserList Public Class uscntr_DomUserList
Dim DGVi As Integer = 0
Private Sub uscntr_DomUserList_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub uscntr_DomUserList_Load(sender As Object, e As EventArgs) Handles Me.Load
Class1.EnableDoubleBuffered(dgvListUser) Class1.EnableDoubleBuffered(dgvListUser)
LoadDomains() LoadDomains()
LoadDGV() LoadDGV()
End Sub End Sub
Function LoadDomains() Function LoadDomains()
Dim ds As New DataSet Dim ds As New DataSet
cSQL.SQL2DS("select distinct du_dom from Doku.dbo.TbL_DomUser order by du_dom", ds, Class1.DBDoku) cSQL.SQL2DS("select distinct du_dom from Doku.dbo.TbL_DomUser order by du_dom", ds, Class1.DBDoku)
@@ -19,6 +23,7 @@ Public Class uscntr_DomUserList
Function LoadDGV(Optional ByVal ReturnDataTable As Boolean = False) Function LoadDGV(Optional ByVal ReturnDataTable As Boolean = False)
DGVi = 0
Dim ds As New DataSet Dim ds As New DataSet
cSQL.SQL2DS("select * from Doku.dbo.TbL_DomUser " & ReturnOfTheWhere() & " ORDER BY du_nachname", ds, Class1.DBDoku) cSQL.SQL2DS("select * from Doku.dbo.TbL_DomUser " & ReturnOfTheWhere() & " ORDER BY du_nachname", ds, Class1.DBDoku)
@@ -61,10 +66,44 @@ Public Class uscntr_DomUserList
End Function End Function
Private Sub dgvListUser_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvListUser.CellDoubleClick 'dgvListUser.CellContentDoubleClick ', dgvListUser.CellDoubleClick Private Sub dgvListUser_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvListUser.CellDoubleClick 'dgvListUser.CellContentDoubleClick ', dgvListUser.CellDoubleClick
Dim testuser As New cDomUser 'Dim testuser As New cDomUser
testuser.getDomUser("du_ID", dgvListUser.CurrentRow.Cells("du_ID").Value) 'testuser.getDomUser("du_ID", dgvListUser.CurrentRow.Cells("du_ID").Value)
If Application.OpenForms().OfType(Of uscntr_DomUser).Any Then Exit Sub 'If Application.OpenForms().OfType(Of uscntr_DomUser).Any Then Exit Sub
'Dim frm As New frmLeer
'frm.Text = testuser.du_sAMAc
'Dim usrcntrl As New uscntr_DomUser
'usrcntrl.DomUser = testuser
'usrcntrl.Dock = DockStyle.Fill : frm.PanMain.Controls.Add(usrcntrl)
'frm.Size = usrcntrl.Size
'Me.Parent.Enabled = False
'AddHandler frm.FormClosing, Function()
' Try
' Me.Parent.Enabled = True
' BringToFront()
' LoadDGV()
' Catch
' End Try
' End Function
'frm.Show()
BeamMeUp()
End Sub
Private Function BeamMeUp(Optional Enter As Boolean = False, Optional RI As Integer = 0)
Dim testuser As New cDomUser
If Enter Then
testuser.getDomUser("du_ID", dgvListUser.Rows(RI).Cells("du_ID").Value)
Else
testuser.getDomUser("du_ID", dgvListUser.CurrentRow.Cells("du_ID").Value)
End If
If Application.OpenForms().OfType(Of uscntr_DomUser).Any Then Exit Function
Dim frm As New frmLeer Dim frm As New frmLeer
frm.Text = testuser.du_sAMAc frm.Text = testuser.du_sAMAc
@@ -84,8 +123,7 @@ Public Class uscntr_DomUserList
End Function End Function
frm.Show() frm.Show()
End Function
End Sub
Function ReturnOfTheWhere() Function ReturnOfTheWhere()
Dim Dom As String = cbDomain.SelectedItem Dim Dom As String = cbDomain.SelectedItem
@@ -122,6 +160,24 @@ Public Class uscntr_DomUserList
LoadDGV() LoadDGV()
End Sub End Sub
Private Sub EnterPress(ByVal sender As Object, ByVal e As KeyEventArgs) Handles TextBox1.KeyDown, dgvListUser.KeyDown
If e.KeyCode = Keys.Enter Then
' dgvListUser.Rows(0).Selected = True
BeamMeUp(True, DGVi)
ElseIf e.KeyCode = Keys.Down Then
If dgvListUser.Rows.Count - 1 > DGVi Then
DGVi = DGVi + 1
dgvListUser.Rows(DGVi).Selected = True
End If
ElseIf e.KeyCode = Keys.Up Then
If DGVi > 0 Then
DGVi = DGVi - 1
dgvListUser.Rows(DGVi).Selected = True
End If
End If
End Sub
Private Sub cmdReset_Click(sender As Object, e As EventArgs) Handles cmdReset.Click Private Sub cmdReset_Click(sender As Object, e As EventArgs) Handles cmdReset.Click
TextBox1.Text = "" TextBox1.Text = ""
cbDomain.SelectedItem = "*" cbDomain.SelectedItem = "*"
@@ -140,4 +196,7 @@ Public Class uscntr_DomUserList
Class1.datatable_2_csv_export(LoadDGV(True)) Class1.datatable_2_csv_export(LoadDGV(True))
End Sub End Sub
Private Sub dgvListUser_CellContentClick_1(sender As Object, e As DataGridViewCellEventArgs) Handles dgvListUser.CellClick
DGVi = dgvListUser.CurrentRow.Index
End Sub
End Class End Class

View File

@@ -169,6 +169,7 @@ Public Class uscntr_SendMSG
'MsgBox(battext) 'MsgBox(battext)
End Function End Function
Function ErsterEintragVonListOfString(liste As List(Of String)) Function ErsterEintragVonListOfString(liste As List(Of String))
If liste.Count > 0 Then If liste.Count > 0 Then
Return liste(0) Return liste(0)