project name record_organizer
This commit is contained in:
138
app/DD-Record-Organiser/frmConfig_Basic.vb
Normal file
138
app/DD-Record-Organiser/frmConfig_Basic.vb
Normal file
@@ -0,0 +1,138 @@
|
||||
Public Class frmConfig_Basic
|
||||
|
||||
Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles BtnConnect.Click
|
||||
Try
|
||||
Dim con As String
|
||||
If chkbxUserAut.Checked Then
|
||||
con = "Data Source=" & Me.txtServer.Text & ";Initial Catalog=" & Me.cmbDatenbank.Text & ";Trusted_Connection=True;"
|
||||
Else
|
||||
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
|
||||
End If
|
||||
|
||||
|
||||
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
|
||||
'während Verbindungsaufbau Sanduhr-Mauszeiger
|
||||
Cursor = Cursors.WaitCursor
|
||||
connection.Open()
|
||||
Cursor = Cursors.Default
|
||||
'DialogResult = Windows.Forms.DialogResult.OK
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show("Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?", "Erfolgsmeldung:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.Yes Then
|
||||
'Set the construction string
|
||||
MyConnectionString = con 'csb.ConnectionString
|
||||
My.Settings.Save()
|
||||
If chkbxUserAut.Checked = False Then
|
||||
Dim wrapper As New ClassEncryption("!35452didalog=")
|
||||
Dim cipherText As String = wrapper.EncryptData(Me.txtPasswort.Text)
|
||||
Dim pw As String = cipherText
|
||||
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & pw & ";"
|
||||
End If
|
||||
SaveMySettingsValue("MyConnectionString", con)
|
||||
Dim csb As New SqlClient.SqlConnectionStringBuilder
|
||||
csb.ConnectionString = MyConnectionString
|
||||
Dim constr = connection.ConnectionString
|
||||
constr = constr.Replace(csb.Password, "XXXXX")
|
||||
Me.txtActualConnection.Text = constr
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Cursor = Cursors.Default
|
||||
MsgBox("Fehler beim Verbindungsaufbau: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub cmbDatenbank_MouseClick(sender As Object, e As MouseEventArgs) Handles cmbDatenbank.MouseClick
|
||||
Try
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Dim csb As New SqlClient.SqlConnectionStringBuilder
|
||||
csb.DataSource = Me.txtServer.Text
|
||||
csb.IntegratedSecurity = False
|
||||
csb.UserID = Me.txtUser.Text
|
||||
csb.Password = Me.txtPasswort.Text
|
||||
|
||||
Dim con As String
|
||||
If chkbxUserAut.Checked Then
|
||||
con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;"
|
||||
Else
|
||||
con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
|
||||
End If
|
||||
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
|
||||
connection.Open()
|
||||
Dim cmd As New SqlClient.SqlCommand("sp_databases", connection)
|
||||
cmd.CommandType = CommandType.StoredProcedure
|
||||
' Ausführen und Ergebnis in einer ListBox anzeigen
|
||||
Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader
|
||||
If dr.HasRows Then
|
||||
Do While dr.Read
|
||||
cmbDatenbank.Items.Add(dr("Database_Name"))
|
||||
Loop
|
||||
cmbDatenbank.DroppedDown = True
|
||||
Else
|
||||
MsgBox("The standard-databases could not be retrieved. Check rights in sql-server for user: " & Me.txtUser.Text, MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
connection.Close()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Datenbank-Connect:")
|
||||
End Try
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub frmConfig_Basic_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
SaveMySettingsValue("WDResultListCount", txtwdSearch_Count.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub frmConfig_Basic_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
If Not MyConnectionString = String.Empty Then
|
||||
Dim csb As New SqlClient.SqlConnectionStringBuilder
|
||||
csb.ConnectionString = MyConnectionString
|
||||
|
||||
Dim constr = MyConnectionString
|
||||
constr = constr.Replace(csb.Password, "XXXXX")
|
||||
Me.txtActualConnection.Text = constr
|
||||
chkbxloadWDDocs.Checked = Sett_LoadWD_Docs
|
||||
chkLogErrorsOnly.Checked = LogErrorsOnly
|
||||
txtwdSearch_Count.Text = WDResultListCount
|
||||
chkboxQuickMenue.Checked = Sett_ShowQuickMenue
|
||||
CheckBoxWD_ShowEnitityDocs.Checked = WD_ShowEnitityDocs
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub chkbxloadWDDocs_CheckedChanged(sender As Object, e As EventArgs) Handles chkbxloadWDDocs.CheckedChanged
|
||||
Sett_LoadWD_Docs = chkbxloadWDDocs.Checked
|
||||
SaveMySettingsValue("Sett_LoadWD_Docs", Sett_LoadWD_Docs)
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
|
||||
' Specify that the link was visited.
|
||||
Me.LinkLabel1.LinkVisited = True
|
||||
' Navigate to a URL.
|
||||
System.Diagnostics.Process.Start("http://www.didalog.de/Support")
|
||||
End Sub
|
||||
|
||||
Private Sub btnApplicationFolder_Click(sender As Object, e As EventArgs) Handles btnApplicationFolder.Click
|
||||
Process.Start(Application.UserAppDataPath())
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Process.Start(ClassLogger.DateiSpeicherort)
|
||||
End Sub
|
||||
|
||||
Private Sub chkLogErrorsOnly_CheckedChanged(sender As Object, e As EventArgs) Handles chkLogErrorsOnly.CheckedChanged
|
||||
LogErrorsOnly = chkLogErrorsOnly.Checked
|
||||
SaveMySettingsValue("LogErrorsOnly", LogErrorsOnly)
|
||||
End Sub
|
||||
|
||||
Private Sub chkboxQuickMenue_CheckedChanged(sender As Object, e As EventArgs) Handles chkboxQuickMenue.CheckedChanged
|
||||
Sett_ShowQuickMenue = chkboxQuickMenue.Checked
|
||||
SaveMySettingsValue("Sett_ShowQuickMenue", Sett_ShowQuickMenue)
|
||||
End Sub
|
||||
|
||||
Private Sub CheckBoxWD_ShowEnitityDocs_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxWD_ShowEnitityDocs.CheckedChanged
|
||||
WD_ShowEnitityDocs = CheckBoxWD_ShowEnitityDocs.Checked
|
||||
SaveMySettingsValue("WD_ShowEnitityDocs", WD_ShowEnitityDocs)
|
||||
End Sub
|
||||
|
||||
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
|
||||
My.Settings.Save()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user