This commit is contained in:
ms
2019-05-07 17:02:34 +02:00
parent b2f61df354
commit f2d5c20559
46 changed files with 7788 additions and 275 deletions

View File

@@ -0,0 +1,306 @@
Public Class frmHostBearbeiten
Public Shared IP As String = ""
Public host As New Host
Private Sub frmHostBearbeiten_Load(sender As Object, e As EventArgs) Handles Me.Load
lblSuchfilter.Visible = Main.SucheAktiv
host = New Host
host.gethost(IP)
fillform(host)
End Sub
Public Function fillform(host As Host, Optional ByVal Linked As Boolean = False)
If Linked = False Then ''''''''''''''''''
TxtIP.Text = host.IPAdresse
TxtHost.Text = host.HOST
ChkLinked.Checked = host.Linked
TxtLinkedWith.Text = host.LinkedWith
ElseIf Linked = True Then
If host.Linked Then TxtLinkedWith.Text = host.LinkedWith
End If
TxtName.Text = host.FQDN
TxtModell.Text = host.Modell
TxtStandort.Text = host.Standort
TxtQuickInfo.Text = host.QINFO
TxtType.Text = host.TYPE
TxtSeriennummer.Text = host.Seriennummer
TxtMAC.Text = host.MAC
TxtInfo.Text = host.INFO
TxtBenutzername.Text = host.Benutzer
TxtKennwort.Text = host.Passwort
TxtLink.Text = host.LINK
Dim ds As New DataSet
Host.getSlaves(host.IPAdresse, ds)
If ds.Tables(0).Rows.Count > 0 Then
ShowSlavesPanel(True, ds)
Else
ShowSlavesPanel(False)
End If
chkFirewall.Checked = host.Firewall
ShowFirewallPanel(chkFirewall.Checked)
CmdIPChange.Enabled = Not ChkLinked.Checked
End Function
Public Function LoadFromExternal(IPtoLoad As String)
Dim host As New Host
host.gethost(IPtoLoad)
fillform(host)
End Function
Function fillHost()
With host
.IPAdresse = TxtIP.Text
.FQDN = TxtName.Text
.HOST = TxtHost.Text
.Modell = TxtModell.Text
.Standort = TxtStandort.Text
.QINFO = TxtQuickInfo.Text
.TYPE = TxtType.Text
.Seriennummer = TxtSeriennummer.Text
.Linked = ChkLinked.Checked
.LinkedWith = TxtLinkedWith.Text
.MAC = TxtMAC.Text
.INFO = TxtInfo.Text
.Benutzer = TxtBenutzername.Text
.Passwort = TxtKennwort.Text
.LINK = TxtLink.Text
.Firewall = chkFirewall.Checked
End With
End Function
Private Sub CmdIPUp_Click(sender As Object, e As EventArgs) Handles CmdIPUp.Click, CmdIPDown.Click
Dim starthost, endhost As Integer
Class1.getStartEndHost(host.IPAdresse, starthost, endhost)
Dim newip As String = ""
Dim newhost As String = ""
' Dim meh As String = Main.DgVMain.Rows(0).Cells("IPAdresse").Value
If Main.SucheAktiv = False Then
'''
If sender.name = "CmdIPUp" Then
If host.HOST + 1 > endhost Then
newhost = endhost
Else
newhost = host.HOST + 1
Main.SelectedDGVIndex = Main.SelectedDGVIndex + 1
If Main.FirstDisplayedDGVEntry + 1 <= endhost Then Main.FirstDisplayedDGVEntry = Main.FirstDisplayedDGVEntry + 1
End If
newip = Class1.ip2ipnet(host.IPAdresse) & newhost
End If
If sender.name = "CmdIPDown" Then
If host.HOST - 1 <= starthost Then
newhost = starthost
Else
newhost = host.HOST - 1
Main.SelectedDGVIndex = Main.SelectedDGVIndex - 1
If Main.FirstDisplayedDGVEntry - 1 >= starthost Then
Main.FirstDisplayedDGVEntry = Main.FirstDisplayedDGVEntry - 1
Else
Main.FirstDisplayedDGVEntry = 0
End If
End If
newip = Class1.ip2ipnet(host.IPAdresse) & newhost
End If
''' newhost = meh.Rows(Main.SelectedDGVIndex).Cells("IPAdresse").Value
ElseIf Main.SucheAktiv = True Then
Dim meh As DataGridView = Main.DgVMain
If sender.name = "CmdIPUp" Then
If Main.SelectedDGVIndex + 1 < (meh.Rows.Count - 1) Then Main.SelectedDGVIndex = Main.SelectedDGVIndex + 1
newip = meh.Rows(Main.SelectedDGVIndex).Cells("IPAdresse").Value
If Main.FirstDisplayedDGVEntry + 1 <= endhost Then Main.FirstDisplayedDGVEntry = Main.FirstDisplayedDGVEntry + 1
End If
If sender.name = "CmdIPDown" Then
If Main.SelectedDGVIndex - 1 >= 0 Then Main.SelectedDGVIndex = Main.SelectedDGVIndex - 1
newip = meh.Rows(Main.SelectedDGVIndex).Cells("IPAdresse").Value
If Main.FirstDisplayedDGVEntry - 1 >= 1 Then Main.FirstDisplayedDGVEntry = Main.FirstDisplayedDGVEntry - 1
End If
End If
host = New Host
host.gethost(newip)
fillform(host)
End Sub
Private Sub CmdSave_Click(sender As Object, e As EventArgs) Handles CmdSave.Click
fillHost()
host.updateHostEntry(host)
fillform(host)
End Sub
Private Sub ChkLinked_CheckedChanged(sender As Object, e As EventArgs) Handles ChkLinked.CheckedChanged
TxtLinkedWith.Enabled = ChkLinked.Checked
CmdLink.Enabled = ChkLinked.Checked
If Not ChkLinked.Checked Then TxtLinkedWith.Text = ""
End Sub
Private Sub CmdLink_Click(sender As Object, e As EventArgs) Handles CmdLink.Click
Dim NETNAME As String = host.NETNAME
Dim Netzwerk As String = host.Netzwerk
host.gethost(TxtLinkedWith.Text)
host.NETNAME = NETNAME
host.Netzwerk = Netzwerk
fillform(host, True)
End Sub
Private Sub Hostbearbeiten_Closing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'abfrage_aenderungenspeichern()
Main.dgvload_filter(Main.Suchbegriff)
End Sub
Private Sub CmdAbbrechen_Click(sender As Object, e As EventArgs) Handles CmdAbbrechen.Click
'abfrage_aenderungenspeichern()
' Main.dgvload_filter(Main.Suchbegriff, False)
Close()
End Sub
Private Sub chkFirewall_CheckedChanged(sender As Object, e As EventArgs) Handles chkFirewall.MouseClick
Dim hostip As String = TxtIP.Text
If TxtLinkedWith.Text <> "" Then hostip = TxtLinkedWith.Text
EnableDisableFirewallBoolean(hostip, chkFirewall.Checked)
ShowFirewallPanel(chkFirewall.Checked)
End Sub
Public Function EnableDisableFirewallBoolean(ByVal hostip As String, ByVal EnDisable As Boolean)
SQL.UpdateSQL("TbL_Netzwerkclients", "Firewall = '" & EnDisable & "'", "ipadresse = '" & hostip & "'")
SQL.UpdateSQL("TbL_Netzwerkclients", "Firewall = '" & EnDisable & "'", "linkedwith = '" & hostip & "'")
End Function
Public Function ShowFirewallPanel(ByVal EnDisable As Boolean)
If EnDisable = True Then
PanFirewall.Controls.Clear()
PanFirewall.Visible = True
Dim UserControl As New uscntr_Firewalleinstellungen
PanFirewall.Size = UserControl.Size
UserControl.SplitContainer1.Panel1Collapsed = True
If host.Linked = False Then UserControl.Host = host.IPAdresse
If host.Linked = True Then UserControl.Host = host.LinkedWith
PanFirewall.Controls.Add(UserControl)
If PanSlaves.Visible = False Then PanFirewall.Location = PanSlaves.Location
If PanSlaves.Visible = True Then PanFirewall.Location = New Point(PanSlaves.Location.X + PanSlaves.Width + 6, PanSlaves.Location.Y)
Else
PanFirewall.Controls.Clear()
PanFirewall.Visible = False
End If
End Function
Public Function ShowSlavesPanel(ByVal EnDisable As Boolean, Optional ByVal ds As DataSet = Nothing)
If EnDisable = True Then
PanSlaves.Controls.Clear()
PanSlaves.Visible = True
Dim UserControl As New uscntr_Slaves
PanSlaves.Size = UserControl.Size
UserControl.ds = ds
PanSlaves.Controls.Add(UserControl)
Else
PanSlaves.Controls.Clear()
PanSlaves.Visible = False
End If
End Function
Private Sub TxtHost_KeyUp_Enter(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtHost.KeyUp ', TxtHost.TextChanged
Try
If e.KeyValue = Keys.Enter Then
Dim Netz As String = Class1.ip2ipnet(TxtIP.Text)
Dim NewHost As String = TxtHost.Text
host = New Host
host.gethost(Netz & NewHost)
fillform(host)
End If
Catch
End Try
End Sub
Private Sub ChkKennwortAnzeigen_CheckedChanged(sender As Object, e As EventArgs) Handles ChkKennwortAnzeigen.CheckedChanged
If ChkKennwortAnzeigen.Checked Then
TxtKennwort.PasswordChar = ""
Else
TxtKennwort.PasswordChar = "*"
End If
End Sub
Private Sub CmdHostLink_Click(sender As Object, e As EventArgs) Handles CmdHostLink.Click
Ext_Programme.startlink(TxtLink.Text)
End Sub
Private Sub CmdDateien_Click(sender As Object, e As EventArgs) Handles CmdDateien.Click
cFolder.explorerstarten(TxtIP.Text)
End Sub
Private Sub CmdReset_Click(sender As Object, e As EventArgs) Handles CmdReset.Click
host = New Host
host.gethost(TxtIP.Text)
fillform(host)
End Sub
Private Sub CmdCopy_Click(sender As Object, e As EventArgs) Handles CmdCopy.Click
Dim ZielHost As New Host
ZielHost = host
Dim ip As String
Class1.Host2IP(TxtHost.Text, host.NWSTANDORT, host.NETNAME, ip)
ZielHost.IPAdresse = ip
ZielHost.HOST = TxtHost.Text
ZielHost.updateHostEntry(ZielHost)
MsgBox("Host kopiert")
fillform(ZielHost)
End Sub
Private Sub CmdDelete_Click(sender As Object, e As EventArgs) Handles CmdDelete.Click
fillHost()
host.DeleteHost()
host = New Host
host.gethost(TxtIP.Text)
fillform(host)
End Sub
Private Sub CmdIPChange_Click(sender As Object, e As EventArgs) Handles CmdIPChange.Click
Dim newip As String = InputBox("neue IP Adresse eingeben:")
host = host.MoveHost(newip)
fillform(host)
End Sub
Private Sub TxtType_TextChanged(sender As Object, e As EventArgs) Handles TxtType.Enter, TxtStandort.Enter, TxtModell.Enter, TxtBenutzername.Enter
If sender.name = "TxtType" Then Class1.Autocomplete(TxtType, "Type", "Tbl_Netzwerkclients")
If sender.name = "TxtStandort" Then Class1.Autocomplete(TxtStandort, "Standort", "Tbl_Netzwerkclients")
If sender.name = "TxtModell" Then Class1.Autocomplete(TxtModell, "Modell", "Tbl_Netzwerkclients")
If sender.name = "TxtBenutzername" Then Class1.Autocomplete(TxtBenutzername, "Benutzer", "Tbl_Netzwerkclients")
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
End If
End Sub
Private Sub MitHTTPFüllenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MitHTTPFüllenToolStripMenuItem.Click
TxtLink.Text = "http://" & TxtIP.Text & "/"
End Sub
Private Sub GeheZuToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GeheZuToolStripMenuItem.Click
Dim host As New Host
host.gethost(TxtLinkedWith.Text)
fillform(host)
End Sub
End Class