Initial commit
This commit is contained in:
20
EDOKA_Toolset/Plugin_EDK/Klassen/Class1.vb
Normal file
20
EDOKA_Toolset/Plugin_EDK/Klassen/Class1.vb
Normal file
@@ -0,0 +1,20 @@
|
||||
Imports PluginContracts
|
||||
Public Class Class1
|
||||
Implements PluginContracts.IPlugin
|
||||
|
||||
Public ReadOnly Property Name() As String Implements IPlugin.Name
|
||||
Get
|
||||
Return "EDK_Analyzer"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Function Show(CurrentUser As String, Connectionstring As String, Parentform As Object) As Object Implements IPlugin.Show
|
||||
Globals.Mitarbeiternr = CurrentUser
|
||||
Dim f As New FrmData
|
||||
f.Text = Me.Name
|
||||
f.MdiParent = Parentform
|
||||
f.Show()
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
253
EDOKA_Toolset/Plugin_EDK/Klassen/db.vb
Normal file
253
EDOKA_Toolset/Plugin_EDK/Klassen/db.vb
Normal file
@@ -0,0 +1,253 @@
|
||||
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 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
|
||||
|
||||
Public Function Check_Dok(ByVal Dokumentid As String) As Boolean
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "sp_plugin_berechtigung_checkdok"
|
||||
selectcommand.Parameters.Add("@Dokumentid", SqlDbType.VarChar, 255)
|
||||
|
||||
selectcommand.Parameters(0).Value = Dokumentid
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
da.SelectCommand = selectcommand
|
||||
|
||||
da.Fill(ds)
|
||||
If ds.Tables(0).Rows(0).Item(0) = "NOK" Then
|
||||
Return False
|
||||
Else
|
||||
subject = ds.Tables(0).Rows(0).Item("subject")
|
||||
body = ds.Tables(0).Rows(0).Item("Body")
|
||||
Return True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Public Sub Insert_Row(ByVal Dokumentid As String, Mitarbeiternr As String, bemerkung As String, usernr As Integer)
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "sp_plugin_berechtigung_insertrow"
|
||||
selectcommand.Parameters.Add("@Dokumentid", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@mitarbeiternr", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@bemerkung", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@usernr", SqlDbType.VarChar, 255)
|
||||
|
||||
selectcommand.Parameters(0).Value = Dokumentid
|
||||
selectcommand.Parameters(1).Value = Mitarbeiternr
|
||||
selectcommand.Parameters(2).Value = bemerkung
|
||||
selectcommand.Parameters(3).Value = usernr
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
selectcommand.ExecuteNonQuery()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub sendmail(ByVal empfaenger As String, subject As String, body As String)
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "sp_plugin_berechtigung_sendmail"
|
||||
selectcommand.Parameters.Add("@empfaenger", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@subject", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@body", SqlDbType.VarChar, 255)
|
||||
|
||||
selectcommand.Parameters(0).Value = empfaenger
|
||||
selectcommand.Parameters(1).Value = subject
|
||||
selectcommand.Parameters(2).Value = body
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
selectcommand.ExecuteNonQuery()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub deleteentry(ByVal mutierer As String, eintrag As String)
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "sp_plugin_berechtigung_deleteentry"
|
||||
selectcommand.Parameters.Add("@mutierer", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@eintrag", SqlDbType.VarChar, 255)
|
||||
|
||||
selectcommand.Parameters(0).Value = mutierer
|
||||
selectcommand.Parameters(1).Value = eintrag
|
||||
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionstring
|
||||
connection.Open()
|
||||
selectcommand.ExecuteNonQuery()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub Get_MA_Daten()
|
||||
dsdatenma.Clear()
|
||||
sql = "Select mitarbeiternr, name+' '+vorname+', '+tgnummer as Mitarbeiter from Mitarbeiter where klassifizierung=1 and aktiv=1 order by name, vorname"
|
||||
dadatenma = New SqlDataAdapter(sql, Globals.sConnectionstring)
|
||||
dadatenma.Fill(dsdatenma, "MaData")
|
||||
|
||||
End Sub
|
||||
Public Sub Get_data(ByVal sql As String)
|
||||
Try
|
||||
dsDaten.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, "Einträge")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
connection.Close()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Sub Update_Daten()
|
||||
Try
|
||||
Dim cb As New SqlCommandBuilder(dadaten)
|
||||
dadaten.Update(dsDaten, dsDaten.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>
|
||||
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