Initial commit
This commit is contained in:
431
SW/Dokumente/DMS/MyDocMgmt.vb
Normal file
431
SW/Dokumente/DMS/MyDocMgmt.vb
Normal file
@@ -0,0 +1,431 @@
|
||||
Imports C1.Win.C1TrueDBGrid
|
||||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Diagnostics
|
||||
|
||||
'
|
||||
Namespace Utils
|
||||
''' <summary>
|
||||
''' Klasse für das Speichern bzw. Auslesen von Image-Dateien in der Datenbank
|
||||
''' </summary>
|
||||
''' <remarks>
|
||||
''' Es werden folgende Datebanktabellen berücksichtigt:
|
||||
''' <list type="bullet">
|
||||
''' <item>
|
||||
''' <description>Dokument Attribut DocImage</description></item>
|
||||
''' <item>
|
||||
''' <description>Profile Attribut V_Uebersicht (Profillayout des C1TrueDBGrids der
|
||||
''' Vertragsübersicht|Vertragselemente</description></item></list>
|
||||
''' </remarks>
|
||||
''' <includesource>yes</includesource>
|
||||
Public Class MyDocMgmt
|
||||
''' <summary>
|
||||
''' Grid-Layoutfile speichern
|
||||
''' </summary>
|
||||
''' <param name="c1data">C1Truedbgrind, von welchem das Layout gespeichert werden soll</param>
|
||||
''' <param name="GriddNo">Nummer des Grids: 1=Vertragsübersicht...</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Save_LayoutFile(ByRef c1data As C1TrueDBGrid, ByVal GridNo As Integer, ByVal Profilnr As Integer) As Boolean
|
||||
Dim filename As String = Globals.TmpFilepath(+Trim(Str(Profilnr)) + Trim(Str(GridNo)) + ".lyt")
|
||||
c1data.SaveLayout(filename)
|
||||
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from profil where profilnr = " & Str(Profilnr), Connection)
|
||||
'mitarbeiternr=" + Str(Globals.clsmitarbeiter.iMitarbeiternr.Value)
|
||||
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
|
||||
' Neues Profil sepeichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(1) = Globals.Mitarbeiternr
|
||||
myRow.Item(2) = ""
|
||||
Select Case GridNo
|
||||
Case 1
|
||||
myRow.Item(3) = mydata
|
||||
End Select
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "profil")
|
||||
Else
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Select Case GridNo
|
||||
Case 1
|
||||
myRow.Item(3) = 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
|
||||
|
||||
Private Function Get_Layoutfile_from_db(ByVal filename As String, ByVal GridNo As Integer, ByVal Profilnr As Integer) As Boolean
|
||||
'Exit Function
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From profil where profilnr=" & Str(Profilnr), connection)
|
||||
'mitarbeiternr=" + Str(Globals.clsmitarbeiter.iMitarbeiternr.Value)
|
||||
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
|
||||
Select Case GridNo
|
||||
Case 1
|
||||
MyData = myRow.Item(3)
|
||||
|
||||
End Select
|
||||
|
||||
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
|
||||
Return True
|
||||
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(ByRef c1data As C1TrueDBGrid, ByVal GridNo As Integer, ByVal Profilnr As Integer) As Boolean
|
||||
Dim filename As String = Globals.TmpFilepath + Trim(Str(Profilnr)) + Trim(Str(GridNo)) + ".lyt"
|
||||
If File.Exists(filename) Then
|
||||
c1data.LoadLayout(filename)
|
||||
Return True
|
||||
End If
|
||||
If Get_Layoutfile_from_db(filename, GridNo, Profilnr) Then
|
||||
c1data.LoadLayout(filename)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Dokument in der Tabelle Dokument speichern
|
||||
''' </summary>
|
||||
''' <param name="Dokumentnr">Nummer des Dokument-Datensatzes</param>
|
||||
''' <param name="Filename">Zu speichender Dateiname</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
|
||||
Public Function Save_Document(ByVal Dokumentnr As Integer, ByVal Filename As String) As Boolean
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from dokument where dokumentnr =" + Str(Dokumentnr), 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, "Dokument")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
Return False
|
||||
Else
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(16) = mydata
|
||||
DA.Update(ds, "Dokument")
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Liest das Dokument aus der DB und speichert dieses unter einem temporären Filenamen ab
|
||||
''' </summary>
|
||||
''' <param name="DokumentNr"></param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Get_Dokument(ByVal DokumentNr As Integer) As String
|
||||
Dim Filename As String = Globals.TmpFilepath
|
||||
If Right(Filename, 1) <> "\" Then Filename = Filename + "\"
|
||||
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select * From Dokument where DokumentNr=" + Str(DokumentNr), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "Dokument")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Select Case myRow.Item("Speichertypnr")
|
||||
Case 1
|
||||
Dim MyData() As Byte
|
||||
MyData = myRow.Item(16)
|
||||
|
||||
Dim K As Long
|
||||
K = UBound(MyData)
|
||||
Filename = Filename + myRow.Item(6)
|
||||
Dim fs As New FileStream(Filename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
fs.Write(MyData, 0, K)
|
||||
fs.Close()
|
||||
fs = Nothing
|
||||
Case 2
|
||||
Filename = myRow.Item("OriginalFilename_incl_Path")
|
||||
Case 3
|
||||
Filename = myRow.Item("OriginalFilename_incl_Path")
|
||||
Case Else
|
||||
Filename = myRow.Item("OriginalFilename_incl_Path")
|
||||
End Select
|
||||
|
||||
Catch ex As Exception
|
||||
''MsgBox(ex.Message, MsgBoxStyle.Critical)
|
||||
Return ""
|
||||
Finally
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
Return Filename
|
||||
End Function
|
||||
|
||||
Public Function Show_Document(ByVal Dokumentnr As Integer) As Boolean
|
||||
Dim tmpfilename As String = ""
|
||||
Try
|
||||
tmpfilename = Me.Get_Dokument(Dokumentnr)
|
||||
Catch
|
||||
Return False
|
||||
End Try
|
||||
|
||||
If tmpfilename <> "" Then
|
||||
OpenSystemFile(tmpfilename)
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Function OpenSystemFile(ByVal sFileName As String) As Boolean
|
||||
If Len(sFileName) > 0 Then
|
||||
System.Diagnostics.Process.Start(sFileName)
|
||||
'
|
||||
' ShellExecute(GetDesktopWindow(), vbNullString, sFileName, vbNullString, vbNullString, vbNormalFocus)
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function Save_RptDatei(ByVal Auswertungnr As Integer, ByVal AuswertungName As String) As String
|
||||
Dim filename As String = AuswertungName
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from AuswertungRptDatei where AuswertungDateiNr = " & Str(Auswertungnr), 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, "RptFile")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Datei speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = Auswertungnr
|
||||
myRow.Item(1) = AuswertungName
|
||||
myRow.Item(2) = RptName(AuswertungName)
|
||||
myRow.Item(3) = mydata
|
||||
myRow.Item(4) = Now
|
||||
myRow.Item(5) = Now
|
||||
myRow.Item(6) = Globals.Mitarbeiternr
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "RptFile")
|
||||
Else
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(1) = AuswertungName
|
||||
myRow.Item(2) = RptName(AuswertungName)
|
||||
myRow.Item(3) = mydata
|
||||
myRow.Item(5) = Now
|
||||
myRow.Item(6) = Globals.Mitarbeiternr
|
||||
DA.Update(ds, "RptFile")
|
||||
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 RptName(AuswertungName)
|
||||
End Function
|
||||
|
||||
Public Function RptName(ByVal path As String) As String
|
||||
Dim i As Integer
|
||||
Dim file As String = path
|
||||
i = InStrRev(file.Trim, "\")
|
||||
If i = 0 Then
|
||||
Return file.Trim
|
||||
Else
|
||||
Return Right(file.Trim, Len(file.Trim) - i)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function Get_RptDatei(ByVal Auswertungnr As String, Optional ByVal fname As String = "") As String
|
||||
Dim connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from AuswertungRptDatei where AuswertungDateiNr = " & Str(Auswertungnr), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim Filename As String = ""
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
DA.Fill(ds, "RptFile")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
Filename = Globals.TmpFilepath + "\" + myRow.Item(2).ToString
|
||||
If fname <> "" Then
|
||||
Filename = fname
|
||||
End If
|
||||
MyData = myRow.Item(3)
|
||||
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 ""
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return Filename
|
||||
End Function
|
||||
|
||||
Public Function Save_Architekturfile(ByVal Applikationnr As Integer, ByVal iFilename As String)
|
||||
Dim filename As String = iFilename
|
||||
Dim Connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from ApplikationArchitektur where applikationnr = " & Str(Applikationnr), 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, "RptFile")
|
||||
Dim myRow As DataRow
|
||||
If ds.Tables(0).Rows.Count = 0 Then
|
||||
' Neues Datei speichern
|
||||
myRow = ds.Tables(0).NewRow
|
||||
myRow.Item(0) = Applikationnr
|
||||
myRow.Item(1) = mydata
|
||||
' myRow.Item(4) = Now
|
||||
' myRow.Item(5) = Now
|
||||
' myRow.Item(6) = Globals.clsmitarbeiter.iMitarbeiternr.Value
|
||||
ds.Tables(0).Rows.Add(myRow)
|
||||
DA.Update(ds, "RptFile")
|
||||
Else
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
myRow.Item(1) = mydata
|
||||
' myRow.Item(2) = RptName(AuswertungName)
|
||||
' myRow.Item(3) = mydata
|
||||
' myRow.Item(5) = Now
|
||||
' myRow.Item(6) = Globals.clsmitarbeiter.iMitarbeiternr.Value
|
||||
DA.Update(ds, "RptFile")
|
||||
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
|
||||
End Function
|
||||
|
||||
Public Function Get_Architekturfile(ByVal Applikationnr As String, Optional ByVal fname As String = "") As String
|
||||
Dim connection As New SqlConnection()
|
||||
Dim DA As New SqlDataAdapter("select * from ApplikationArchitektur where applikationnr = " & Str(Applikationnr), connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
||||
Dim ds As New DataSet()
|
||||
Dim Filename As String = ""
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
DA.Fill(ds, "RptFile")
|
||||
Dim myRow As DataRow
|
||||
myRow = ds.Tables(0).Rows(0)
|
||||
Dim MyData() As Byte
|
||||
Filename = Globals.TmpFilepath + "\architekturfile.xml"
|
||||
If fname <> "" Then
|
||||
Filename = fname
|
||||
End If
|
||||
MyData = myRow.Item(1)
|
||||
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 ""
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
DA = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return Filename
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
252
SW/Dokumente/DMS/clsDok.vb
Normal file
252
SW/Dokumente/DMS/clsDok.vb
Normal file
@@ -0,0 +1,252 @@
|
||||
Imports System
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports C1.Win.C1TrueDBGrid
|
||||
Namespace DMS
|
||||
|
||||
Public Class clsDok
|
||||
Inherits DB.clsDokument
|
||||
|
||||
#Region "Deklarationen"
|
||||
Private Dokumenttyp As New DB.clsDokumenttyp
|
||||
Private Speichertyp As New DB.clsSpeicherTyp
|
||||
Public Dokumenttypdaten As DataTable
|
||||
Public Speichertypdaten As New DataTable
|
||||
Private DocMgmt As New Utils.MyDocMgmt
|
||||
Public Dokumente As New DataTable
|
||||
Public Neuer_Datensatz As Boolean = False
|
||||
Public Stammdaten As New DB.clsStammdaten
|
||||
#End Region
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Dokument laden
|
||||
''' </summary>
|
||||
''' <param name="Nr">PersonNr</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
|
||||
Public Function Get_Dokument(ByVal Nr As Integer)
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Me.iDokumentNr = New SqlInt32(CType(Nr, Int32))
|
||||
Globals.conn.OpenConnection()
|
||||
Me.SelectOne()
|
||||
Globals.conn.CloseConnection(True)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Person sichern
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Save_Data() As Integer
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.iMutierer = New SqlInt32(CType(Globals.Mitarbeiternr, Int32))
|
||||
Globals.conn.OpenConnection()
|
||||
Me.Update()
|
||||
Globals.conn.CloseConnection(True)
|
||||
Me.Neuer_Datensatz = False
|
||||
Return Me.iDokumentNr.Value
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Kopie eines Datensatzes erstellen.
|
||||
''' </summary>
|
||||
''' <param name="Basenr">Ursprungs-Person: Ist dieser Wert nicht 0, werden die Daten mit BaseNr zuerst gelesen</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Create_Copy(Optional ByVal Basenr As Integer = 0) As Integer
|
||||
If Basenr <> 0 Then
|
||||
Get_Dokument(Basenr)
|
||||
End If
|
||||
Dim db As New DB.clsMyKey_Tabelle
|
||||
db.cpMainConnectionProvider = Globals.conn
|
||||
Dim newkey = db.get_dbkey("Dokument")
|
||||
db.Dispose()
|
||||
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Me.iDokumentNr = New SqlInt32(CType(newkey, Int32))
|
||||
Me.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.iMutierer = New SqlInt32(CType(Globals.Mitarbeiternr, Int32))
|
||||
Globals.conn.OpenConnection()
|
||||
Me.Insert()
|
||||
Globals.conn.CloseConnection(True)
|
||||
Me.Neuer_Datensatz = True
|
||||
Return newkey
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Datensatz inaktivieren
|
||||
''' </summary>
|
||||
''' <param name="Basenr">Ursprungs-Person: Ist dieser Wert nicht 0, werden die Daten mit BaseNr zuerst gelesen</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Delete_Dokument(Optional ByVal Basenr As Integer = 0) As Integer
|
||||
If Basenr <> 0 Then
|
||||
Get_Dokument(Basenr)
|
||||
End If
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Me.bAktiv = New SqlBoolean(CType(False, Boolean))
|
||||
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.iMutierer = New SqlInt32(CType(Globals.Mitarbeiternr, Int32))
|
||||
Globals.conn.OpenConnection()
|
||||
Me.Update()
|
||||
Globals.conn.CloseConnection(True)
|
||||
Me.Neuer_Datensatz = False
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Datensatz physisch löschen
|
||||
''' </summary>
|
||||
''' <param name="Basenr">Ursprungs-Person: Ist dieser Wert nicht 0, werden die Daten mit BaseNr zuerst gelesen</param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Overloads Function Delete(Optional ByVal Basenr As Integer = 0) As Integer
|
||||
If Basenr <> 0 Then
|
||||
Get_Dokument(Basenr)
|
||||
End If
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Globals.conn.OpenConnection()
|
||||
MyBase.Delete()
|
||||
Globals.conn.CloseConnection(True)
|
||||
Me.Neuer_Datensatz = False
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Neue Person einfügen
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Add_New(ByVal Elementnr As Integer, ByVal doktype As Integer) As Integer
|
||||
Dim db As New DB.clsMyKey_Tabelle
|
||||
db.cpMainConnectionProvider = Globals.conn
|
||||
Dim newkey = db.get_dbkey("Dokument")
|
||||
db.Dispose()
|
||||
Me.iDokumentNr = New SqlInt32(CType(newkey, Int32))
|
||||
Me.iKeyValue = New SqlInt32(CType(Elementnr, Int32))
|
||||
Me.iDokType = New SqlInt32(CType(doktype, Int32))
|
||||
Me.iDokumenttypNr = New SqlInt32(CType(2, Int32))
|
||||
Me.sBezeichnung = New SqlString(CType("", String))
|
||||
Me.sBeschreibung = New SqlString(CType("", String))
|
||||
Me.sFilename = New SqlString(CType("", String))
|
||||
Me.sOriginalFilename_incl_Path = New SqlString(CType("", String))
|
||||
Me.sVersion = New SqlString(CType("", String))
|
||||
Me.daVersionsdatum = New SqlDateTime(CType(SqlDateTime.Null, DateTime))
|
||||
Me.bAktiv = New SqlBoolean(CType(True, Boolean))
|
||||
Me.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
||||
Me.iMutierer = New SqlInt32(CType(Globals.Mitarbeiternr, Int32))
|
||||
Me.iSpeichertypNr = New SqlInt32(CType(1, Int32))
|
||||
Me.cpMainConnectionProvider = Globals.conn
|
||||
Globals.conn.OpenConnection()
|
||||
Me.Insert()
|
||||
Globals.conn.CloseConnection(True)
|
||||
Me.Neuer_Datensatz = True
|
||||
Return newkey
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Dokumenttypen laden und in der Datatable Dokumenttypdaten bereit stellen
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Get_Dokumenttypen() As DataTable
|
||||
Me.Dokumenttyp.cpMainConnectionProvider = Globals.conn
|
||||
Me.Dokumenttypdaten = Stammdaten.Get_Stammdaten("Dokumenttyp", "Bezeichnung")
|
||||
End Function
|
||||
|
||||
Public Function Get_Speichertypen() As DataTable
|
||||
Me.speichertyp.cpMainConnectionProvider = Globals.conn
|
||||
Me.Speichertypdaten = Stammdaten.Get_Stammdaten("Speichertyp", "Bezeichnung")
|
||||
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Datei im Dokument speichern
|
||||
''' </summary>
|
||||
''' <param name="DokumentNr"></param>
|
||||
''' <param name="Filename"></param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Save_File(ByVal DokumentNr As Integer, ByVal Filename As String) As Boolean
|
||||
If Filename = "" Then Return True
|
||||
If Me.DocMgmt.Save_Document(DokumentNr, Filename) = False Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function Show_Doc(ByVal dokumentnr As Integer) As Boolean
|
||||
Return Me.DocMgmt.Show_Document(dokumentnr)
|
||||
End Function
|
||||
|
||||
Public Function Get_Dokumente(ByVal Keyvalue As Integer, ByVal Doktype 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_get_dokumente"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@keyvalue", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Keyvalue))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@doktype", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Doktype))
|
||||
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
|
||||
Throw New Exception("clsDok::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_Dokumente_pruefschritt(ByVal Keyvalue As Integer, ByVal Doktype 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_get_dokumente_Pruefschritt"
|
||||
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
||||
scmCmdToExecute.Connection = conn.scoDBConnection
|
||||
Try
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@keyvalue", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Keyvalue))
|
||||
scmCmdToExecute.Parameters.Add(New SqlParameter("@doktype", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
||||
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
|
||||
Throw New Exception("clsDok::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
||||
Finally
|
||||
scmCmdToExecute.Dispose()
|
||||
sdaAdapter.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Exists_Testdrehbuch(ByVal Applikationnr As Integer) As Integer
|
||||
Dim tmpdata As New DataTable
|
||||
tmpdata = Get_Dokumente(Applikationnr, 2)
|
||||
If tmpdata.Rows.Count = 0 Then
|
||||
tmpdata.Dispose()
|
||||
Return -1
|
||||
Else
|
||||
Return tmpdata.Rows(0).Item("Dokumentnr")
|
||||
tmpdata.Dispose()
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
#Region "Dokumentablageorte"
|
||||
Public Dokumentablageort As TKB.VV.Sysadmin.DomainTable
|
||||
|
||||
Public Function Get_Ablageorte(ByVal c1data As C1TrueDBGrid, ByVal Dokumentnr As Integer)
|
||||
Dokumentablageort = New TKB.VV.Sysadmin.DomainTable("Dokumentablageort", Str(Dokumentnr), Globals.Mitarbeiternr)
|
||||
c1data.DataSource = Dokumentablageort.Tabledata
|
||||
c1data.DataMember = Dokumentablageort.Tabledata.Tables(0).TableName
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
70
SW/Dokumente/DMS/clsStammdaten.vb
Normal file
70
SW/Dokumente/DMS/clsStammdaten.vb
Normal file
@@ -0,0 +1,70 @@
|
||||
Imports System
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Namespace db
|
||||
|
||||
Public Class clsStammdaten
|
||||
Public Function Get_Stammdaten(ByVal Tabelle As String, ByVal orderby As String) As DataTable
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "sp_get_stammdaten"
|
||||
selectcommand.Parameters.Add("@Mitarbeiternr", SqlDbType.Int, 4)
|
||||
selectcommand.Parameters.Add("@Tabelle", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters.Add("@Orderby", SqlDbType.VarChar, 255)
|
||||
selectcommand.Parameters(0).Value = Globals.Mitarbeiternr
|
||||
selectcommand.Parameters(1).Value = Tabelle
|
||||
selectcommand.Parameters(2).Value = orderby
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.SelectCommand = selectcommand
|
||||
da.Fill(ds)
|
||||
Return ds.Tables(0)
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Get_Gremium(ByVal type As Integer, ByVal subtype As Integer) As DataTable
|
||||
Dim selectcommand As New SqlCommand
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("", connection)
|
||||
Dim ds As New DataSet
|
||||
selectcommand.CommandText = "dbo.sp_get_gremium"
|
||||
selectcommand.Parameters.Add("@type", SqlDbType.Int, 4)
|
||||
selectcommand.Parameters.Add("@subtype", SqlDbType.Int, 4)
|
||||
selectcommand.Parameters(0).Value = type
|
||||
selectcommand.Parameters(1).Value = subtype
|
||||
|
||||
selectcommand.CommandType = CommandType.StoredProcedure
|
||||
selectcommand.Connection = connection
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.SelectCommand = selectcommand
|
||||
da.Fill(ds)
|
||||
Return ds.Tables(0)
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
connection.Close()
|
||||
da.Dispose()
|
||||
ds.Dispose()
|
||||
selectcommand.Dispose()
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Reference in New Issue
Block a user