You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.4 KiB
98 lines
3.4 KiB
Imports System
|
|
Imports System.Configuration
|
|
Imports System.Data
|
|
Imports System.Data.SqlClient
|
|
Imports System.Data.SqlTypes
|
|
Imports System.IO
|
|
Imports System.ComponentModel
|
|
|
|
Public Class clsLog
|
|
|
|
#Region "Deklarationen"
|
|
Dim m_journalid As Long
|
|
Dim m_applikationid As Long
|
|
|
|
Dim clsapplikation As New edokadb.clsApplikation
|
|
Dim clsjournal As New edokadb.clsJournal
|
|
Dim clsjournaleintrag As New edokadb.clsJournaleintrag
|
|
|
|
Public Enum Enum_InfoTyp
|
|
Keine = 0
|
|
Information = 1
|
|
Warnung = 2
|
|
Fehler = 3
|
|
End Enum
|
|
|
|
#End Region
|
|
|
|
Public Sub Startlog(ByVal ApplicationID As Integer)
|
|
clsapplikation.iApplikationnr = New SqlInt32(CType(ApplicationID, Int32))
|
|
clsapplikation.cpMainConnectionProvider = conn_journale
|
|
clsapplikation.SelectOne()
|
|
Me.m_applikationid = clsapplikation.iApplikationnr.Value
|
|
|
|
clsjournal.daStart = New SqlDateTime(CType(Now, DateTime))
|
|
clsjournal.iApplikationnr = New SqlInt32(CType(Me.m_applikationid, Int32))
|
|
clsjournal.bFehlerhaft = New SqlBoolean(CType(False, Boolean))
|
|
clsjournal.sFehlerbeschreibung = New SqlString(CType("", String))
|
|
clsjournal.cpMainConnectionProvider = conn_journale
|
|
conn_journale.OpenConnection()
|
|
clsjournal.Insert()
|
|
Me.m_journalid = clsjournal.iJournalnr.Value
|
|
conn_journale.CloseConnection(True)
|
|
End Sub
|
|
|
|
Public Sub InsertJournale(ByVal Message As String, ByVal sTyp As Enum_InfoTyp)
|
|
If sTyp <> Enum_InfoTyp.Keine Then
|
|
m_log.Log(Message, sTyp)
|
|
End If
|
|
clsjournaleintrag.iJournalnr = New SqlInt32(CType(Me.m_journalid, Int32))
|
|
clsjournaleintrag.daDatumzeit = New SqlDateTime(CType(Now, DateTime))
|
|
clsjournaleintrag.sEintrag = New SqlString(CType(Message, String))
|
|
clsjournaleintrag.cpMainConnectionProvider = conn_journale
|
|
Console.WriteLine(Message)
|
|
conn_journale.OpenConnection()
|
|
clsjournaleintrag.Insert()
|
|
conn_journale.CloseConnection(True)
|
|
End Sub
|
|
|
|
Public Function insert_journaldatei(ByVal dateiname As String, ByVal physicalfile As String) As Boolean
|
|
Dim Connection As New SqlConnection
|
|
Dim DA As New SqlDataAdapter("select * from journaldatei where journaldateinr > 99999999", Globals.sConnectionString_journale)
|
|
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
|
Dim ds As New DataSet
|
|
Try
|
|
Dim fs As New FileStream(physicalfile, FileMode.OpenOrCreate, FileAccess.Read)
|
|
Dim mydata(fs.Length) As Byte
|
|
fs.Read(mydata, 0, fs.Length)
|
|
fs.Close()
|
|
Try
|
|
Connection.ConnectionString = Globals.sConnectionString_journale
|
|
Connection.Open()
|
|
DA.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
myRow = ds.Tables(0).NewRow
|
|
myRow.Item(1) = Me.m_journalid
|
|
myRow.Item(2) = dateiname
|
|
myRow.Item(3) = mydata
|
|
myRow.Item(4) = physicalfile
|
|
ds.Tables(0).Rows.Add(myRow)
|
|
DA.Update(ds, "docs")
|
|
Catch ex As Exception
|
|
Return False
|
|
End Try
|
|
fs = Nothing
|
|
cb = Nothing
|
|
ds = Nothing
|
|
DA = Nothing
|
|
|
|
Connection.Close()
|
|
Connection = Nothing
|
|
Catch
|
|
End Try
|
|
Return True
|
|
End Function
|
|
|
|
|
|
End Class
|