diff --git a/Dokumentation/Classes/Class1.vb b/Dokumentation/Classes/Class1.vb index e2f2d3c..19a3931 100644 --- a/Dokumentation/Classes/Class1.vb +++ b/Dokumentation/Classes/Class1.vb @@ -619,4 +619,50 @@ Public Class Class1 con.Close() End Function + Public Shared Function GetUserPasswort(ip As String, ByRef User As String, ByRef Password As String) + Dim tmp As New AutoCompleteStringCollection() + Dim con As New SqlConnection + Dim cmd As New SqlCommand + Dim reader As SqlDataReader + con.ConnectionString = Class1.DBConString + cmd.Connection = con + + con.Open() + cmd.CommandText = "SELECT Benutzer, Passwort FROM TbL_Netzwerkclients WHERE IPAdresse = '" & ip & "' " + reader = cmd.ExecuteReader() + Do While reader.Read + User = ReadNullAsEmptyString(reader, "Benutzer") + Password = ReadNullAsEmptyString(reader, "Passwort") + Loop + con.Close() + + + End Function + + Public Shared Function MainHost(ip As String) + Dim tmp As New AutoCompleteStringCollection() + Dim con As New SqlConnection + Dim cmd As New SqlCommand + Dim reader As SqlDataReader + con.ConnectionString = Class1.DBConString + cmd.Connection = con + + Dim LinkedWith As String + + con.Open() + cmd.CommandText = "SELECT LinkedWith FROM TbL_Netzwerkclients WHERE IPAdresse = '" & ip & "' " + reader = cmd.ExecuteReader() + Do While reader.Read + LinkedWith = ReadNullAsEmptyString(reader, "LinkedWith") + Loop + con.Close() + + If LinkedWith = "" Then + Return ip + Else + Return LinkedWith + End If + + End Function + End Class diff --git a/Dokumentation/Dokumentation.vbproj b/Dokumentation/Dokumentation.vbproj index adbbc24..8f3ce32 100644 --- a/Dokumentation/Dokumentation.vbproj +++ b/Dokumentation/Dokumentation.vbproj @@ -78,7 +78,7 @@ false - true + false My Project\app.manifest diff --git a/Dokumentation/Main.vb b/Dokumentation/Main.vb index 7b9cba9..6d6dae8 100644 --- a/Dokumentation/Main.vb +++ b/Dokumentation/Main.vb @@ -36,8 +36,8 @@ Public Class Main Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.KeyPreview = True - - If sAppPath = "C:\Users\miesenbeck\Documents\Visual Studio 2017\Sebastian Spielwiese\Dokumentation\Dokumentation\bin\Debug" Or sAppPath = "C:\Users\miesenbeck\source\repos\Doku\Dokumentation\bin\Debug" Then + 'MsgBox(sAppPath) + If sAppPath Like "*\bin\Debug" Then Debug = True LblDEBUGMODE.Visible = True LblDEBUGMODE.ForeColor = Color.Red @@ -49,11 +49,11 @@ Public Class Main Class1.FilePath = "\\192.168.0.90\f\EDV-Wartung\Dokumentation" End If - If Class1.DBConString = "Server=NBMIESENBECK\SPIELWIESE;Initial Catalog=Doku;User ID=sa;Password=verag#3;Connection Timeout=5;" Then + If Class1.DBConString = "Server=DEVELOPER\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;" Then TimerUpdate.Enabled = False dbload() LstStandortLoad() - LblVersion.Text = "TESTDATENBANK" + LblVersion.Text = "Version: " & Version LblVersion.ForeColor = Color.Red LblUhrzeit.ForeColor = Color.Red @@ -762,18 +762,21 @@ Public Class Main End Function Public Function startputty() + Dim MainIP As String = Class1.MainHost(DgVMain.CurrentRow.Cells("IPAdresse").Value) + Dim Benutzer, Passwort As String + Class1.GetUserPasswort(MainIP, Benutzer, Passwort) Try Dim putty As New Process putty.StartInfo.FileName = "putty.exe" - If DgVMain.CurrentRow.Cells("Benutzer").Value = "" And DgVMain.CurrentRow.Cells("Passwort").Value = "" Then + If Benutzer = "" And Passwort = "" Then putty.StartInfo.Arguments = DgVMain.CurrentRow.Cells("IPAdresse").Value Else - putty.StartInfo.Arguments = DgVMain.CurrentRow.Cells("IPAdresse").Value & " -l " & DgVMain.CurrentRow.Cells("Benutzer").Value & " -pw " & DgVMain.CurrentRow.Cells("Passwort").Value + putty.StartInfo.Arguments = DgVMain.CurrentRow.Cells("IPAdresse").Value & " -l " & Benutzer & " -pw " & Passwort End If putty.Start() Catch ex As Exception - 'MsgBox(ex.Message) + MsgBox(ex.Message) End Try End Function diff --git a/Dokumentation/My Project/Resources.Designer.vb b/Dokumentation/My Project/Resources.Designer.vb index d451ec6..efe859d 100644 --- a/Dokumentation/My Project/Resources.Designer.vb +++ b/Dokumentation/My Project/Resources.Designer.vb @@ -139,7 +139,7 @@ Namespace My.Resources End Property ''' - ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.20 ähnelt. + ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.22 ähnelt. ''' Friend ReadOnly Property Version() As String Get diff --git a/Dokumentation/My Project/Resources.resx b/Dokumentation/My Project/Resources.resx index 004f432..1722b7d 100644 --- a/Dokumentation/My Project/Resources.resx +++ b/Dokumentation/My Project/Resources.resx @@ -131,7 +131,7 @@ ..\Resources\Link.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - 0.0.1.20 + 0.0.1.22 ..\Resources\Link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a