Initial commit
This commit is contained in:
106
EDOKA_Toolset/Plugin_Dokumentwerte/clsdb.vb
Normal file
106
EDOKA_Toolset/Plugin_Dokumentwerte/clsdb.vb
Normal file
@@ -0,0 +1,106 @@
|
||||
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 dsdatendocm As New DataSet
|
||||
Public dadaten As SqlDataAdapter
|
||||
Public dadatendocm As SqlDataAdapter
|
||||
Dim sql As String
|
||||
|
||||
|
||||
|
||||
Public Function Call_DB(fnkt As Integer, manr As Integer, sourcedokumentid As String, targetdokumentid As String) As String
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
|
||||
Dim conn As New SqlConnection(Globals.sConnectionstring)
|
||||
scmCmdToExecute.CommandText = "dbo.sp_plugin_dokumentwerte_kopieren"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.Connection = conn
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, fnkt))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@manr", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, manr))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@param1", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, sourcedokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@param2", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, targetdokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@result", SqlDbType.VarChar, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, ""))
|
||||
conn.Open()
|
||||
scmCmdToExecute.ExecuteNonQuery()
|
||||
Return scmCmdToExecute.Parameters("@result").Value.ToString
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("sp_plugin_dokumentwerte_kopieren::" & scmCmdToExecute.CommandText + "::" + ex.Message)
|
||||
Return ""
|
||||
Finally
|
||||
conn.Close()
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
dtToReturn.Dispose()
|
||||
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