Initial commit
This commit is contained in:
34
EDOKA_Toolset/Plugin_FiVo/Utils/Crypto.vb
Normal file
34
EDOKA_Toolset/Plugin_FiVo/Utils/Crypto.vb
Normal file
@@ -0,0 +1,34 @@
|
||||
Module Crypto
|
||||
Public Function EncryptText(ByVal strText As String, ByVal strPwd As String)
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String
|
||||
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
EncryptText = strBuff
|
||||
End Function
|
||||
|
||||
Public Function DecryptText(ByVal strText As String, ByVal strPwd As String)
|
||||
Dim i As Integer, c As Integer
|
||||
Dim strBuff As String
|
||||
strPwd = UCase$(strPwd)
|
||||
If Len(strPwd) Then
|
||||
For i = 1 To Len(strText)
|
||||
c = Asc(Mid$(strText, i, 1))
|
||||
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
|
||||
strBuff = strBuff & Chr(c And &HFF)
|
||||
Next i
|
||||
Else
|
||||
strBuff = strText
|
||||
End If
|
||||
DecryptText = strBuff
|
||||
End Function
|
||||
End Module
|
||||
100
EDOKA_Toolset/Plugin_FiVo/Utils/DivFnkt.vb
Normal file
100
EDOKA_Toolset/Plugin_FiVo/Utils/DivFnkt.vb
Normal file
@@ -0,0 +1,100 @@
|
||||
Imports UtilityLibrary
|
||||
Imports System.IO
|
||||
Imports C1.Win.C1TrueDBGrid
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.ComponentModel
|
||||
Imports UtilityLibrary.Win32
|
||||
Imports System.Text
|
||||
Imports System.Xml
|
||||
Imports System.Threading
|
||||
|
||||
Namespace EDOKA
|
||||
|
||||
Public Class clsDivFnkt
|
||||
|
||||
Public Function Get_Filename(ByVal fi As String, ByVal partnernr As String) As String
|
||||
Dim s As String
|
||||
Get_Filename = ""
|
||||
s = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("logisches_Laufwerk") & Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_dokumente") + "\"
|
||||
Get_Filename = s + fi
|
||||
End Function
|
||||
|
||||
Public Function ExtractFilename(ByVal x As String) As String
|
||||
Dim splitter
|
||||
Dim i As Integer
|
||||
Dim Y As String
|
||||
splitter = Microsoft.VisualBasic.Split(x, "\")
|
||||
On Error Resume Next
|
||||
Err.Clear()
|
||||
i = -1
|
||||
While Err.Number = 0
|
||||
i = i + 1
|
||||
Y = splitter(i)
|
||||
End While
|
||||
ExtractFilename = Y
|
||||
End Function
|
||||
|
||||
Public Function XML_Param(ByVal Type As String) As String
|
||||
Dim xmldoc As New XmlDocument
|
||||
xmldoc.Load(Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "Office_2010.xml")
|
||||
Select Case UCase(Type)
|
||||
Case "WORD_1"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Word_1").InnerText
|
||||
Case "WORD_2"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Word_2").InnerText
|
||||
Case "WORD_3"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Word_3").InnerText
|
||||
Case "WORD_4"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Word_4").InnerText
|
||||
Case "EXCEL_1"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Excel_1").InnerText
|
||||
Case "EXCEL_2"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Excel_2").InnerText
|
||||
Case "EXCEL_3"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Excel_3").InnerText
|
||||
Case "EXCEL_4"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/Excel_4").InnerText
|
||||
Case "TKBMAKROLIB"
|
||||
Return xmldoc.SelectSingleNode("/Configuration/TKBMakroLib").InnerText
|
||||
Case Else
|
||||
Return ""
|
||||
End Select
|
||||
xmldoc = Nothing
|
||||
End Function
|
||||
|
||||
Public Sub show_office(ByVal dokumentid As String, ByVal formx As System.Windows.Forms.Form)
|
||||
Dim doc As New edokadb.clsDokument()
|
||||
Dim Dokument As String
|
||||
Dim FileReader As New DocMgmt()
|
||||
doc.cpMainConnectionProvider = conn
|
||||
doc.sDokumentid = New SqlString(CType(dokumentid, String))
|
||||
doc.SelectOne()
|
||||
Try
|
||||
Dokument = DivFnkt.Get_Filename("View_" + Format(Now, "yyyyMMddHHmmss") + "_" + doc.sDokumentname.Value, "")
|
||||
' Dokument = DivFnkt.Get_Filename(doc.sDokumentname.Value, "")
|
||||
If FileReader.Get_From_DB(doc.sDokumentid.Value, Dokument) = False Then
|
||||
doc.Dispose()
|
||||
FileReader = Nothing
|
||||
Exit Sub
|
||||
End If
|
||||
doc.Dispose()
|
||||
FileReader = Nothing
|
||||
|
||||
'Office_2010
|
||||
Process.Start(Dokument)
|
||||
Exit Sub
|
||||
Exit Sub
|
||||
Catch
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
End Namespace
|
||||
|
||||
650
EDOKA_Toolset/Plugin_FiVo/Utils/DocMgmt.vb
Normal file
650
EDOKA_Toolset/Plugin_FiVo/Utils/DocMgmt.vb
Normal file
@@ -0,0 +1,650 @@
|
||||
'DocMgmt Klasse
|
||||
'Autor: Stefan Hutter, Unternehmensberatung
|
||||
'
|
||||
'01.04.2003
|
||||
'
|
||||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.ComponentModel
|
||||
Imports UtilityLibrary.Win32
|
||||
|
||||
Public Class DocMgmt
|
||||
|
||||
#Region "Deklarationen"
|
||||
Dim m_dokumentname As String
|
||||
Dim m_dokumentid As String
|
||||
|
||||
Property Dokumentname() As String
|
||||
Get
|
||||
Return m_dokumentname
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_dokumentname = Value
|
||||
End Set
|
||||
End Property
|
||||
Property DokumentID() As String
|
||||
Get
|
||||
Return m_dokumentid
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_dokumentid = Value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
#Region "Save"
|
||||
Public Function Save_To_DB(ByVal sDokumentID As String, ByVal sDokumentName As String) As Boolean
|
||||
Try
|
||||
Me.DokumentID = sDokumentID
|
||||
Me.Dokumentname = sDokumentName
|
||||
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from doks where dokumentid='" + Me.DokumentID + "'", Connection)
|
||||
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim fs As New FileStream(Me.Dokumentname, FileMode.Open, FileAccess.Read)
|
||||
Dim mydata(fs.Length) As Byte
|
||||
Try
|
||||
fs.Read(mydata, 0, fs.Length)
|
||||
fs.Close()
|
||||
Connection.ConnectionString = Globals.sConnectionString
|
||||
Connection.Open()
|
||||
DA.Fill(ds, "docs")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Dokument speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = Me.DokumentID
|
||||
myRow.Item(1) = mydata
|
||||
'Release Office 2010
|
||||
'Try
|
||||
' Dim fi As New FileInfo(Me.Dokumentname)
|
||||
' myRow.Item(2) = fi.Extension
|
||||
' fi = Nothing
|
||||
'Catch ex As Exception
|
||||
|
||||
'End Try
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "docs")
|
||||
|
||||
Else
|
||||
'Bestehendes Dokument sichenr
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(1) = mydata
|
||||
'Try
|
||||
' Dim fi As New FileInfo(Me.Dokumentname)
|
||||
' myRow.Item(2) = fi.Extension
|
||||
' fi = Nothing
|
||||
'Catch ex As Exception
|
||||
|
||||
'End Try
|
||||
|
||||
DA.Update(ds, "docs")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
Return False
|
||||
End Try
|
||||
fs = Nothing
|
||||
cb = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
|
||||
Connection.Close()
|
||||
Connection = Nothing
|
||||
Return True
|
||||
Catch EX As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Save_Layout_DB(ByVal profilnr As Integer, ByVal sDokumentName As String) As Boolean
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from profillayout where profilnr=" + Str(profilnr), Connection)
|
||||
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim fs As New FileStream(sDokumentName, FileMode.OpenOrCreate, FileAccess.Read)
|
||||
Dim mydata(fs.Length) As Byte
|
||||
fs.Read(mydata, 0, fs.Length)
|
||||
fs.Close()
|
||||
Try
|
||||
Connection.ConnectionString = Globals.sConnectionString
|
||||
Connection.Open()
|
||||
DA.Fill(ds, "profil")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Dokument speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = profilnr
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sDokumentName, 5))
|
||||
Case "T.LYT"
|
||||
myRow.Item(2) = mydata
|
||||
Case "M.LYT"
|
||||
myRow.Item(3) = mydata
|
||||
Case "V.LYT"
|
||||
myRow.Item(4) = mydata
|
||||
Case Else
|
||||
myRow.Item(1) = mydata
|
||||
End Select
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "profil")
|
||||
Else
|
||||
'Bestehendes Dokument sichern
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sDokumentName, 5))
|
||||
Case "T.LYT"
|
||||
myRow.Item(2) = mydata
|
||||
Case "M.LYT"
|
||||
myRow.Item(3) = mydata
|
||||
Case "V.LYT"
|
||||
myRow.Item(4) = mydata
|
||||
Case Else
|
||||
myRow.Item(1) = mydata
|
||||
End Select
|
||||
DA.Update(ds, "profil")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
fs = Nothing
|
||||
cb = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
|
||||
Connection.Close()
|
||||
Connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Save_SuchLayout_DB(ByVal profilnr As Integer, ByVal sDokumentName As String) As Boolean
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from suchprofillayout where suchprofilnr=" + Str(profilnr), Connection)
|
||||
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim fs As New FileStream(sDokumentName, FileMode.OpenOrCreate, FileAccess.Read)
|
||||
Dim mydata(fs.Length) As Byte
|
||||
fs.Read(mydata, 0, fs.Length)
|
||||
fs.Close()
|
||||
Try
|
||||
Connection.ConnectionString = Globals.sConnectionString
|
||||
Connection.Open()
|
||||
DA.Fill(ds, "profil")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Dokument speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = profilnr
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sDokumentName, 6))
|
||||
Case "TS.LYT"
|
||||
myRow.Item(2) = mydata
|
||||
Case "MS.LYT"
|
||||
myRow.Item(3) = mydata
|
||||
Case "VS.LYT"
|
||||
myRow.Item(4) = mydata
|
||||
Case Else
|
||||
myRow.Item(1) = mydata
|
||||
End Select
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "profil")
|
||||
Else
|
||||
'Bestehendes Dokument sichern
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sDokumentName, 6))
|
||||
Case "TS.LYT"
|
||||
myRow.Item(2) = mydata
|
||||
Case "MS.LYT"
|
||||
myRow.Item(3) = mydata
|
||||
Case "VS.LYT"
|
||||
myRow.Item(4) = mydata
|
||||
Case Else
|
||||
myRow.Item(1) = mydata
|
||||
End Select
|
||||
DA.Update(ds, "profil")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
fs = Nothing
|
||||
cb = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
|
||||
Connection.Close()
|
||||
Connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Get"
|
||||
Public Function Get_From_DB(ByVal sDokumentID As String, ByVal sDokumentName As String, Optional ByRef DokType As String = "") As Boolean
|
||||
Me.DokumentID = sDokumentID
|
||||
Me.Dokumentname = sDokumentName
|
||||
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From doks where DokumentID='" + Me.DokumentID + "'", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
|
||||
Try
|
||||
'Connectionstring zur Datenbank
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "docs")
|
||||
|
||||
'Versuchen, ob es sich um ein EDKIMP-Dokument handelt - Rel. 3.73 SHU
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
da.SelectCommand.CommandText = "Select * from doks where dokumentid='" + "EDKIMP" + Microsoft.VisualBasic.Right(Me.DokumentID, Len(Me.DokumentID) - 6) + "'"
|
||||
da.Fill(ds, "Docs")
|
||||
End If
|
||||
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
MyData = myRow.Item(1)
|
||||
'If myRow.Item(2).ToString = "" Then DokType = ".doc" Else DokType = myRow.Item(2)
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(sDokumentName, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Get_layout_from_DB(ByVal profilnr As Integer, ByVal sdokumentname As String) As String
|
||||
Me.Dokumentname = LTrim(Str(profilnr)) + ".lyt"
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From profillayout where profilnr=" + Str(profilnr), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "docs")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sdokumentname, 5))
|
||||
Case "T.LYT"
|
||||
MyData = myRow.Item(2)
|
||||
Case "M.LYT"
|
||||
MyData = myRow.Item(3)
|
||||
Case "V.LYT"
|
||||
MyData = myRow.Item(4)
|
||||
Case Else
|
||||
MyData = myRow.Item(1)
|
||||
End Select
|
||||
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(sdokumentname, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Get_suchlayout_from_DB(ByVal profilnr As Integer, ByVal sdokumentname As String) As String
|
||||
Me.Dokumentname = LTrim(Str(profilnr)) + ".lyt"
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From suchprofillayout where suchprofilnr=" + Str(profilnr), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "docs")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
'***********************************
|
||||
'Je nach Layoutfile, Daten aus entsprechendem Feld lesen
|
||||
'29.7.2004 / SHU
|
||||
'***********************************
|
||||
Select Case UCase(Right(sdokumentname, 6))
|
||||
Case "TS.LYT"
|
||||
MyData = myRow.Item(2)
|
||||
Case "MS.LYT"
|
||||
MyData = myRow.Item(3)
|
||||
Case "VS.LYT"
|
||||
MyData = myRow.Item(4)
|
||||
Case Else
|
||||
MyData = myRow.Item(1)
|
||||
End Select
|
||||
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(sdokumentname, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CheckDoc"
|
||||
Public Function check_doc(ByVal fnkt As Integer) As DataTable
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.sp_check_dok"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.MitarbeiterNr))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, fnkt))
|
||||
' scmCmdToExecute.Parameters.Add(New SqlParameter("@stationsname", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Environ("Computername")))
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Check_Doc::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Office 2010"
|
||||
Public Function get_office_2010_XML_File(ByVal sdokumentname As String)
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From Office_2010_Params where nreintrag=1", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "docs")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
MyData = myRow.Item(2)
|
||||
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(sdokumentname, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "AVQ_Werte"
|
||||
Public Function save_avq_werte_to_db(ByVal filename As String, dpinszanz As Integer)
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from edex_dpinstanz_avqwerte where edex_dp_instanznr=" + Str(dpinszanz), Connection)
|
||||
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim fs As New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Read)
|
||||
Dim mydata(fs.Length) As Byte
|
||||
fs.Read(mydata, 0, fs.Length)
|
||||
fs.Close()
|
||||
Try
|
||||
Connection.ConnectionString = Globals.sConnectionString
|
||||
Connection.Open()
|
||||
DA.Fill(ds, "profil")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = dpinszanz
|
||||
myRow.Item(1) = mydata
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "profil")
|
||||
Else
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(1) = mydata
|
||||
DA.Update(ds, "profil")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
fs = Nothing
|
||||
cb = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
|
||||
Connection.Close()
|
||||
Connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function Get_avq_werte_from_db(ByVal filename As String, ByVal dpinstanz As Integer) As Boolean
|
||||
Dim connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from edex_dpinstanz_avqwerte where edex_dp_instanznr=" + Str(dpinstanz), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
DA.Fill(ds, "docs")
|
||||
If ds.Tables(0).Rows.Count < 1 Then Return False
|
||||
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
MyData = myRow.Item(1)
|
||||
'If myRow.Item(2).ToString = "" Then DokType = ".doc" Else DokType = myRow.Item(2)
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "PDFCheck"
|
||||
Dim tmpkey As String = ""
|
||||
Public Function Check_PDF(filename As String) As Boolean
|
||||
If Save_PDF_To_DB(filename) = False Then
|
||||
Return False
|
||||
End If
|
||||
If Get_PDF_From_DB() = False Then
|
||||
Return False
|
||||
End If
|
||||
Dim i As Integer
|
||||
|
||||
Dim fn As String = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + tmpkey + ".pdf"
|
||||
Dim info As New System.IO.FileInfo(fn)
|
||||
i = info.Length
|
||||
Try
|
||||
File.Delete(fn)
|
||||
Delete_PDF_From_DB()
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
If i < 1 Then Return False
|
||||
Return True
|
||||
|
||||
End Function
|
||||
Public Function Save_PDF_To_DB(ByVal sDokumentName As String) As Boolean
|
||||
Try
|
||||
Me.Dokumentname = sDokumentName
|
||||
tmpkey = Guid.NewGuid.ToString
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select top 1 * from tmpdok where tmpkey='" + tmpkey + "'", Connection)
|
||||
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim fs As New FileStream(Me.Dokumentname, FileMode.Open, FileAccess.Read)
|
||||
Dim mydata(fs.Length) As Byte
|
||||
Try
|
||||
fs.Read(mydata, 0, fs.Length)
|
||||
fs.Close()
|
||||
Connection.ConnectionString = Globals.sConnectionString
|
||||
Connection.Open()
|
||||
DA.Fill(ds, "tmpdocs")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Dokument speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = tmpkey
|
||||
myRow.Item(1) = mydata
|
||||
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "tmpdocs")
|
||||
Else
|
||||
'Bestehendes Dokument sichenr
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(1) = mydata
|
||||
'Try
|
||||
' Dim fi As New FileInfo(Me.Dokumentname)
|
||||
' myRow.Item(2) = fi.Extension
|
||||
' fi = Nothing
|
||||
'Catch ex As Exception
|
||||
|
||||
'End Try
|
||||
|
||||
DA.Update(ds, "tmpdocs")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
fs = Nothing
|
||||
cb = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
|
||||
Connection.Close()
|
||||
Connection = Nothing
|
||||
Return True
|
||||
Catch EX As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Function Get_PDF_From_DB() As Boolean
|
||||
|
||||
Dim connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select top 1 * from tmpdok where tmpkey='" + tmpkey + "'", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim filename As String = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + tmpkey + ".pdf"
|
||||
Try
|
||||
'Connectionstring zur Datenbank
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
DA.Fill(ds, "tmpdocs")
|
||||
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
MyData = myRow.Item(1)
|
||||
'If myRow.Item(2).ToString = "" Then DokType = ".doc" Else DokType = myRow.Item(2)
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Dim fs As New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Catch ex As Exception
|
||||
|
||||
Return False
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
Public Function Delete_PDF_From_DB()
|
||||
Dim connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("delete from tmpdok where tmpkey='" + tmpkey + "'", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
DA.Fill(ds, "tmpdocs")
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
23
EDOKA_Toolset/Plugin_FiVo/Utils/Globals.vb
Normal file
23
EDOKA_Toolset/Plugin_FiVo/Utils/Globals.vb
Normal file
@@ -0,0 +1,23 @@
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
|
||||
Module Globals
|
||||
Public ConnectionFilename As String
|
||||
Public sConnectionstring As String
|
||||
Public Mitarbeiternr As Integer
|
||||
Public Applikationsdaten As New DataTable
|
||||
Public AppldataRow As Integer
|
||||
Public Words As New Collection()
|
||||
Public Apphandle As Int32
|
||||
Public conn As New edokadb.clsConnectionProvider()
|
||||
Public DivFnkt As New EDOKA.clsDivFnkt()
|
||||
|
||||
|
||||
|
||||
|
||||
Public Function ApplicationPath() As String
|
||||
Return Path.GetDirectoryName([Assembly].GetEntryAssembly().Location) + "\"
|
||||
End Function
|
||||
|
||||
|
||||
End Module
|
||||
510
EDOKA_Toolset/Plugin_FiVo/Utils/Statushandling.vb
Normal file
510
EDOKA_Toolset/Plugin_FiVo/Utils/Statushandling.vb
Normal file
@@ -0,0 +1,510 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.ComponentModel
|
||||
Imports UtilityLibrary.Win32
|
||||
|
||||
Public Class Statushandling
|
||||
|
||||
#Region "Deklarationen"
|
||||
|
||||
Dim m_aktuellerstatus As Integer
|
||||
Dim m_neuerstatus As Integer
|
||||
Dim m_abgeschlossen As Boolean
|
||||
Dim m_ausgangsarchivierung As Boolean
|
||||
Dim m_eingangsarchivierung As Boolean
|
||||
Dim m_folgestatus As Boolean
|
||||
Dim m_dokumentid As String
|
||||
|
||||
Dim m_bemerkungverantwortlicher As String
|
||||
Property BemerkungVerantwortlicher() As String
|
||||
Get
|
||||
Return m_bemerkungverantwortlicher
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_bemerkungverantwortlicher = Value
|
||||
End Set
|
||||
End Property
|
||||
Property Dokumentid() As String
|
||||
Get
|
||||
Return m_dokumentid
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_dokumentid = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property AktullerStatus() As Integer
|
||||
Get
|
||||
Return m_aktuellerstatus
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
m_aktuellerstatus = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property NeuerStatus() As Integer
|
||||
Get
|
||||
Return m_neuerstatus
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
m_neuerstatus = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Ablgeschossen() As Boolean
|
||||
Get
|
||||
Return m_abgeschlossen
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_abgeschlossen = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property Ausgangsarchivierung() As Boolean
|
||||
Get
|
||||
Return m_ausgangsarchivierung
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_ausgangsarchivierung = Value
|
||||
End Set
|
||||
End Property
|
||||
Property Eingangsarchivierung() As Boolean
|
||||
Get
|
||||
Return m_eingangsarchivierung
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_eingangsarchivierung = Value
|
||||
End Set
|
||||
End Property
|
||||
Property Folgestatus() As Boolean
|
||||
Get
|
||||
Return m_folgestatus
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_folgestatus = Value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
Dim dokumentwerte As DataTable
|
||||
|
||||
#Region "Meldungen"
|
||||
|
||||
Public Function Meldung_Verantwortlicher(ByVal dokumentid As String, ByVal verantwortlicher As Integer)
|
||||
Try
|
||||
dokumentwerte = GetDokumentwerte(dokumentid, 100, 0)
|
||||
insert_Message(1, dokumentid, Meldungstext_aufbereiten, parstext(dokumentwerte.Rows(0).Item("betreff")), Globals.MitarbeiterNr, verantwortlicher, 0)
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Meldung_Status(ByVal dokumentid As String, ByVal status As String)
|
||||
Try
|
||||
dokumentwerte = GetDokumentwerte(dokumentid, 102, status)
|
||||
insert_Message(0, dokumentid, Meldungstext_aufbereiten, parstext(dokumentwerte.Rows(0).Item("betreff")), Globals.MitarbeiterNr, 0, status)
|
||||
Catch
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Meldung_Aufhebung(ByVal dokumentid As String, ByVal verantwortlicher As Integer)
|
||||
dokumentwerte = GetDokumentwerte(dokumentid, 110, 0)
|
||||
insert_Message(0, dokumentid, Meldungstext_aufbereiten, parstext(dokumentwerte.Rows(0).Item("betreff")), Globals.MitarbeiterNr, 0, 0)
|
||||
End Function
|
||||
|
||||
Public Function Meldungstext_aufbereiten() As String
|
||||
Dim s As String
|
||||
s = ""
|
||||
Try
|
||||
s = dokumentwerte.Rows(0).Item("meldung") + vbCrLf + dokumentwerte.Rows(0).Item("idvmeldung") + vbCrLf + dokumentwerte.Rows(0).Item("footer")
|
||||
If Me.BemerkungVerantwortlicher <> "" Then
|
||||
s = Me.BemerkungVerantwortlicher + vbCrLf + "------------------------" + vbCrLf + s
|
||||
' s = s + vbCrLf + vbCrLf + Me.BemerkungVerantwortlicher
|
||||
Me.BemerkungVerantwortlicher = ""
|
||||
End If
|
||||
s = parstext(s)
|
||||
Catch
|
||||
End Try
|
||||
Meldungstext_aufbereiten = s
|
||||
End Function
|
||||
|
||||
Public Function parstext(ByVal s As String) As String
|
||||
s = s.Replace("&dokumentid&", dokumentwerte.Rows(0).Item("dokumentid"))
|
||||
s = s.Replace("&nrpar00&", dokumentwerte.Rows(0).Item("nrpar00"))
|
||||
s = s.Replace("&bkpar00&", dokumentwerte.Rows(0).Item("bkpar00"))
|
||||
s = s.Replace("&dokumenttyp&", dokumentwerte.Rows(0).Item("bezeichnung"))
|
||||
s = s.Replace("&status&", dokumentwerte.Rows(0).Item("status"))
|
||||
s = s.Replace("&statusdatum&", Today)
|
||||
s = s.Replace("&verantwortlich&", dokumentwerte.Rows(0).Item("verantwortlich"))
|
||||
s = s.Replace("&absender&", dokumentwerte.Rows(0).Item("absender"))
|
||||
s = s.Replace("&empfaenger&", dokumentwerte.Rows(0).Item("empfaenger"))
|
||||
Return s
|
||||
End Function
|
||||
|
||||
Public Function GetDokumentwerte(ByVal Dokumentid As String, ByVal typ As Integer, ByVal status As Integer) As DataTable
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.SP_message_getdokumentwerte"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.MitarbeiterNr))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@typ", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, typ))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@status", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, status))
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function insert_Message(ByVal typ As Integer, ByVal Dokumentid As String, ByVal message As String, ByVal betreff As String, _
|
||||
ByVal absender As Integer, ByVal empfaenger As Integer, ByVal status As Integer)
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.SP_message_insert"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@absender", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, absender))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@empfaenger", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, empfaenger))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@betreff", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, betreff))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@meldung", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, message))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@status", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, status))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@weiterleiten", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@typ", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, typ))
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Datenzugriffe"
|
||||
Private Function Generic_Select(ByVal typ As Integer) As DataTable
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Select Case typ
|
||||
Case 1
|
||||
scmCmdToExecute.CommandText = "dbo.SP_Dokumentstatus_statushandling_Select"
|
||||
Case Else
|
||||
End Select
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
Select Case typ
|
||||
Case 1
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Dokumentid))
|
||||
Case Else
|
||||
End Select
|
||||
If typ = 1 Then
|
||||
End If
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokumenterstellung::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Archivierung"
|
||||
Public Function Set_Ausgangsarchiviert(ByVal dokumentid As String) As Integer
|
||||
Dim da As DataTable
|
||||
Dim currentstatus As Integer
|
||||
Dim i, i1 As Integer
|
||||
Me.Dokumentid = dokumentid
|
||||
da = Generic_Select(1)
|
||||
currentstatus = da.Rows(0).Item("dokument_statusnr")
|
||||
For i = 0 To da.Rows.Count - 1
|
||||
If da.Rows(i).Item("status_bezeichnungnr") = 3 Then
|
||||
For i1 = 0 To da.Rows.Count - 1
|
||||
If da.Rows(i1).Item("status_bezeichnungnr") = 4 Or _
|
||||
da.Rows(i1).Item("status_bezeichnungnr") = 5 Then
|
||||
Me.insert_history_status(da.Rows(i1).Item("dokument_statusnr"), dokumentid, Globals.MitarbeiterNr)
|
||||
Return da.Rows(i1).Item("dokument_statusnr")
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
da.Dispose()
|
||||
End Function
|
||||
|
||||
Public Function Set_Eingangsarchiviert(ByVal dokumentid As String) As Integer
|
||||
Dim da As DataTable
|
||||
Dim currentstatus As Integer
|
||||
Dim i, i1 As Integer
|
||||
Me.Dokumentid = dokumentid
|
||||
da = Generic_Select(1)
|
||||
currentstatus = da.Rows(0).Item("dokument_statusnr")
|
||||
For i1 = 0 To da.Rows.Count - 1
|
||||
If da.Rows(i1).Item("status_bezeichnungnr") = 6 Or _
|
||||
da.Rows(i1).Item("status_bezeichnungnr") = 7 Or _
|
||||
da.Rows(i1).Item("status_bezeichnungnr") = 11 Then
|
||||
Me.insert_history_status(da.Rows(i1).Item("dokument_statusnr"), dokumentid, Globals.MitarbeiterNr)
|
||||
MsgBox(da.Rows(i1).Item("dokument_statusnr"))
|
||||
Return da.Rows(i1).Item("dokument_statusnr")
|
||||
End If
|
||||
Next
|
||||
da.Dispose()
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Dim ds As New edokadb.clsDokument_status()
|
||||
|
||||
Public Sub Dispose()
|
||||
ds.Dispose()
|
||||
End Sub
|
||||
|
||||
Public Function Check_Neuer_Status()
|
||||
ds.cpMainConnectionProvider = conn
|
||||
ds.iDokument_statusnr = New SqlInt32(CType(Me.NeuerStatus, Int32))
|
||||
ds.SelectOne()
|
||||
|
||||
If ds.bFolgestatus_durch_anderen_verantwortlichen.Value = True Then
|
||||
Me.Folgestatus = True
|
||||
End If
|
||||
Me.Ausgangsarchivierung = False
|
||||
If ds.iStatus_bezeichnungnr.Value = 3 Or ds.bDokument_ausgangsarchivierung.Value = True Then
|
||||
Me.Ausgangsarchivierung = True
|
||||
End If
|
||||
If ds.bDokument_bearbeitung_abgeschlossen.Value = True Then
|
||||
Me.Ablgeschossen = True
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function insert_history_status(ByVal statusnr As Integer, ByVal dokumentid As String, ByVal Verantwortlicher As Integer)
|
||||
Dim sh As New edokadb.clsStatushistory()
|
||||
sh.cpMainConnectionProvider = conn
|
||||
Dim dbkey As New edokadb.clsMyKey_Tabelle()
|
||||
Dim key As Long
|
||||
dbkey.cpMainConnectionProvider = conn
|
||||
conn.OpenConnection()
|
||||
key = dbkey.get_dbkey("statushistory")
|
||||
sh.iStatushistorynr = New SqlInt32(CType(key, Int32))
|
||||
sh.iStatus = New SqlInt32(CType(statusnr, Int32))
|
||||
sh.iMandantnr = New SqlInt32(CType(1, Int32))
|
||||
sh.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
||||
sh.bAktiv = New SqlBoolean(True)
|
||||
sh.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
||||
sh.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
sh.sDokumentid = New SqlString(CType(dokumentid, String))
|
||||
sh.iVerantwortlich = New SqlInt32(CType(Verantwortlicher, Int32))
|
||||
conn.OpenConnection()
|
||||
sh.Insert()
|
||||
conn.CloseConnection(True)
|
||||
dbkey.Dispose()
|
||||
sh.Dispose()
|
||||
End Function
|
||||
|
||||
Public Function insert_history_status_abschluss(ByVal statusnr As Integer, ByVal dokumentid As String, ByVal Verantwortlicher As Integer)
|
||||
Dim sh As New edokadb.clsStatushistory()
|
||||
sh.cpMainConnectionProvider = conn
|
||||
Dim dbkey As New edokadb.clsMyKey_Tabelle()
|
||||
Dim key As Long
|
||||
dbkey.cpMainConnectionProvider = conn
|
||||
conn.OpenConnection()
|
||||
key = dbkey.get_dbkey("statushistory")
|
||||
sh.iStatushistorynr = New SqlInt32(CType(key, Int32))
|
||||
sh.iStatus = New SqlInt32(CType(statusnr, Int32))
|
||||
sh.iMandantnr = New SqlInt32(CType(1, Int32))
|
||||
sh.iMutierer = New SqlInt32(CType(9998, Int32))
|
||||
sh.bAktiv = New SqlBoolean(True)
|
||||
sh.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
||||
sh.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
sh.sDokumentid = New SqlString(CType(dokumentid, String))
|
||||
sh.iVerantwortlich = New SqlInt32(CType(Verantwortlicher, Int32))
|
||||
conn.OpenConnection()
|
||||
sh.Insert()
|
||||
conn.CloseConnection(True)
|
||||
dbkey.Dispose()
|
||||
sh.Dispose()
|
||||
End Function
|
||||
|
||||
Public Function Alle_Status(ByVal Dokumentid As String) As DataTable
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.SP_Trefferliste_Select_Status"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, ""))
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Public Function Status_Erstellen(ByVal dokumentid As String, ByVal blsequenz As Boolean)
|
||||
'Status_Erstellen_Overwrite(dokumentid, 0)
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.sp_dokumentberabeigung_status_erstellen"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@bck", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
If blsequenz = False Then
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@blsequenz", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
Else
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@blsequenz", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
|
||||
End If
|
||||
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Status_Erstellen_Overwrite(ByVal dokumentid As String, ByVal blsequenz As Boolean)
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.sp_dokument_status_import_erstellen"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@Statustyp", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 7))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.MitarbeiterNr))
|
||||
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub Insert_Note(ByVal dokumentid As String, ByVal meldung As String)
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
scmCmdToExecute.CommandText = "dbo.SP_Dokument_Notizen"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
scmCmdToExecute.Connection.Open()
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@notiznr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@betreff", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, meldung))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@value", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, meldung))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@aktiv", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@mutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.Mitarbeiternr))
|
||||
scmCmdToExecute.ExecuteNonQuery()
|
||||
Catch ex As Exception
|
||||
'MsgBox(ex.Message)
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Connection.Close()
|
||||
scmCmdToExecute.Dispose()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function loeschart(ByVal dokid As String)
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
scmCmdToExecute.CommandText = "dbo.SP_check_aufhebung_loeschung"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
conn.OpenConnection()
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@res", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
scmCmdToExecute.ExecuteNonQuery()
|
||||
Return scmCmdToExecute.Parameters("@res").Value
|
||||
Catch ex As Exception
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
conn.CloseConnection(True)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Public Function get_coldindex_and_statusnr(ByVal dokumentid As String, ByVal aufheben As Boolean, ByVal reaktivieren As Boolean) As DataTable
|
||||
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
||||
Dim i As Integer
|
||||
Dim dtToReturn As DataTable = New DataTable()
|
||||
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
||||
scmCmdToExecute.CommandText = "dbo.sp_get_coldindex_and_aufhebungsstatus"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@reaktivieren", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, reaktivieren))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@aufhebungsstatus", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
sdaAdapter.Fill(dtToReturn)
|
||||
i = scmCmdToExecute.Parameters.Item("@aufhebungsstatus").Value
|
||||
If (i <> 0 And aufheben) Or (i <> 0 And reaktivieren) Then
|
||||
insert_history_status(i, dokumentid, MitarbeiterNr)
|
||||
Dim d As New edokadb.clsDokument()
|
||||
d.cpMainConnectionProvider = conn
|
||||
d.sDokumentid = New SqlString(CType(dokumentid, String))
|
||||
d.SelectOne()
|
||||
d.iStatusnr = New SqlInt32(CType(i, Int32))
|
||||
'Rel. 3.6
|
||||
d.daMutiertam = New SqlDateTime(CType(Now(), DateTime))
|
||||
d.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
||||
|
||||
conn.OpenConnection()
|
||||
d.Update()
|
||||
conn.CloseConnection(True)
|
||||
d.Dispose()
|
||||
End If
|
||||
Return dtToReturn
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
' // some error occured. Bubble it to caller and encapsulate Exception object
|
||||
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user