Bugfixes, "Verbesserungen"
This commit is contained in:
@@ -20,6 +20,7 @@ Public Class Class1
|
||||
Public Shared DebugMode As Boolean = False
|
||||
Public Shared DebugText As String = ""
|
||||
Public Shared GroupUsers As List(Of cBenutzer)
|
||||
Public Shared dtSuchergebnis As DataTable
|
||||
|
||||
Public Shared HostList As New List(Of String)
|
||||
|
||||
|
||||
@@ -32,29 +32,33 @@ Public Class cEintrag
|
||||
Public Function getFromSQL() '(ip As String)
|
||||
Dim ds As New DataSet
|
||||
Dim test As String = ""
|
||||
SQL.SQL2DS("SELECT * FROM TbL_Allgemein WHERE ID = '" & Me.ID & "'", ds)
|
||||
If ds.Tables(0).Rows.Count > 0 Then
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
Try
|
||||
SQL.SQL2DS("SELECT * FROM TbL_Allgemein WHERE ID = '" & Me.ID & "'", ds)
|
||||
If ds.Tables(0).Rows.Count > 0 Then
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ds.Clear()
|
||||
SQL.SQL2DS("SELECT * FROM TbL_Allgemein WHERE Rubrik = '" & rubrik & "' AND Titel = '" & Titel & "'", ds)
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
Next
|
||||
Else
|
||||
ds.Clear()
|
||||
SQL.SQL2DS("SELECT * FROM TbL_Allgemein WHERE Rubrik = '" & rubrik & "' AND Titel = '" & Titel & "'", ds)
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Me.ID = Guid.NewGuid().ToString("N") : NewID = True
|
||||
End If
|
||||
Next
|
||||
Me.ID = Guid.NewGuid().ToString("N") : NewID = True
|
||||
End If
|
||||
Catch
|
||||
Return -1
|
||||
End Try
|
||||
|
||||
' MsgBox("hier")
|
||||
End Function
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Public Class FirewallEntry
|
||||
Public Class cFirewallEntry
|
||||
Property fwr_ID As String = ""
|
||||
Property fwr_hostip As String = ""
|
||||
Property fwr_in As String = ""
|
||||
@@ -83,13 +83,13 @@ ORDER BY [fwr_in]"
|
||||
|
||||
End Function
|
||||
|
||||
Public Function insertFirewallEntry(ByRef entry As FirewallEntry)
|
||||
Public Function insertFirewallEntry(ByRef entry As cFirewallEntry)
|
||||
Dim insert As String
|
||||
getInsertCmd(insert)
|
||||
SQL.InsertSQL("TbL_FirewallRules", insert)
|
||||
End Function
|
||||
|
||||
Public Function updateFirewallEntry(ByRef entry As FirewallEntry)
|
||||
Public Function updateFirewallEntry(ByRef entry As cFirewallEntry)
|
||||
Dim update, where As String
|
||||
getUpdateCmd(update, where)
|
||||
SQL.UpdateSQL("TbL_FirewallRules", update, where)
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
Public Shared Function explorerstarten(ip As String, Optional ByVal smb As Boolean = False)
|
||||
Dim Path, nwstandort, netname As String
|
||||
Dim host As New Host
|
||||
Dim host As New cHost
|
||||
If smb = False Then
|
||||
host.gethost(ip)
|
||||
If host.Linked = True Then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class Host
|
||||
Public Class cHost
|
||||
Property FQDN As String = ""
|
||||
Property QINFO As String = ""
|
||||
Property IPAdresse As String = ""
|
||||
@@ -138,7 +138,7 @@ ORDER BY [fwr_in]"
|
||||
' MsgBox("hier")
|
||||
End Function
|
||||
|
||||
Public Function getUpdateCmd(ByRef update As String, ByRef where As String, Optional ByRef slaveupdate As String = "", Optional ByRef slavewhere As String = "", Optional ByVal Linked As Boolean = False, Optional ByVal newhost As Host = Nothing)
|
||||
Public Function getUpdateCmd(ByRef update As String, ByRef where As String, Optional ByRef slaveupdate As String = "", Optional ByRef slavewhere As String = "", Optional ByVal Linked As Boolean = False, Optional ByVal newhost As cHost = Nothing)
|
||||
If newhost Is Nothing Then
|
||||
slavewhere = ""
|
||||
Dim list As List(Of SQLVariable) = getparameterlistMaster()
|
||||
@@ -154,7 +154,7 @@ ORDER BY [fwr_in]"
|
||||
update = update.Substring(0, update.Length - 1) 'wg. ','
|
||||
|
||||
For Each i In slavelist ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''alle Hosts, bei denen dieser Host als LinkedWith eingetragen ist
|
||||
If Not i.SQLText = "IPAdresse" And Not i.SQLText = "LinkedWith" Then
|
||||
If Not i.SQLText = "IPAdresse" And Not i.SQLText = "LinkedWith" And Not i.SQLText = "NETNAME" And Not i.SQLText = "NWSTANDORT" And Not i.SQLText = "Netzwerk" Then
|
||||
slaveupdate &= "[" & i.SQLText & "]='" & i.SQLValue & "',"
|
||||
ElseIf i.SQLText = "IPAdresse" Then
|
||||
slavewhere &= "(Linked = 'True' AND (LinkedWith = '" & i.SQLValue & "'"
|
||||
@@ -191,7 +191,7 @@ ORDER BY [fwr_in]"
|
||||
|
||||
End Function
|
||||
|
||||
Public Function updateHostEntry(ByRef entry As Host)
|
||||
Public Function updateHostEntry(ByRef entry As cHost)
|
||||
Dim update, where, slaveupdate, slavewhere As String
|
||||
getUpdateCmd(update, where, slaveupdate, slavewhere, Me.Linked)
|
||||
SQL.UpdateSQL("TbL_Netzwerkclients", update, where)
|
||||
@@ -246,7 +246,7 @@ Diese Einträge werden ebenfalls gelöscht. Fortfahren?", "Hosteintrag löschen"
|
||||
If checkIfIPExist(newip) = False Then MsgBox("Die Adresse kann nicht verwendet werden. Bitte überprüfen.") : Return Me : Exit Function
|
||||
|
||||
Dim oldip As String = Me.IPAdresse
|
||||
Dim newhost As New Host
|
||||
Dim newhost As New cHost
|
||||
newhost.gethost(newip)
|
||||
|
||||
'Get Slaves of LinkedMaster
|
||||
80
Dokumentation/Classes/cNetzwerk.vb
Normal file
80
Dokumentation/Classes/cNetzwerk.vb
Normal file
@@ -0,0 +1,80 @@
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class cNetzwerk
|
||||
Property NetName As String = ""
|
||||
Property NWStandort As String = ""
|
||||
Property Netzwerkname As String = ""
|
||||
Property Netzwerk As String = ""
|
||||
Property Subnetz As String = ""
|
||||
Property VLAN As String = ""
|
||||
Property main As Boolean = Nothing
|
||||
Property Gateway As String = ""
|
||||
Property DHCPStart As String = ""
|
||||
Property DHCPEnd As String = ""
|
||||
Property DHCPServer As String = ""
|
||||
Property DHCPAbfragen As Boolean = False
|
||||
Property DNSServer As String = ""
|
||||
Property NWAddress As String = ""
|
||||
Property Info As String = ""
|
||||
Property StartIP As String = ""
|
||||
|
||||
|
||||
Function getparameterlist() As List(Of SQLVariable)
|
||||
Dim list As New List(Of SQLVariable)
|
||||
list.Add(New SQLVariable("NetName", NetName))
|
||||
list.Add(New SQLVariable("NWStandort", NWStandort))
|
||||
list.Add(New SQLVariable("Netzwerkname", Netzwerkname))
|
||||
list.Add(New SQLVariable("Netzwerk", Netzwerk))
|
||||
list.Add(New SQLVariable("Subnetz", Subnetz))
|
||||
list.Add(New SQLVariable("VLAN", VLAN))
|
||||
list.Add(New SQLVariable("main", main))
|
||||
list.Add(New SQLVariable("Gateway", Gateway))
|
||||
list.Add(New SQLVariable("DHCPStart", DHCPStart))
|
||||
list.Add(New SQLVariable("DHCPEnd", DHCPEnd))
|
||||
list.Add(New SQLVariable("DHCPServer", DHCPServer))
|
||||
list.Add(New SQLVariable("DNSServer", DNSServer))
|
||||
list.Add(New SQLVariable("NWAddress", NWAddress))
|
||||
list.Add(New SQLVariable("Info", Info))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
|
||||
Public Function getNetzwerk(nwstandort_ As String, netname_ As String)
|
||||
Dim ds As New DataSet
|
||||
' Dim test As String = ""
|
||||
SQL.SQL2DS("select * from TbL_Netzwerke where Netzwerkname = '" & nwstandort_ & "_" & netname_ & "'", ds)
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Me.NWStandort = nwstandort_ : Me.NetName = netname_
|
||||
' MsgBox("hier")
|
||||
End Function
|
||||
|
||||
Public Function getFirstHost()
|
||||
Dim Starthost As String = IP2Host(Me.Netzwerk) + 1
|
||||
Me.StartIP = Me.NWAddress & Starthost
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function IP2Host(IP As String)
|
||||
Dim pointcounter As Integer = 0
|
||||
Try
|
||||
Do
|
||||
If IP.StartsWith(".") Then
|
||||
pointcounter = pointcounter + 1
|
||||
End If
|
||||
IP = IP.Remove(0, 1)
|
||||
|
||||
Loop Until pointcounter = 3 'IP.First() = "."
|
||||
|
||||
Return IP
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user