This commit is contained in:
2018-11-23 11:36:38 +01:00
4 changed files with 58 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -131,7 +131,7 @@
<value>..\Resources\Link.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>0.0.1.20</value>
<value>0.0.1.22</value>
</data>
<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>