81 lines
2.8 KiB
VB.net
81 lines
2.8 KiB
VB.net
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 = ""
|
|
cSQL.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
|