Initial commit
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
Imports System.IO
|
||||
Imports System.Data.Sql
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Public Class clsdb
|
||||
|
||||
Public dsDaten As New DataSet
|
||||
Public dsdaten1 As New DataSet
|
||||
Public dsdatenma As New DataSet
|
||||
Public dadaten As SqlDataAdapter
|
||||
Public dadatenma As SqlDataAdapter
|
||||
Public dadaten1 As SqlDataAdapter
|
||||
Dim sql As String
|
||||
Public subject As String
|
||||
Public body As String
|
||||
|
||||
Sub New()
|
||||
Dim x As New DB_Connection
|
||||
End Sub
|
||||
Public Function Get_Dokumenttypen()
|
||||
Try
|
||||
dsDaten.Clear()
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
selectcommand.CommandText = "Select dokumenttypnr, str(dokumenttypnr)+' '+bezeichnung from dokumenttyp where aktiv=1 order by dokumenttypnr"
|
||||
|
||||
|
||||
selectcommand.CommandType = CommandType.Text
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
dadaten = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
||||
dadaten.SelectCommand = selectcommand
|
||||
dadaten.Fill(dsDaten, "Dokumenttypen")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Public Function Get_Tabledata(ByVal sql As String, ByVal tablename As String)
|
||||
Try
|
||||
dsDaten.Tables.Clear()
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
selectcommand.CommandText = sql
|
||||
|
||||
|
||||
selectcommand.CommandType = CommandType.Text
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
dadaten = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
||||
dadaten.SelectCommand = selectcommand
|
||||
dadaten.Fill(dsDaten, tablename)
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CheckDokType(ByVal Dokumenttpynr As Integer) As String
|
||||
Try
|
||||
dsDaten.Clear()
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
selectcommand.CommandText = "Select dokumenttypnr, bezeichnung from dokumenttyp where aktiv=1 and dokumenttypnr=" + Dokumenttpynr.ToString
|
||||
selectcommand.CommandType = CommandType.Text
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
dadaten = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
||||
dadaten.SelectCommand = selectcommand
|
||||
dadaten.Fill(dsDaten, "Dokumenttypen")
|
||||
If dsDaten.Tables(0).Rows.Count > 0 Then Return dsDaten.Tables(0).Rows(0).Item(0).ToString + " " + dsDaten.Tables(0).Rows(0).Item(1) Else Return ""
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ChceckDokType(ByVal Dokumentypbezeichnung As String) As String
|
||||
Try
|
||||
dsDaten.Clear()
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
selectcommand.CommandText = "Select dokumenttypnr, bezeichnung from dokumenttyp where aktiv=1 and bezeichnung='" + Dokumentypbezeichnung + "'"
|
||||
selectcommand.CommandType = CommandType.Text
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
dadaten = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
||||
dadaten.SelectCommand = selectcommand
|
||||
dadaten.Fill(dsDaten, "Dokumenttypen")
|
||||
If dsDaten.Tables(0).Rows.Count > 0 Then Return dsDaten.Tables(0).Rows(0).Item(0).ToString + " " + dsDaten.Tables(0).Rows(0).Item(1) Else Return ""
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
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>
|
||||
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
|
||||
Reference in New Issue
Block a user