You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
4.1 KiB
116 lines
4.1 KiB
Imports System.IO
|
|
Imports System.Data.Sql
|
|
Imports System.Data.SqlClient
|
|
|
|
Public Class DB
|
|
|
|
|
|
|
|
Public dsDaten As New DataSet
|
|
Public dsdaten1 As New DataSet
|
|
Public dsdatenblacklist As New DataSet
|
|
Public dadaten As SqlDataAdapter
|
|
Public dadatenblacklist As SqlDataAdapter
|
|
Dim sql As String
|
|
|
|
|
|
|
|
Public Sub Get_Dokumenttypen()
|
|
Try
|
|
dsDaten.Clear()
|
|
sql = "Select dokumenttypnr, bezeichnung from dokumenttyp where aktiv=1 or aktiv = 0 order by bezeichnung"
|
|
dadaten = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
|
dadaten.Fill(dsDaten, "Dokumenttypen")
|
|
Catch
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub Get_Blacklist()
|
|
Try
|
|
dsdatenblacklist.Clear()
|
|
sql = "Select id ,[dokumenttypnr] AS DokTypNr, [Bemerkung] AS Bemerkung,[aktiv] AS Aktiv,[erstellt_am] AS Erstellt_am,[erstellt_von] AS Ersteler,[mutiert_am] AS Mutiert_am,[mutiert_von] AS Mutierer from email_dokumenttyp_blacklist order by dokumenttypnr"
|
|
dadatenblacklist = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
|
dadatenblacklist.Fill(dsdatenblacklist, "Blacklist")
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Public Sub Get_Dokumentstatus_docm(dokumentstatusnr)
|
|
'Try
|
|
' dsdatendocm.Clear()
|
|
' sql = "Select * from dokumentstatus_docm where dokumentstatusnr=" + dokumentstatusnr.ToString + " and aktiv=1"
|
|
' dadatendocm = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
|
' dadatendocm.Fill(dsdatendocm, "DocmDaten")
|
|
'Catch ex As Exception
|
|
' MsgBox(ex.Message)
|
|
'End Try
|
|
End Sub
|
|
|
|
Sub Update_Daten()
|
|
Try
|
|
Dim cb As New SqlCommandBuilder(dadatenblacklist)
|
|
dadatenblacklist.Update(dsdatenblacklist, dsdatenblacklist.Tables(0).TableName)
|
|
'MsgBox("Änderungen wurden gespeichert")
|
|
Catch ex As Exception
|
|
MsgBox("Felher: " + ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
|
|
Public Class DB_Connection
|
|
|
|
''' <summary>
|
|
''' Liest sämtlcihe CFG-Dateien mit dem Namen "Vertragsverwaltung...". Sind meherere Dateien vorhanden,
|
|
''' wird ein Auswahldialog zur Datenbank-Selektion angezeigt.
|
|
''' Standardmässig wird Vertragsverwaltung.cfg als CFG-Datei benutzt.
|
|
'''
|
|
''' Die CFG-Datei ist verschlüsselt und wird über die Crypto-Funktionen entschlüsselt.
|
|
''' </summary>
|
|
''' <remarks></remarks>
|
|
Shared Sub New()
|
|
Dim path As String = ""
|
|
Dim fc As Integer = 0
|
|
If fc < 2 Then Globals.ConnectionFilename = "edokaconn.cfg"
|
|
Dim ofile As System.IO.File
|
|
Dim oread As System.IO.StreamReader
|
|
|
|
oread = ofile.OpenText(ApplicationPath() + "\" + Globals.ConnectionFilename)
|
|
sConnectionstring = oread.ReadLine
|
|
sConnectionstring = Crypto.DecryptText(sConnectionstring, "HutterundMueller")
|
|
sConnectionstring = Left(sConnectionstring, Len(sConnectionstring) - 1)
|
|
Globals.sConnectionstring = sConnectionstring
|
|
oread.Close()
|
|
|
|
Dim connection As New SqlConnection()
|
|
Dim da As New SqlDataAdapter("Select beschreibung from pluginparameter where pluginparamnr=1", connection)
|
|
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
|
Dim ds As New DataSet()
|
|
Try
|
|
connection.ConnectionString = Globals.sConnectionstring
|
|
connection.Open()
|
|
da.Fill(ds, "params")
|
|
path = ds.Tables(0).Rows(0).Item(0)
|
|
Catch ex As Exception
|
|
path = ""
|
|
CB = Nothing
|
|
End Try
|
|
|
|
ds = Nothing
|
|
da = Nothing
|
|
connection.Close()
|
|
connection = Nothing
|
|
|
|
Globals.ConnectionFilename = "edokaconn.cfg"
|
|
oread = ofile.OpenText(path + "\" + Globals.ConnectionFilename)
|
|
sConnectionstring = oread.ReadLine
|
|
sConnectionstring = Crypto.DecryptText(sConnectionstring, "HutterundMueller")
|
|
sConnectionstring = Left(sConnectionstring, Len(sConnectionstring) - 1)
|
|
Globals.sConnectionstring = sConnectionstring
|
|
oread.Close()
|
|
End Sub
|
|
End Class
|
|
|