Initial commit

This commit is contained in:
2021-04-20 07:59:36 +02:00
commit fb0247c874
21969 changed files with 11640044 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<!-- Define the remotable object. -->
<service>
<wellknown
mode = "SingleCall"
type="EDKB07WS.RCVerarbeitung, EDKB07WS"
objectUri="RCEDKB07WS.rem" />
</service>
<!-- Define the protocol used for network access.
You can use tcp or http channels. -->
<channels>
<channel ref="tcp" port="8000">
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

View File

@@ -0,0 +1,31 @@
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgende
' Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um Informationen,
' die mit einer Assembly verknüpft sind, zu bearbeiten.
' Die Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'Die folgende GUID ist für die ID der Typbibliothek, wenn dieses Projekt in COM angezeigt wird
<Assembly: Guid("80F7B799-9209-443A-AD2D-3DC8D780F0FF")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Haupversion
' Nebenversion
' Buildnummer
' Revisionsnummer
'
' Sie können alle Werte angeben oder auf die standardmäßigen Build- und Revisionsnummern
' zurückgreifen, indem Sie '*' wie unten angezeigt verwenden:
<Assembly: AssemblyVersion("2.0.*")>

View File

@@ -0,0 +1,289 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Connection Provider class for Database connection sharing
' // Generated by LLBLGen v1.2.1045.38210 Final on: Sonntag, 18. Mai 2003, 00:06:25
' // This class implements IDisposable.
' ///////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Namespace edokadb
' /// <summary>
' /// Purpose: provides a SqlConnection object which can be shared among data-access tier objects
' /// to provide a way to do ADO.NET transaction coding without the hassling with SqlConnection objects
' /// on a high level.
' /// </summary>
Public Class clsConnectionProvider
Implements IDisposable
#Region " Class Member Declarations "
Private m_scoDBConnection As SqlConnection
Private m_bIsTransactionPending, m_bIsDisposed As Boolean
Private m_stCurrentTransaction As SqlTransaction
Private m_alSavePoints As ArrayList
#End Region
Public Sub New()
' // Init the class
InitClass()
End Sub
' /// <summary>
' /// Purpose: Implements the IDispose' method Dispose.
' /// </summary>
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
' /// <summary>
' /// Purpose: Implements the Dispose functionality.
' /// </summary>
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If Not (m_stCurrentTransaction Is Nothing) Then
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
End If
If Not (m_scoDBConnection Is Nothing) Then
' // closing the connection will abort (rollback) any pending transactions
m_scoDBConnection.Close()
m_scoDBConnection.Dispose()
m_scoDBConnection = Nothing
End If
End If
End If
m_bIsDisposed = True
End Sub
' /// <summary>
' /// Purpose: Initializes class members.
' /// </summary>
Private Sub InitClass()
' // Create all the objects and initialize other members.
m_scoDBConnection = new SqlConnection()
m_bIsDisposed = False
m_stCurrentTransaction = Nothing
m_bIsTransactionPending = False
m_alSavePoints = new ArrayList()
End Sub
' /// <summary>
' /// Purpose: Opens the connection object.
' /// </summary>
' /// <returns>True, if succeeded, otherwise an Exception exception is thrown.</returns>
Public Function OpenConnection() As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) > 0 Then
' // It's already open.
Throw New Exception("OpenConnection::Connection is already open.")
End If
m_scoDBConnection.Open()
m_bIsTransactionPending = False
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Starts a new ADO.NET transaction using the open connection object of this class.
' /// </summary>
' /// <param name="sTransactionName">Name of the transaction to start</param>
' /// <returns>True, if transaction is started correctly, otherwise an Exception exception is thrown</returns>
Public Function BeginTransaction(sTransactionName As String) As Boolean
Try
If m_bIsTransactionPending Then
' // no nested transactions allowed.
Throw New Exception("BeginTransaction::Already transaction pending. Nesting not allowed")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("BeginTransaction::Connection is not open.")
End If
' // begin the transaction and store the transaction object.
m_stCurrentTransaction = m_scoDBConnection.BeginTransaction(IsolationLevel.ReadCommitted, sTransactionName)
m_bIsTransactionPending = True
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Commits a pending transaction on the open connection object of this class.
' /// </summary>
' /// <returns>True, if commit was succesful, or an Exception exception is thrown</returns>
Public Function CommitTransaction() As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("CommitTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("CommitTransaction::Connection is not open.")
End if
' // commit the transaction
m_stCurrentTransaction.Commit()
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Rolls back a pending transaction on the open connection object of this class,
' /// or rolls back to the savepoint with the given name. Savepoints are created with SaveTransaction().
' /// </summary>
' /// <param name="sTransactionToRollback">Name of transaction to roll back. Can be name of savepoint</param>
' /// <returns>True, if rollback was succesful, or an Exception exception is thrown</returns>
Public Function RollbackTransaction(sTransactionToRollback As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("RollbackTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("RollbackTransaction::Connection is not open.")
End If
' // rollback the transaction
m_stCurrentTransaction.Rollback(sTransactionToRollback)
' // if this wasn't a savepoint, we've rolled back the complete transaction, so we
' // can clean it up.
If Not m_alSavePoints.Contains(sTransactionToRollback) Then
' // it's not a savepoint
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Saves a pending transaction on the open connection object of this class to a 'savepoint'
' /// with the given name.
' /// When a rollback is issued, the caller can rollback to this savepoint or roll back the complete transaction.
' /// </summary>
' /// <param name="sSavePointName">Name of the savepoint to store the current transaction under.</param>
' /// <returns>True, if save was succesful, or an Exception exception is thrown</returns>
Public Function SaveTransaction(sSavePointName As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("SaveTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("SaveTransaction::Connection is not open.")
End If
' // save the transaction
m_stCurrentTransaction.Save(sSavePointName)
' // Store the savepoint in the list.
m_alSavePoints.Add(sSavePointName)
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Closes the open connection. Depending on bCommitPendingTransactions, a pending
' /// transaction is commited, or aborted.
' /// </summary>
' /// <param name="bCommitPendingTransaction">Flag for what to do when a transaction is still pending. True
' /// will commit the current transaction, False will abort (rollback) the complete current transaction.</param>
' /// <returns>True, if close was succesful, False if connection was already closed, or an Exception exception is thrown when
' /// an error occurs</returns>
Public Function CloseConnection(bCommitPendingTransaction As Boolean) As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // No open connection
Return False
End If
If m_bIsTransactionPending Then
If bCommitPendingTransaction Then
' // Commit the pending transaction
m_stCurrentTransaction.Commit()
Else
' // Rollback the pending transaction
m_stCurrentTransaction.Rollback()
End If
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
' // close the connection
m_scoDBConnection.Close()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
#Region " Class Property Declarations "
Public ReadOnly Property stCurrentTransaction() As SqlTransaction
Get
Return m_stCurrentTransaction
End Get
End Property
Public ReadOnly Property bIsTransactionPending() As Boolean
Get
Return m_bIsTransactionPending
End Get
End Property
Public ReadOnly Property scoDBConnection() As SqlConnection
Get
Return m_scoDBConnection
End Get
End Property
Public WriteOnly Property sConnectionString() As String
Set (ByVal Value As String)
m_scoDBConnection.ConnectionString = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,202 @@
' //////////////////////////////////////////////////////////////////////////////////////////
' // Description: Base class for Database Interaction.
' // Generated by LLBLGen v1.2.1045.38210 Final on: Sonntag, 18. Mai 2003, 00:06:25
' // Because this class implements IDisposable, derived classes shouldn't do so.
' //////////////////////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Namespace edokadb
' /// <summary>
' /// Purpose: Error Enums used by this LLBL library.
' /// </summary>
Public Enum LLBLError
AllOk
' // Add more here (check the comma's!)
End Enum
' /// <summary>
' /// Purpose: General interface of the API generated. Contains only common methods of all classes.
' /// </summary>
Public Interface ICommonDBAccess
Function Insert() As Boolean
Function Update() As Boolean
Function Delete() As Boolean
Function SelectOne() As DataTable
Function SelectAll() As DataTable
End Interface
' /// <summary>
' /// Purpose: Abstract base class for Database Interaction classes.
' /// </summary>
Public MustInherit Class clsDBInteractionBase
Implements IDisposable
Implements ICommonDBAccess
#Region " Class Member Declarations "
Protected m_scoMainConnection As SqlConnection
Protected m_iErrorCode As SqlInt32
Protected m_bMainConnectionIsCreatedLocal As Boolean
Protected m_cpMainConnectionProvider As clsConnectionProvider
Private m_sConnectionString As String
Private m_bIsDisposed As Boolean
#End Region
' /// <summary>
' /// Purpose: Class constructor.
' /// </summary>
Public Sub New()
' // Initialize the class' members.
InitClass()
End Sub
' /// <summary>
' /// Purpose: Initializes class members.
' /// </summary>
Private Sub InitClass()
' // create all the objects and initialize other members.
m_scoMainConnection = new SqlConnection()
m_bMainConnectionIsCreatedLocal = True
m_cpMainConnectionProvider = Nothing
m_iErrorCode = New SqlInt32(LLBLError.AllOk)
m_bIsDisposed = False
End Sub
' /// <summary>
' /// Purpose: Implements the IDispose' method Dispose.
' /// </summary>
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
' /// <summary>
' /// Purpose: Implements the Dispose functionality.
' /// </summary>
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If m_bMainConnectionIsCreatedLocal Then
' // Object is created in this class, so destroy it here.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
m_bMainConnectionIsCreatedLocal = True
End If
m_cpMainConnectionProvider = Nothing
m_scoMainConnection = Nothing
End If
End If
m_bIsDisposed = True
End Sub
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Insert() method.
' /// </summary>
Public Overridable Function Insert() As Boolean Implements ICommonDBAccess.Insert
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Delete() method.
' /// </summary>
Public Overridable Function Delete() As Boolean Implements ICommonDBAccess.Delete
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Update() method.
' /// </summary>
Public Overridable Function Update() As Boolean Implements ICommonDBAccess.Update
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.SelectOne() method.
' /// </summary>
Public Overridable Function SelectOne() As DataTable Implements ICommonDBAccess.SelectOne
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.SelectAll() method.
' /// </summary>
Public Overridable Function SelectAll() As DataTable Implements ICommonDBAccess.SelectAll
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
#Region " Class Property Declarations "
Public WriteOnly Property cpMainConnectionProvider() As clsConnectionProvider
Set(ByVal Value As clsConnectionProvider)
If Value Is Nothing Then
' // Invalid value
Throw New ArgumentNullException("cpMainConnectionProvider", "Nothing passed as value to this property which is not allowed.")
End If
' // A connection provider object is passed to this class.
' // Retrieve the SqlConnection object, if present and create a
' // reference to it. If there is already a MainConnection object
' // referenced by the membervar, destroy that one or simply
' // remove the reference, based on the flag.
If Not (m_scoMainConnection Is Nothing) Then
' // First get rid of current connection object. Caller is responsible
If m_bMainConnectionIsCreatedLocal Then
' // Is local created object, close it and dispose it.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
End If
' // Remove reference.
m_scoMainConnection = Nothing
End If
m_cpMainConnectionProvider = CType(Value, clsConnectionProvider)
m_scoMainConnection = m_cpMainConnectionProvider.scoDBConnection
m_bMainConnectionIsCreatedLocal = False
End Set
End Property
Public ReadOnly Property iErrorCode() As SqlInt32
Get
Return m_iErrorCode
End Get
End Property
Public Property sConnectionString() As String
Get
Return m_sConnectionString
End Get
Set (ByVal Value As String)
m_sConnectionString = Value
m_scoMainConnection.ConnectionString = m_sConnectionString
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,452 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Data Access class for the table 'Journal'
' // Generated by LLBLGen v1.2.1045.38210 Final on: Sonntag, 18. Mai 2003, 00:06:24
' // Because the Base Class already implements IDispose, this class doesn't.
' ///////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Namespace edokadb
' /// <summary>
' /// Purpose: Data Access class for the table 'Journal'.
' /// </summary>
Public Class clsJournal
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_bFehlerhaft As SqlBoolean
Private m_daEnde, m_daStart As SqlDateTime
Private m_iJournalnr, m_iApplikationnr As SqlInt32
Private m_sFehlerbeschreibung As SqlString
#End Region
' /// <summary>
' /// Purpose: Class constructor.
' /// </summary>
Public Sub New()
' // Nothing for now.
End Sub
' /// <summary>
' /// Purpose: Insert method. This method will insert one new row into the database.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iApplikationnr. May be SqlInt32.Null</LI>
' /// <LI>daStart. May be SqlDateTime.Null</LI>
' /// <LI>daEnde. May be SqlDateTime.Null</LI>
' /// <LI>bFehlerhaft. May be SqlBoolean.Null</LI>
' /// <LI>sFehlerbeschreibung. May be SqlString.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iJournalnr</LI>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journal_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iapplikationnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dastart", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daStart))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daende", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daEnde))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bfehlerhaft", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bFehlerhaft))
scmCmdToExecute.Parameters.Add(New SqlParameter("@sfehlerbeschreibung", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sFehlerbeschreibung))
scmCmdToExecute.Parameters.Add(new SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iJournalnr = scmCmdToExecute.Parameters.Item("@ijournalnr").Value
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journal_Insert' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
m_log.Log("clsJournal:Insert:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Throw New Exception("clsJournal::Insert::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Update method. This method will Update one existing row in the database.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournalnr</LI>
' /// <LI>iApplikationnr. May be SqlInt32.Null</LI>
' /// <LI>daStart. May be SqlDateTime.Null</LI>
' /// <LI>daEnde. May be SqlDateTime.Null</LI>
' /// <LI>bFehlerhaft. May be SqlBoolean.Null</LI>
' /// <LI>sFehlerbeschreibung. May be SqlString.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Update() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journal_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iapplikationnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dastart", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daStart))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daende", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daEnde))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bfehlerhaft", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bFehlerhaft))
scmCmdToExecute.Parameters.Add(New SqlParameter("@sfehlerbeschreibung", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sFehlerbeschreibung))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journal_Update' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournal::Update::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournalnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Delete() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journal_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journal_Delete' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournal::Delete::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key.
' /// </summary>
' /// <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournalnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// <LI>iJournalnr</LI>
' /// <LI>iApplikationnr</LI>
' /// <LI>daStart</LI>
' /// <LI>daEnde</LI>
' /// <LI>bFehlerhaft</LI>
' /// <LI>sFehlerbeschreibung</LI>
' /// </UL>
' /// Will fill all properties corresponding with a field in the table with the value of the row selected.
' /// </remarks>
Overrides Public Function SelectOne() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journal_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Journal")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journal_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iJournalnr = New SqlInt32(CType(dtToReturn.Rows(0)("journalnr"), Integer))
If dtToReturn.Rows(0)("applikationnr") Is System.DBNull.Value Then
m_iApplikationnr = SqlInt32.Null
Else
m_iApplikationnr = New SqlInt32(CType(dtToReturn.Rows(0)("applikationnr"), Integer))
End If
If dtToReturn.Rows(0)("start") Is System.DBNull.Value Then
m_daStart = SqlDateTime.Null
Else
m_daStart = New SqlDateTime(CType(dtToReturn.Rows(0)("start"), Date))
End If
If dtToReturn.Rows(0)("ende") Is System.DBNull.Value Then
m_daEnde = SqlDateTime.Null
Else
m_daEnde = New SqlDateTime(CType(dtToReturn.Rows(0)("ende"), Date))
End If
If dtToReturn.Rows(0)("fehlerhaft") Is System.DBNull.Value Then
m_bFehlerhaft = SqlBoolean.Null
Else
m_bFehlerhaft = New SqlBoolean(CType(dtToReturn.Rows(0)("fehlerhaft"), Boolean))
End If
If dtToReturn.Rows(0)("fehlerbeschreibung") Is System.DBNull.Value Then
m_sFehlerbeschreibung = SqlString.Null
Else
m_sFehlerbeschreibung = New SqlString(CType(dtToReturn.Rows(0)("fehlerbeschreibung"), String))
End If
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournal::SelectOne::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: SelectAll method. This method will Select all rows from the table.
' /// </summary>
' /// <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function SelectAll() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journal_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Journal")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journal_SelectAll' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournal::SelectAll::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#Region " Class Property Declarations "
Public Property [iJournalnr]() As SqlInt32
Get
Return m_iJournalnr
End Get
Set(ByVal Value As SqlInt32)
Dim iJournalnrTmp As SqlInt32 = Value
If iJournalnrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iJournalnr", "iJournalnr can't be NULL")
End If
m_iJournalnr = Value
End Set
End Property
Public Property [iApplikationnr]() As SqlInt32
Get
Return m_iApplikationnr
End Get
Set(ByVal Value As SqlInt32)
m_iApplikationnr = Value
End Set
End Property
Public Property [daStart]() As SqlDateTime
Get
Return m_daStart
End Get
Set(ByVal Value As SqlDateTime)
m_daStart = Value
End Set
End Property
Public Property [daEnde]() As SqlDateTime
Get
Return m_daEnde
End Get
Set(ByVal Value As SqlDateTime)
m_daEnde = Value
End Set
End Property
Public Property [bFehlerhaft]() As SqlBoolean
Get
Return m_bFehlerhaft
End Get
Set(ByVal Value As SqlBoolean)
m_bFehlerhaft = Value
End Set
End Property
Public Property [sFehlerbeschreibung]() As SqlString
Get
Return m_sFehlerbeschreibung
End Get
Set(ByVal Value As SqlString)
m_sFehlerbeschreibung = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,410 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Data Access class for the table 'Journaleintrag'
' // Generated by LLBLGen v1.2.1045.38210 Final on: Sonntag, 18. Mai 2003, 09:14:59
' // Because the Base Class already implements IDispose, this class doesn't.
' ///////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Namespace edokadb
' /// <summary>
' /// Purpose: Data Access class for the table 'Journaleintrag'.
' /// </summary>
Public Class clsJournaleintrag
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_daDatumzeit As SqlDateTime
Private m_iJournalnr, m_iJournaleintragnr As SqlInt32
Private m_sEintrag As SqlString
#End Region
' /// <summary>
' /// Purpose: Class constructor.
' /// </summary>
Public Sub New()
' // Nothing for now.
End Sub
' /// <summary>
' /// Purpose: Insert method. This method will insert one new row into the database.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournalnr. May be SqlInt32.Null</LI>
' /// <LI>sEintrag. May be SqlString.Null</LI>
' /// <LI>daDatumzeit. May be SqlDateTime.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iJournaleintragnr</LI>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@seintrag", SqlDbType.VarChar, 2048, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sEintrag))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dadatumzeit", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daDatumzeit))
scmCmdToExecute.Parameters.Add(new SqlParameter("@ijournaleintragnr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iJournaleintragnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iJournaleintragnr = scmCmdToExecute.Parameters.Item("@ijournaleintragnr").Value
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journaleintrag_Insert' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournaleintrag::Insert::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Update method. This method will Update one existing row in the database.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournaleintragnr</LI>
' /// <LI>iJournalnr. May be SqlInt32.Null</LI>
' /// <LI>sEintrag. May be SqlString.Null</LI>
' /// <LI>daDatumzeit. May be SqlDateTime.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Update() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournaleintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournaleintragnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournalnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iJournalnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@seintrag", SqlDbType.VarChar, 2048, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sEintrag))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dadatumzeit", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daDatumzeit))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journaleintrag_Update' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournaleintrag::Update::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key.
' /// </summary>
' /// <returns>True if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournaleintragnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Delete() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ijournaleintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournaleintragnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journaleintrag_Delete' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournaleintrag::Delete::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key.
' /// </summary>
' /// <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties needed for this method:
' /// <UL>
' /// <LI>iJournaleintragnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// <LI>iJournaleintragnr</LI>
' /// <LI>iJournalnr</LI>
' /// <LI>sEintrag</LI>
' /// <LI>daDatumzeit</LI>
' /// </UL>
' /// Will fill all properties corresponding with a field in the table with the value of the row selected.
' /// </remarks>
Overrides Public Function SelectOne() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Journaleintrag")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@ijournaleintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournaleintragnr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journaleintrag_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iJournaleintragnr = New SqlInt32(CType(dtToReturn.Rows(0)("journaleintragnr"), Integer))
If dtToReturn.Rows(0)("journalnr") Is System.DBNull.Value Then
m_iJournalnr = SqlInt32.Null
Else
m_iJournalnr = New SqlInt32(CType(dtToReturn.Rows(0)("journalnr"), Integer))
End If
If dtToReturn.Rows(0)("eintrag") Is System.DBNull.Value Then
m_sEintrag = SqlString.Null
Else
m_sEintrag = New SqlString(CType(dtToReturn.Rows(0)("eintrag"), String))
End If
If dtToReturn.Rows(0)("datumzeit") Is System.DBNull.Value Then
m_daDatumzeit = SqlDateTime.Null
Else
m_daDatumzeit = New SqlDateTime(CType(dtToReturn.Rows(0)("datumzeit"), Date))
End If
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournaleintrag::SelectOne::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
' /// <summary>
' /// Purpose: SelectAll method. This method will Select all rows from the table.
' /// </summary>
' /// <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
' /// <remarks>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function SelectAll() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Journaleintrag")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Journaleintrag_SelectAll' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsJournaleintrag::SelectAll::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#Region " Class Property Declarations "
Public Property [iJournaleintragnr]() As SqlInt32
Get
Return m_iJournaleintragnr
End Get
Set(ByVal Value As SqlInt32)
Dim iJournaleintragnrTmp As SqlInt32 = Value
If iJournaleintragnrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iJournaleintragnr", "iJournaleintragnr can't be NULL")
End If
m_iJournaleintragnr = Value
End Set
End Property
Public Property [iJournalnr]() As SqlInt32
Get
Return m_iJournalnr
End Get
Set(ByVal Value As SqlInt32)
m_iJournalnr = Value
End Set
End Property
Public Property [sEintrag]() As SqlString
Get
Return m_sEintrag
End Get
Set(ByVal Value As SqlString)
m_sEintrag = Value
End Set
End Property
Public Property [daDatumzeit]() As SqlDateTime
Get
Return m_daDatumzeit
End Get
Set(ByVal Value As SqlDateTime)
m_daDatumzeit = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<SQLConnectionString>data source=PG9;initial catalog=edoka_alt;persist security info=False;workstation id=;packet size=4096;user id=sa;password=;</SQLConnectionString>
<SQLConnectionStringJournale>data source=PG9;initial catalog=edoka_journale;persist security info=False;workstation id=;packet size=4096;user id=sa;password=;</SQLConnectionStringJournale>
<bldruckjobParam>[-f "TGKB EDOKA-Banklagernd"] [-G TGKB-C35-EW-EDOKA-BL-Put1.0]</bldruckjobParam>
<ColdOutputFolder>D:\hgi\Projekte\Edex\Druckjobaufbereitung</ColdOutputFolder>
<BLDruckDeckblatt>D:\hgi\Projekte\Edex\Druckjobaufbereitung\BanklagerndOutput.pdf</BLDruckDeckblatt>
<TempFilePath>D:\hgi\Projekte\Edex\Druckjobaufbereitung\Temp</TempFilePath>
<EDKB07OutputFolder>D:\hgi\Projekte\Edex\Druckjobaufbereitung\Output</EDKB07OutputFolder>
<UseTestMode>True</UseTestMode>
<TestParamFilePath>\\Pg2\d von pg2\ColdGen</TestParamFilePath>
<ParamFileOutputPath>D:\hgi\Projekte\Edex\Druckjobaufbereitung\Temp</ParamFileOutputPath>
<CMDFilePath>D:\hgi\Projekte\Edex\Druckjobaufbereitung\Temp</CMDFilePath>
<CMDFile1Content>dtacli -U[userid1]::[passwort1] -u[userid2]::[passwort2] -t1 -p64000 -T20 -L1 -I10 -fbinary -mp2p -itg602636::c:\cold\[filename] -otgcond01.tgkb.agi.ch::/ars/ftvmvs/tgkb/office/[filename]</CMDFile1Content>
<CMDFile2Content>dtacli -U[userid1]::[passwort1] -[userid2]::[passwort2] -t1 -p64000 -T20 -L1 -I10 -fbinary -mp2p -itg602636::c:\cold\dummy.txt -otgcond01.tgkb.agi.ch::/ars/ftvms/dummy.txt -We/usr/tngdts/bin/cmdsbant.cmd::"OUTPUT=YES PARMS=/ars/tgkb/scripts/tgkb_office_file_move [filename]""</CMDFile2Content>
</Configuration>

View File

@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EDKB07WS", "EDKB07WS.vbproj", "{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,207 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{06812C73-0D5D-4EFC-8792-7E257FE6FBD3}</ProjectGuid>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>EDKB07WS</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>WinExe</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>EDKB07WS</RootNamespace>
<StartupObject>EDKB07WS.Service1</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Console</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationVersion>2.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<BootstrapperEnabled>true</BootstrapperEnabled>
<OldToolsVersion>2.0</OldToolsVersion>
<ApplicationRevision>0</ApplicationRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>EDKB07WS.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>EDKB07WS.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>none</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="BMS, Version=2.0.4126.29238, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\EDKB10\BMS\BMSDll\bin\BMS.dll</HintPath>
</Reference>
<Reference Include="Common, Version=2.0.4126.29238, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\EDKB10\BMS\BMSDll\bin\Common.dll</HintPath>
</Reference>
<Reference Include="EDKB07Verarbeitung, Version=2.0.2950.29023, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\EDKB07Verarbeitung\bin\EDKB07Verarbeitung.dll</HintPath>
</Reference>
<Reference Include="Interop.Acrobat, Version=1.0.0.0, Culture=neutral" />
<Reference Include="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Configuration.Install">
<Name>System.Configuration.Install</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.ServiceProcess">
<Name>System.ServiceProcess</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<Compile Include="AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="clsLog.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datenbank\clsConnectionProvider.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datenbank\clsDBInteractionBase.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datenbank\clsJournal.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datenbank\clsJournaleintrag.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Globals.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Mehrfachdruck\clsMehrfachdruck_Data.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Mehrfachdruck\modMehrfachdruck.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="ModPrintjob.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="ProjectInstaller.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="RCVerarbeitung.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Service1.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="Verarbeitung.vb">
<SubType>Code</SubType>
</Compile>
<Content Include="EDKB07.xml" />
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.vb</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Service1.resx">
<DependentUpon>Service1.vb</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,69 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>
</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory>
</InstallUrlHistory>
<SupportUrlHistory>
</SupportUrlHistory>
<UpdateUrlHistory>
</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
</Project>

117
EDKB07WS/Backup1/Globals.vb Normal file
View File

@@ -0,0 +1,117 @@
Imports System.Reflection
Imports System.IO
Imports System.Xml
Module Globals
Public Office2010 As Boolean = True
Public sConnectionString As String
Public DruckjobParameter As String
Public DruckjobParameterAVQ As String
Public ColdOutputFolder As String
Public Deckblatt As String
Public Schlussblatt As String
Public TempPath As String
Public OutputFolder As String
Public conn_journale As New edokadb.clsConnectionProvider()
Public m_journalid As Long
Public sConnectionString_journale As String
Public UseTestMode As Boolean
Public TestParamFilePath As String
Public ParamFileOutputPath As String
Public CMDFilePath As String
Public CMDFile1Content As String
Public CMDFile2Content As String
Public DokPerPackage As Integer
Public Vorlagenverzeichnis As String
Public Workverzeichnis As String
Public psdir As String
Public PDFdir As String
Public PSPrinter As String
Public conn_edoka As New edokadb.clsConnectionProvider()
Public ofile As System.IO.File
Public oread As System.IO.StreamReader
'20071002 RGL: Parameter Workaround
Public ProcessToKill As String
Public ProcessIdleTime As Integer
Public OwnName As String
Public OtherBatch1 As String
Public OtherBatch2 As String
Public OtherBatch3 As String
Public NameDistiller As String
Public PathDistiller As String
Public OpenModeDistiller As String
'SHU 20120104
Public Beilage_1_ab As String
Public Beilage_2_ab As String
Public Beilage_3_ab As String
Public Beilage_1 As String
Public Beilage_2 As String
Public Beilage_3 As String
''RGL 29.1.08 Zusätzlicher Textlog für jeden einzelnen Schritt
'Public LogFileName As String
'Public Function ApplicationPath() As String
' 'Return Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
' Return Path.GetDirectoryName([Assembly].GetEntryAssembly().Location) + "\"
'End Function
Dim EVLog As New EventLog("Log_EDKB07")
'''<summary>Eintrag ins EventLog von EDKB07 schreiben</summary>
'''<param name="message"></param>
'''<param name="eventmessage"></param>
Public Sub PrintLog(ByVal message As String, Optional ByVal eventmessage As EventLogEntryType = EventLogEntryType.Information)
If Not EventLog.SourceExists("EDKB07") Then
EventLog.CreateEventSource("EDKB07", "EDKB07 Log")
End If
EVLog.Source = "EDKB07 Log"
EventLog.WriteEntry(EVLog.Source, message, eventmessage)
End Sub
''RGL 29.1.08 Zusätzlicher Textlog für jeden einzelnen Schritt
'Public Sub WriteTxtLog(ByVal msg As String)
' MsgBox("hallo")
' Try
' Dim writer As System.IO.StreamWriter
' Dim filetimestamp As String = Format(Now, "yyyyMMddHHmmss")
' writer = IO.File.AppendText(TempPath & "\" & LogFileName & ".log")
' writer.WriteLine(filetimestamp + ": " & msg)
' writer.Close()
' Catch ex As Exception
' 'Ganz übel wer hier landet, kann auch nicht geloggt werden
' End Try
'End Sub
#Region "BMS"
Public m_log As bms.Logging
#End Region
#Region " Cold Mehrfachdruck"
Public Global_md_Error As Integer = 0
Public Global_md_ColdMDOutputFolder As String
Public Global_md_TempFilePath As String
Public Global_md_EDKB07_MDOutputFolder As String
Public Global_md_ParamFileOutputPath As String
Public Global_md_CMDFilePath As String
Public Global_md_CMDFile1Content As String
Public Global_md_CMDFile2Content As String
Public Global_md_ParamCfgAvaloq As String
Public Global_md_ParamCfgEdoka As String
Public Global_md_ParamCfgHost As String
Public Global_md_ParamCfgZv As String
Public Global_md_MaxWaitTime As Integer 'Zeit in Minuten
Public Global_md_UseTestMode As Boolean 'True/False
#End Region
End Module

View File

@@ -0,0 +1,104 @@
Public Class clsMehrfachdruck_Data
Public Enum Enum_Typ
EDOKA = 1
HOST = 2
ZV = 3
End Enum
Dim m_DokumentId As String
Property DokumentId() As String
Get
Return m_DokumentId
End Get
Set(ByVal Value As String)
m_DokumentId = Value
End Set
End Property
Dim m_PartnerNr As String
Property PartnerNr() As String
Get
Return m_PartnerNr
End Get
Set(ByVal Value As String)
m_PartnerNr = Value
End Set
End Property
Dim m_Typ As Enum_Typ
Property Typ() As Enum_Typ
Get
Return m_Typ
End Get
Set(ByVal Value As Enum_Typ)
m_Typ = Value
End Set
End Property
Dim m_OfficeDokument As Boolean
Property OfficeDokument() As Boolean
Get
Return m_OfficeDokument
End Get
Set(ByVal Value As Boolean)
m_OfficeDokument = Value
End Set
End Property
Dim m_DokumentTyp As String
Property DokumentTyp() As String
Get
Return m_DokumentTyp
End Get
Set(ByVal Value As String)
m_DokumentTyp = Value
End Set
End Property
Dim m_Auftragnr As String
Property Auftragnr() As String
Get
Return m_Auftragnr
End Get
Set(ByVal Value As String)
m_Auftragnr = Value
End Set
End Property
Dim m_PartnerName As String
Property PartnerName() As String
Get
Return m_PartnerName
End Get
Set(ByVal Value As String)
m_PartnerName = Value
End Set
End Property
Dim m_Erstellungsdatum As String
Property Erstellungsdatum() As String
Get
Return m_Erstellungsdatum
End Get
Set(ByVal Value As String)
m_Erstellungsdatum = Value
End Set
End Property
Public Sub New(ByVal DokID As String, ByVal iPartnerNr As String, ByVal sTyp As Enum_Typ, _
ByVal bOfficeDokument As Boolean, ByVal sDokTyp As String, ByVal sAuftragnr As String, ByVal sPartnerName As String, _
ByVal sErstellungsdatum As String)
m_DokumentId = DokID
m_PartnerNr = iPartnerNr
m_Typ = sTyp
m_OfficeDokument = bOfficeDokument
m_DokumentTyp = sDokTyp
m_Auftragnr = sAuftragnr
m_PartnerName = sPartnerName
m_Erstellungsdatum = sErstellungsdatum
End Sub
End Class

View File

@@ -0,0 +1,227 @@
Imports System.Data.SqlClient
Imports System.IO
Imports System.Xml
Module modMehrfachdruck
#Region " Deklarationen"
#End Region
#Region " Funkionen und Subs"
Public Sub StartMehrfachDruck(ByVal userid As String, ByVal iJobID As Integer, ByVal dtData As DataTable, ByRef binOutput As Object)
Dim log As New clsLog
Try
Dim timestamp As String
Dim bError As Boolean
timestamp = Format(Now, "yyyyMMddHHmmss")
'DataTable in Collection umwandeln
Dim colData As New Collection
Dim row As DataRow
For Each row In dtData.Rows
colData.Add(New clsMehrfachdruck_Data(row.Item("DokumentId"), row.Item("PartnerNr"), _
row.Item("Typ"), row.Item("OfficeDokument"), row.Item("DokumentTyp"), row.Item("Auftragnr"), _
row.Item("PartnerName"), row.Item("Erstellungsdatum")))
Next
'TXT erstellen
gen_txtfile(userid, iJobID, colData, timestamp, bError)
'CMD erstellen und senden
'send_cmdfile(userid, timestamp, "00", iJobID, bError)
'Auf Datei warten
binOutput = WaitForFile(userid, timestamp, "00", iJobID, bError)
Catch ex As Exception
log.InsertJournale("EDKB07: Beim Warten auf das Cold-Mehrfachdokument " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & iJobID, clsLog.Enum_InfoTyp.Warnung)
End Try
End Sub
Private Sub gen_txtfile(ByVal userid As String, ByVal iJobID As Integer, ByVal colData As Collection, ByVal timestamp As String, ByRef bError As Boolean)
'Erstellt das txt File für den DruckJob
Dim log As New clsLog
Dim sFilename As String
Try
Dim i As Integer
Dim NewFile As Boolean = True
Dim owriter As System.IO.StreamWriter = Nothing
Dim Partno As String = "00"
Dim gendok As clsMehrfachdruck_Data
Dim snrpar00 As String = ""
Dim sDokumentNr As String
sFilename = userid & Partno & timestamp
For i = 1 To colData.Count
'Erstmals neue Datei erstellen
If NewFile Then
NewFile = False
'part = part + 1
'Partno = LTrim(Str(part))
'While Len(Partno) < 2
'Partno = "0" + Partno
'End While
owriter = File.CreateText(Global_md_ParamFileOutputPath & sFilename & ".123")
End If
gendok = colData(i)
'Dokumente nummerieren
sDokumentNr = i.ToString.Trim
While Len(sDokumentNr) < 3
sDokumentNr = "0" + sDokumentNr
End While
'Partner Nummer auslesen
Try
snrpar00 = gendok.PartnerNr
Catch ex As Exception
m_log.Log("modMehrfachdruck:gen_txtfile:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
''''NOVA!
'While Len(snrpar00) < 9
'snrpar00 = "0" + snrpar00
'End While
Dim sDokumentID As String = gendok.DokumentId
Select Case gendok.Typ
Case clsMehrfachdruck_Data.Enum_Typ.EDOKA
owriter.WriteLine(ParsParamDfg(Global_md_ParamCfgEdoka, snrpar00, gendok, sFilename, sDokumentNr))
Case clsMehrfachdruck_Data.Enum_Typ.HOST
If Len(snrpar00) = 9 Then
owriter.WriteLine(ParsParamDfg(Global_md_ParamCfgHost, snrpar00, gendok, sFilename, sDokumentNr))
Else
owriter.WriteLine(ParsParamDfg(Global_md_ParamCfgAvaloq, snrpar00, gendok, sFilename, sDokumentNr))
End If
Case clsMehrfachdruck_Data.Enum_Typ.ZV
owriter.WriteLine(ParsParamDfg(Global_md_ParamCfgZv, snrpar00, gendok, sFilename, sDokumentNr))
End Select
Next
owriter.Close()
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler bei der Erstellung des TXT-Files (Mehrfachdruck) " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & iJobID, clsLog.Enum_InfoTyp.Warnung)
bError = True
Finally
Rename(Global_md_ParamFileOutputPath & sFilename & ".123", Global_md_ParamFileOutputPath & sFilename & ".txt")
log = Nothing
End Try
End Sub
Private Function ParsParamDfg(ByVal sOrgString As String, ByVal snrpar00 As String, ByVal gendok As clsMehrfachdruck_Data, ByVal sFilename As String, ByVal sDokumentNr As String) As String
ParsParamDfg = ""
'Parsing Parameter
'##PartnerNR## = Partner Nummer
'##DokID## = Dokument ID
'##DokTyp## = Dokumenttyp
'##AuftragNr## = Auftrag-Nr
'##Paginator## = Paginator
'##FileName## = Dateiname
Try
'Partner Nummer
ParsParamDfg = sOrgString.Replace("##PartnerNR##", snrpar00)
'Dokument ID
ParsParamDfg = ParsParamDfg.Replace("##DokID##", gendok.DokumentId)
'DokumentTyp
If gendok.Typ = clsMehrfachdruck_Data.Enum_Typ.ZV Then
ParsParamDfg = ParsParamDfg.Replace("##DokTyp##", gendok.DokumentTyp.Substring(0, 6))
Else
ParsParamDfg = ParsParamDfg.Replace("##DokTyp##", gendok.DokumentTyp)
End If
'AuftragsNr
ParsParamDfg = ParsParamDfg.Replace("##AuftragNr##", gendok.Auftragnr)
'PaginatorNr
ParsParamDfg = ParsParamDfg.Replace("##Paginator##", gendok.DokumentId)
'FileName
ParsParamDfg = ParsParamDfg.Replace("##FileName##", sFilename + sDokumentNr)
Catch ex As Exception
m_log.Log("modMehrfachdruck:ParsParakDfg:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Function
'Private Sub send_cmdfile(ByVal userid As String, ByVal timestamp As String, ByVal partno As String, ByVal jobid As Integer, ByRef bError As Boolean)
' 'Erstellt das CMD-File mit den Übertragungs-Parameter und führt dieses aus.
' Dim log As New clsLog
' Try
' Dim owriter As System.IO.StreamWriter
' Dim scmd As String
' Dim i As Integer
' owriter = File.CreateText(Global_md_CMDFilePath & userid & partno & timestamp & ".cmd")
' 'Command 1
' scmd = Global_md_CMDFile1Content.Replace("xfilenamex", userid & partno & timestamp & ".txt")
' scmd = scmd.Replace("xfilenameohneendungx", userid & partno & timestamp)
' owriter.WriteLine(scmd)
' 'Command 2
' scmd = Global_md_CMDFile2Content.Replace("xfilenamex", userid & partno & timestamp & ".txt")
' scmd = scmd.Replace("xfilenameohneendungx", userid & partno & timestamp)
' owriter.WriteLine(scmd)
' owriter.Close()
' owriter = Nothing
' If Not Global_md_UseTestMode Then
' i = Shell(Global_md_CMDFilePath & userid & partno & timestamp & ".cmd", AppWinStyle.NormalFocus, True, 120000)
' Threading.Thread.Sleep(3000)
' log.InsertJournale("EDKB07: Parameterfile Mehrfachdruck per DTO an Cold übergeben " & CType(Now, String) & " DruckjobID: " & jobid, clsLog.Enum_InfoTyp.Keine)
' End If
' Catch ex As Exception
' log.InsertJournale("EDKB07: Fehler bei Übergabe des Parameterfiles Mehrfachdruck an Cold " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & jobid, clsLog.Enum_InfoTyp.Warnung)
' bError = True
' Finally
' log = Nothing
' End Try
'End Sub
Private Function WaitForFile(ByVal userid As String, ByVal timestamp As String, ByVal partno As String, ByVal jobid As Integer, ByRef bError As Boolean) As Object
WaitForFile = Nothing
'Wartet auf das PDF File
Dim log As New clsLog
If bError = True Then
log.InsertJournale("EDKB07: Beim Anfordern ist ein Fehler aufgetreten " & CType(Now, String) + " DruckjobID: " & jobid, clsLog.Enum_InfoTyp.Keine)
Exit Function
End If
Try
Dim dStartZeit As DateTime
Dim icnt As Integer = 1
dStartZeit = Now()
Do While Microsoft.VisualBasic.DateDiff(DateInterval.Minute, dStartZeit, Now()) < Global_md_MaxWaitTime
If File.Exists(Global_md_ParamFileOutputPath & userid & partno & timestamp & ".ret") Then
If File.Exists(Global_md_ParamFileOutputPath & userid & partno & timestamp & ".pdf") Then
Dim fs As New FileStream(Global_md_ColdMDOutputFolder + userid & partno & timestamp & ".pdf", FileMode.OpenOrCreate, FileAccess.Read)
Threading.Thread.Sleep(1000)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
fs = Nothing
WaitForFile = MyData
Exit Do
End If
End If
If File.Exists(Global_md_ParamFileOutputPath & userid & partno & timestamp & ".FAILED") Then
log.InsertJournale("EDKB07: FAILED Rückmeldung: " & CType(Now, String) & " - Benutzer: " & userid & " DruckjobID: " & jobid, clsLog.Enum_InfoTyp.Warnung)
Exit Do
End If
Threading.Thread.Sleep(1000)
Loop
Catch ex As Exception
log.InsertJournale("EDKB07: Beim Warten auf das Cold-Mehrfachdokument " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & jobid, clsLog.Enum_InfoTyp.Warnung)
bError = True
Finally
log = Nothing
End Try
End Function
#End Region
End Module

View File

@@ -0,0 +1,618 @@
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.IO
Imports Microsoft.Office.Interop
Module ModPrintjob
'Dim objword As New Microsoft.Office.Interop.Word.ApplicationClass()
'Dim objword As New Word.ApplicationClass()
'Dim docword As New Word.DocumentClass()
Dim objword As New Word.Application()
Dim docword As New Word.Document()
Dim alnr As Integer
Dim TmpData As New DataTable()
Dim Dokumentname_Dokumente As String
Dim Dokumentname_Quittung As String
Dim Dokumentname_Quittung_PS As String
Dim Dokumentname_Quittung_PDF As String
Dim Dokumentname_Summary As String
Dim Dokumentname_Summary_PS As String
Dim Dokumentname_Summary_PDF As String
Dim Dokumentname_Startblatt As String
Dim Dokumentname_Schlussblatt As String
Dim Dokumentname_Startblatt_PDF As String
Dim Dokumentname_Schlussblatt_PDF As String
Dim Dokumentname_Dokumente_PDF As String
Dim DokPrefix As String
Dim dokumentid As String
Dim FileExtension As String = ""
Function Print_Docs(ByVal intalnr As Integer, ByVal partno As Integer) As Boolean
Try
alnr = intalnr
TmpData = Get_ALDaten(alnr)
dokumentid = TmpData.Rows(0).Item("dokumentid_quittung")
Dim tmpfn As String = Get_Filename(dokumentid)
Dim extension As String = Right(tmpfn, 5)
extension = UCase(extension)
FileExtension = extension
Select Case extension
Case ".DOCX"
Dokumentname_Quittung = DokPrefix + "_" + dokumentid + ".docx"
Dokumentname_Summary = DokPrefix + "_" + dokumentid + "_Su.docx"
Case ".DOTX"
Dokumentname_Quittung = DokPrefix + "_" + dokumentid + ".dotx"
Dokumentname_Summary = DokPrefix + "_" + dokumentid + "_Su.dotx"
Case ".DOTM"
Dokumentname_Quittung = DokPrefix + "_" + dokumentid + ".dotm"
Dokumentname_Summary = DokPrefix + "_" + dokumentid + "_Su.dotm"
Case ".DOCM"
Dokumentname_Quittung = DokPrefix + "_" + dokumentid + ".docm"
Dokumentname_Summary = DokPrefix + "_" + dokumentid + "_Su.docm"
Case Else
Dokumentname_Quittung = DokPrefix + "_" + dokumentid + ".doc"
Dokumentname_Summary = DokPrefix + "_" + dokumentid + "_Su.doc"
End Select
DokPrefix = Format(Now, "yyyyMMddHHmmss")
Dokumentname_Quittung_PS = DokPrefix + "_" + dokumentid + ".ps"
Dokumentname_Quittung_PDF = DokPrefix + "_" + dokumentid + ".pdf"
Dokumentname_Summary_PS = DokPrefix + "_" + dokumentid + "_Su.ps"
Dokumentname_Summary_PDF = DokPrefix + "_" + dokumentid + "_Su.pdf"
Dokumentname_Startblatt_PDF = DokPrefix + "_" + dokumentid + "_DB.pdf"
Dokumentname_Schlussblatt_PDF = DokPrefix + "_" + dokumentid + "_SB.pdf"
Dokumentname_Dokumente_PDF = DokPrefix + "_" + dokumentid + "_docs.pdf"
Dokumente_Bereitstellen(partno)
StartWord()
PrintLog("Generate Quittung:" + alnr.ToString + ":" + partno.ToString, EventLogEntryType.Information)
Generate_Quittung(alnr, partno)
Dim i As Integer
If partno = 0 Then
For i = 1 To 50
If File.Exists(PDFdir + Dokumentname_Quittung_PDF) And File.Exists(PDFdir + Dokumentname_Summary_PDF) Then
Exit For
End If
Threading.Thread.Sleep(1000)
Next
Else
For i = 1 To 50
If File.Exists(PDFdir + Dokumentname_Summary_PDF) Then
Exit For
End If
Threading.Thread.Sleep(1000)
Next
End If
Generate_PDF(partno)
SavePdf(partno)
File.Delete(Workverzeichnis + Dokumentname_Summary)
File.Delete(Workverzeichnis + Dokumentname_Summary_PDF)
File.Delete(Workverzeichnis + Dokumentname_Quittung)
File.Delete(Workverzeichnis + Dokumentname_Quittung_PDF)
File.Delete(Workverzeichnis + Dokumentname_Schlussblatt_PDF)
File.Delete(Workverzeichnis + Dokumentname_Startblatt_PDF)
File.Delete(PDFdir + Dokumentname_Summary_PDF)
File.Delete(PDFdir + Dokumentname_Summary_PS)
File.Delete(PDFdir + Dokumentname_Quittung_PDF)
File.Delete(PDFdir + Dokumentname_Quittung_PS)
File.Delete(Workverzeichnis + Dokumentname_Dokumente_PDF)
File.Delete(Workverzeichnis + "Done_" + Dokumentname_Dokumente_PDF)
Return True
Catch ex As Exception
Globals.PrintLog("Printjob:" + LTrim(Str(alnr)) + ":" + ex.Message)
m_log.Log("ModPrintJob:Print_Docs:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return False
End Try
End Function
Private Sub SavePdf(ByVal partno As Integer)
If partno = 0 Then
Dim con As New SqlConnection(Globals.sConnectionString)
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob where druckjobnr=" + Trim(Str(TmpData.Rows(0).Item("druckjobnr"))), con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
Dim fs As New FileStream(Workverzeichnis + "Done_" + Dokumentname_Dokumente_PDF, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
con.Open()
da.Fill(ds, "edex_bl_druckjob")
Dim myRow As DataRow
myRow = ds.Tables("edex_bl_druckjob").Rows(0)
myRow("pdfdokument_aufbereitet") = MyData
da.Update(ds, "edex_bl_druckjob")
fs = Nothing
MyCB = Nothing
ds = Nothing
da = Nothing
con.Close()
con = Nothing
Else
Dim con As New SqlConnection(Globals.sConnectionString)
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob_part where druckjobnr=" + Trim(Str(TmpData.Rows(0).Item("druckjobnr"))) + " and partno=" + LTrim(Str(partno)), con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
Dim fs As New FileStream(Workverzeichnis + "Done_" + Dokumentname_Dokumente_PDF, FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
con.Open()
da.Fill(ds, "edex_bl_druckjob_part")
Dim myRow As DataRow
myRow = ds.Tables("edex_bl_druckjob_part").Rows(0)
myRow("pdfdokument_aufbereitet") = MyData
da.Update(ds, "edex_bl_druckjob_part")
fs = Nothing
MyCB = Nothing
ds = Nothing
da = Nothing
con.Close()
con = Nothing
End If
End Sub
Private Sub Dokumente_Bereitstellen(ByVal partno As Integer)
'FileCopy(Vorlagenverzeichnis + "Startblatt.pdf", Workverzeichnis + Dokumentname_Startblatt_PDF)
'Anpassung Cutover 01.08.2008 - Werbeversand für BL Kunen
If check_Werbung(alnr) Then
FileCopy(Vorlagenverzeichnis + "StartblattWerbung.pdf", Workverzeichnis + Dokumentname_Startblatt_PDF)
Else
FileCopy(Vorlagenverzeichnis + "Startblatt.pdf", Workverzeichnis + Dokumentname_Startblatt_PDF)
End If
FileCopy(Vorlagenverzeichnis + "Schlussblatt.pdf", Workverzeichnis + Dokumentname_Schlussblatt_PDF)
Select Case FileExtension
Case ".DOCX"
FileCopy(Vorlagenverzeichnis + "SummaryLyt.docx", Workverzeichnis + Dokumentname_Summary)
Case ".DOTX"
FileCopy(Vorlagenverzeichnis + "SummaryLyt.dotx", Workverzeichnis + Dokumentname_Summary)
Case ".DOTM"
FileCopy(Vorlagenverzeichnis + "SummaryLyt.dotx", Workverzeichnis + Dokumentname_Summary)
Case ".DOCM"
FileCopy(Vorlagenverzeichnis + "SummaryLyt.docm", Workverzeichnis + Dokumentname_Summary)
Case Else
FileCopy(Vorlagenverzeichnis + "SummaryLyt.doc", Workverzeichnis + Dokumentname_Summary)
End Select
Get_Quittung()
Get_Dokumente(partno)
End Sub
Private Function Get_Quittung() As Boolean
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("Select * From doks where DokumentID='" + dokumentid + "'", 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(1)
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(Workverzeichnis + Dokumentname_Quittung, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Catch ex As Exception
m_log.Log("ModPrintJob:Get_Quittung:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return False
End Try
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
Return True
End Function
Private Function Get_Dokumente(ByVal partno As Integer) As Boolean
If partno = 0 Then
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob where druckjobnr=" + LTrim(Str(TmpData.Rows(0).Item("Druckjobnr"))), 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("pdfdokument")
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(Workverzeichnis + Dokumentname_Dokumente_PDF, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Catch ex As Exception
m_log.Log("ModPrintJob:Get_Dokumente:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return False
End Try
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
Else
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob_part where druckjobnr=" + LTrim(Str(TmpData.Rows(0).Item("Druckjobnr"))) + " and partno=" + LTrim(Str(partno)), 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("pdfdokument")
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(Workverzeichnis + Dokumentname_Dokumente_PDF, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Catch ex As Exception
m_log.Log("ModPrintJob:Get_Dokumente:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return False
End Try
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
End If
Return True
End Function
Private Sub Generate_Quittung(ByVal alnr As Integer, ByVal partno As Integer)
If partno = 0 Then
objword.Documents.Open(Workverzeichnis + Dokumentname_Quittung)
objword.Visible = True
'objword.WindowState = Word.WdWindowState.wdWindowStateMinimize
docword = objword.ActiveDocument
If Globals.Office2010 = True Then
Try
' docword.ExportAsFixedFormat(PDFdir + Dokumentname_Quittung_PDF, Word.WdExportFormat.wdExportFormatPDF)
docword.ExportAsFixedFormat(PDFdir + Dokumentname_Quittung_PDF, Word.WdExportFormat.wdExportFormatPDF, , Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Word.WdExportRange.wdExportAllDocument, , , Word.WdExportItem.wdExportDocumentContent, True, True, Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, True, False, False)
Threading.Thread.CurrentThread.Sleep(1000)
Catch ex As Exception
PrintLog(ex.Message, EventLogEntryType.Information)
End Try
Else
objword.ActivePrinter = PSPrinter
docword.PrintOut(OutputFileName:=psdir + Dokumentname_Quittung_PS, PrintToFile:=False, Copies:=1)
End If
docword.Saved = True
docword.Close(SaveChanges:=False)
End If
Dim i As Integer
Dim f3 As Acrobat.CAcroPDDoc
f3 = CreateObject("AcroExch.PDDoc")
PrintLog(Workverzeichnis + Dokumentname_Dokumente_PDF, EventLogEntryType.Information)
i = f3.Open(Workverzeichnis + Dokumentname_Dokumente_PDF)
objword.Documents.Open(Workverzeichnis + Dokumentname_Summary)
objword.Visible = True
docword = objword.ActiveDocument
Try
docword.Bookmarks.Item("Besteller").Select()
objword.Selection.Text = TmpData.Rows(0).Item("Besteller")
docword.Bookmarks.Item("Partner").Select()
objword.Selection.Text = Trim(Str(TmpData.Rows(0).Item("nrpar00")) + " " + TmpData.Rows(0).Item("bkpar00"))
docword.Bookmarks.Item("AnzahlDokumente").Select()
objword.Selection.Text = Trim(Str(TmpData.Rows(0).Item("anzahl_dokument")))
docword.Bookmarks.Item("AnzahlSeiten").Select()
objword.Selection.Text = Trim(Str(f3.GetNumPages))
docword.Bookmarks.Item("DatumZeit").Select()
objword.Selection.Text = Now.ToShortDateString + " " + Now.ToShortTimeString
docword.Bookmarks.Item("AnzahlVertraege").Select()
objword.Selection.Text = Get_Anzahl_Vertraege(alnr)
If TmpData.Rows(0).Item("Anzparts") > 0 Then
docword.Bookmarks.Item("AnzahlTeile").Select()
objword.Selection.Text = "Teil " + LTrim(Str(partno + 1)) + " von " + LTrim(Str(TmpData.Rows(0).Item("anzparts") + 1))
docword.Bookmarks.Item("Teil1").Select()
objword.Selection.Text = "(Total über alle Druckteile)"
docword.Bookmarks.Item("Teil2").Select()
objword.Selection.Text = "(Total über alle Druckteile)"
End If
Catch ex As Exception
m_log.Log("ModPrintJob:Generate_Quittung:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Finally
f3.Close()
f3 = Nothing
End Try
If Globals.Office2010 = True Then
docword.ExportAsFixedFormat(PDFdir + Dokumentname_Summary_PDF, Word.WdExportFormat.wdExportFormatPDF, , Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Word.WdExportRange.wdExportAllDocument, , , Word.WdExportItem.wdExportDocumentContent, True, True, Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, True, False, False)
' docword.ExportAsFixedFormat(PDFdir + Dokumentname_Summary_PDF, Word.WdExportFormat.wdExportFormatPDF)
Threading.Thread.CurrentThread.Sleep(1000)
Else
objword.ActivePrinter = PSPrinter
docword.PrintOut(OutputFileName:=psdir + Dokumentname_Summary_PS, PrintToFile:=False, Copies:=1)
End If
docword.Close(SaveChanges:=False)
objword = Nothing
End Sub
Private Sub Generate_PDF(ByVal partno As Integer)
Dim f1 As Acrobat.CAcroPDDoc
Dim f2 As Acrobat.CAcroPDDoc
Dim f3 As Acrobat.CAcroPDDoc
Dim f4 As Acrobat.CAcroPDDoc
Dim f5 As Acrobat.CAcroPDDoc
f1 = CreateObject("AcroExch.PDDoc")
f2 = CreateObject("AcroExch.PDDoc")
f3 = CreateObject("AcroExch.PDDoc")
f4 = CreateObject("AcroExch.PDDoc")
f5 = CreateObject("AcroExch.PDDoc")
Dim i As Integer
i = f1.Open(Workverzeichnis + Dokumentname_Schlussblatt_PDF)
If IsDate(Globals.Beilage_1_ab) Then
If IO.File.Exists(Globals.Beilage_1) Then
If check_Beilage(alnr, Globals.Beilage_1_ab) Then
Dim fbeilage As Acrobat.CAcroPDDoc
fbeilage = CreateObject("AcroExch.PDDoc")
fbeilage.Open(Globals.Beilage_1)
i = f1.InsertPages(-1, fbeilage, 0, fbeilage.GetNumPages, 1)
fbeilage.Close()
End If
End If
End If
If IsDate(Globals.Beilage_2_ab) Then
If IO.File.Exists(Globals.Beilage_2) Then
If check_Beilage(alnr, Globals.Beilage_2_ab) Then
Dim fbeilage As Acrobat.CAcroPDDoc
fbeilage = CreateObject("AcroExch.PDDoc")
fbeilage.Open(Globals.Beilage_2)
i = f1.InsertPages(-1, fbeilage, 0, fbeilage.GetNumPages, 1)
fbeilage.Close()
End If
End If
End If
If IsDate(Globals.Beilage_3_ab) Then
If IO.File.Exists(Globals.Beilage_3) Then
If check_Beilage(alnr, Globals.Beilage_3_ab) Then
Dim fbeilage As Acrobat.CAcroPDDoc
fbeilage = CreateObject("AcroExch.PDDoc")
fbeilage.Open(Globals.Beilage_3)
i = f1.InsertPages(-1, fbeilage, 0, fbeilage.GetNumPages, 1)
fbeilage.Close()
End If
End If
End If
i = f2.Open(Workverzeichnis + Dokumentname_Dokumente_PDF)
i = f3.Open(PDFdir + Dokumentname_Summary_PDF)
If partno = 0 Then
i = f4.Open(PDFdir + Dokumentname_Quittung_PDF)
End If
i = f5.Open(Workverzeichnis + Dokumentname_Startblatt_PDF)
i = f1.InsertPages(-1, f2, 0, f2.GetNumPages, 1)
i = f1.InsertPages(-1, f3, 0, f3.GetNumPages, 1)
If partno = 0 Then
i = f1.InsertPages(-1, f4, 0, f4.GetNumPages, 1)
End If
'i = f1.InsertPages(-1, f5, 0, 1, 1)
'Anpassung MNK - Cutover 01.08.2008 BL-Beilagen
i = f1.InsertPages(-1, f5, 0, f5.GetNumPages, 1)
i = f1.Save(Acrobat.PDSaveFlags.PDSaveFull, Workverzeichnis + "Done_" + Dokumentname_Dokumente_PDF)
'i = f1.Save(Acrobat.PDDocFlags.PDDocOldVersion, Workverzeichnis + "Done_" + Dokumentname_Dokumente_PDF)
f1.Close()
f2.Close()
f3.Close()
f4.Close()
f5.Close()
f1 = Nothing
f2 = Nothing
f3 = Nothing
f4 = Nothing
f5 = Nothing
'System.Runtime.InteropServices.Marshal.ReleaseComObject(f1)
End Sub
#Region "Datenzugriffe"
Public Function Get_ALDaten(ByVal alnr As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.SP_edex_bl_get_aldaten"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@alnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alnr))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Try
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()
Globals.conn_edoka.CloseConnection(True)
End Try
End Function
Public Function Get_Filename(ByVal DokId As String) As String
Dim result As String = ""
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "Select dokumentname from dokument where dokumentid='" + DokId + "'"
scmCmdToExecute.CommandType = CommandType.Text
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@alnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alnr))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Try
sdaAdapter.Fill(dtToReturn)
result = dtToReturn.Rows(0).Item(0)
Catch ex As Exception
result = "error.doc"
' // 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()
Globals.conn_edoka.CloseConnection(True)
End Try
Return result
End Function
Public Function Get_Anzahl_Vertraege(ByVal alnr As Integer) As String
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.SP_edex_bl_get_anzahl_vertraege"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@alnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@anzahl", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Try
sdaAdapter.Fill(dtToReturn)
Return LTrim(Str(scmCmdToExecute.Parameters("@anzahl").Value))
Catch ex As Exception
m_log.Log("ModPrintJob:Get_Anzahl_Vertraege:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return "?"
' // 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()
Globals.conn_edoka.CloseConnection(True)
End Try
End Function
''' <summary>
''' Methode, welche prueft ob der Aushaendigung Werbung beigelegt werden soll
''' </summary>
''' <param name="alnr"></param>
''' <returns>boolean</returns>
''' <remarks></remarks>
Private Function check_Werbung(ByVal alnr As Integer) As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_check_Werbung"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@alnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@werbung", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Dim returnValue As Boolean
returnValue = False
Try
sdaAdapter.Fill(dtToReturn)
If scmCmdToExecute.Parameters("@werbung").Value > 0 Then
returnValue = True
End If
Catch ex As Exception
m_log.Log("ModPrintJob:check_Werbung:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
Globals.conn_edoka.CloseConnection(True)
End Try
Return returnValue
End Function
Private Function check_Beilage(ByVal alnr As Integer, ByVal beilagedatum As String) As Boolean
If beilagedatum > Now Then
Return False
Exit Function
End If
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_check_beilage"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@alnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@beilagedatum", SqlDbType.VarChar, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, beilagedatum))
scmCmdToExecute.Parameters.Add(New SqlParameter("@Beilage", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Dim returnValue As Boolean
returnValue = False
Try
sdaAdapter.Fill(dtToReturn)
If scmCmdToExecute.Parameters("@Beilage").Value > 0 Then
returnValue = True
End If
Catch ex As Exception
m_log.Log("ModPrintJob:check_Beilage:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
Globals.conn_edoka.CloseConnection(True)
End Try
Return returnValue
End Function
#End Region
#Region "Office Funktionen"
Public Sub StartWord()
'Auskommentiert durch MNK 20080902 - Sinnlos - kann nicht genutzt werden
'Try
' Kill("WINWORD")
'Catch ex As Exception
' m_log.Log("ModPrintJob:StartWord_Kill:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
'End Try
Try
objword = GetObject(, "Word.application")
objword.Visible = False
Catch ex As Exception
m_log.Log("ModPrintJob:StartWord_GetObject:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Try
objword = CreateObject("Word.application")
objword.Visible = False
Catch ex1 As Exception
m_log.Log("ModPrintJob:StartWord_CreateObject:" + ex1.Message + ex1.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Try
End Sub
#End Region
End Module

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ServiceProcessInstaller1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceProcessInstaller1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
<data name="ServiceInstaller1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceInstaller1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>188, 17</value>
</data>
<data name="$this.Name">
<value>ProjectInstaller</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>

View File

@@ -0,0 +1,66 @@
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> Public Class ProjectInstaller
Inherits System.Configuration.Install.Installer
#Region " Vom Component Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf ist für den Komponenten-Designer erforderlich.
InitializeComponent()
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
End Sub
'Installer überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Für Komponenten-Designer erforderlich
Private components As System.ComponentModel.IContainer
'HINWEIS: Die folgende Prozedur ist für den Komponenten-Designer erforderlich
'Sie kann mit dem Komponenten-Designer modifiziert werden.
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
Friend WithEvents ServiceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstaller
Friend WithEvents ServiceInstaller1 As System.ServiceProcess.ServiceInstaller
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ServiceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller()
Me.ServiceInstaller1 = New System.ServiceProcess.ServiceInstaller()
'
'ServiceProcessInstaller1
'
Me.ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalService
Me.ServiceProcessInstaller1.Password = "galant"
Me.ServiceProcessInstaller1.Username = "PG1\geuggis"
'
'ServiceInstaller1
'
Me.ServiceInstaller1.ServiceName = "EDKB07WS"
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller1, Me.ServiceInstaller1})
End Sub
#End Region
Private Sub ServiceInstaller1_AfterInstall(ByVal sender As System.Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles ServiceInstaller1.AfterInstall
End Sub
Private Sub ServiceProcessInstaller1_AfterInstall(ByVal sender As System.Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles ServiceProcessInstaller1.AfterInstall
End Sub
End Class

View File

@@ -0,0 +1,408 @@
Imports System.Data.SqlClient
Imports System.IO
Imports System.Xml
Public NotInheritable Class RCVerarbeitung
Inherits MarshalByRefObject
Implements EDKB07Verarbeitung.EDKB07Verarbeitung.IEDKB07
Dim part As Integer = -1
Public Sub GetDocBLPDF(ByVal DruckjobID As Integer) Implements EDKB07Verarbeitung.EDKB07Verarbeitung.IEDKB07.GetDocBLPDF
''RGL 29.1.08 Zusätzlicher Textlog für jeden einzelnen Schritt
'Globals.LogFileName = CStr(DruckjobID)
Dim filetimestamp As String = Format(Now, "yyyyMMddHHmmss")
' Globals.WriteTxtLog("Start Klasse RCVerarbeitung, Methode GetDocBLPDF, Remotaufruf ist erfolgt, schreibe Journaleintrag Start")
Dim log As New clsLog
log.InsertJournale("EDKB07: Start Remotingaufruf " & CType(Now, String) & " DruckjobID: " & DruckjobID, clsLog.Enum_InfoTyp.Keine)
'20071002 RGL Workaround
' Globals.WriteTxtLog("Aufruf Word und Distiller vorbereiten (Workaround)")
PrepareWordandDistiller()
Dim userid As String = ""
Dim timestamp As String = ""
Dim erstelltam As Date
' Globals.WriteTxtLog("Vorbereitung SQL Verbindung")
Dim SqlConn As New SqlConnection
SqlConn.ConnectionString = Globals.sConnectionString
Dim SqlCmd As New SqlCommand
Dim DR As SqlDataReader
'Daten zu Druckjob aus DB lesen
SqlCmd.CommandText = "SP_EDEX_BL_GET_DRUCK_Parameter"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@ID", DruckjobID)
SqlCmd.Parameters.AddWithValue("@filetimestamp", filetimestamp)
SqlCmd.Connection = SqlConn
' Globals.WriteTxtLog("Vor SP_EDEX_BL_GET_DRUCK_Parameter")
Try
SqlConn.Open()
' Globals.WriteTxtLog("SQL Verbindung geöffnet")
DR = SqlCmd.ExecuteReader()
' Globals.WriteTxtLog("SP_EDEX_BL_GET_DRUCK_Parameter ausgeführt")
While DR.Read
userid = DR.Item("userid")
userid = UCase(userid)
' Globals.WriteTxtLog("Resultat erhalten, UserID = " & userid)
erstelltam = DR.Item("erstellt_am")
End While
SqlConn.Close()
' Globals.WriteTxtLog("SQL Verbindung geschlossen")
SqlCmd.Parameters.Clear()
'Timestamp für den Dateinamen zusammenstellen
timestamp = filetimestamp
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler beim Auslesen von UserID und Erstelltam-Datum " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & DruckjobID, clsLog.Enum_InfoTyp.Warnung)
End Try
' Globals.WriteTxtLog("Auslesen UserID und Erstellam-Datum fertig")
If Not Globals.UseTestMode Then
' Globals.WriteTxtLog("Nicht im Testmodus")
Dim anzdok As Integer = 0
Try
' Globals.WriteTxtLog("Vor CreatePrintjob")
anzdok = Create_Printjob(DruckjobID, timestamp, userid)
If anzdok > 0 Then
'log.InsertJournale("EDKB07: Parameterfile per DTO an Cold übergeben " & CType(Now, String) & " DruckjobID: " & DruckjobID, clsLog.Enum_InfoTyp.Keine)
' Globals.WriteTxtLog("Paramaterfile wurde an Cold übergeben")
Else
'log.InsertJournale("EDKB07: Parameterfile nicht an COLD übermittelt - keine Daten " & CType(Now, String) & " DruckjobID: " & DruckjobID, clsLog.Enum_InfoTyp.Keine)
' Globals.WriteTxtLog("Paramaterfile wurde NICHT an Cold übergeben da keine Daten gefunden")
End If
' Status setzen
' Globals.WriteTxtLog("Start Status setzen")
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_StatusByID"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 1)
SqlCmd.Parameters.AddWithValue("@ID", DruckjobID)
SqlCmd.Parameters.AddWithValue("@AnzParts", part)
SqlCmd.Connection = SqlConn
' Globals.WriteTxtLog("SQL Verbindung wird geöffnet")
SqlConn.Open()
' Globals.WriteTxtLog("SQL Verbindung ist geöffnet")
SqlCmd.ExecuteNonQuery()
' Globals.WriteTxtLog("SP_EDEX_BL_UPDATE_DRUCK_StatusByID wurde ausgeführt, Status=1, Druckjob=" & DruckjobID & ", Anzahl Teile=" & part)
SqlConn.Close()
' Globals.WriteTxtLog("SQL Verbindung ist geschlossen")
SqlCmd.Parameters.Clear()
Catch ex As Exception
' Globals.WriteTxtLog("Fehler in Klasse RCVerarbeitung, Methode GetDocBLPDF, catch erreicht")
log.InsertJournale("EDKB07: Fehler bei Übergabe des Parameterfiles an Cold " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & DruckjobID, clsLog.Enum_InfoTyp.Warnung)
'Status auf 'abvereckt' (3) ändern
'Globals.WriteTxtLog("vor Status auf 3 ändern")
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_StatusByID"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 3)
SqlCmd.Parameters.AddWithValue("@ID", DruckjobID)
SqlCmd.Parameters.AddWithValue("@AnzParts", part)
SqlCmd.Connection = SqlConn
' Globals.WriteTxtLog("SQL Verbindung wird geöffnet")
SqlConn.Open()
' Globals.WriteTxtLog("SQL Verbindung ist geöffnet")
SqlCmd.ExecuteNonQuery()
' Globals.WriteTxtLog("SP_EDEX_BL_UPDATE_DRUCK_StatusByID ausgeführt")
SqlConn.Close()
' Globals.WriteTxtLog("SQL Verbindung ist geschlossen")
SqlCmd.Parameters.Clear()
End Try
Else
' Globals.WriteTxtLog("Testmodus")
Dim owriter As System.IO.StreamWriter
' Globals.WriteTxtLog("Schreibe Information für Cold an andere Stelle: " & Globals.TestParamFilePath)
owriter = File.CreateText(Globals.TestParamFilePath & "\" & userid & "00" & timestamp & ".txt")
owriter.WriteLine("Test BL-Dokumentanforderung")
owriter.Close()
' Globals.WriteTxtLog("Ende Testmodus")
End If
' Globals.WriteTxtLog("Ende Methode GetDocBLPDF")
End Sub
Private Function Create_Printjob(ByVal druckjobid As Integer, ByVal timestamp As String, ByVal userid As String) As Integer
' Globals.WriteTxtLog("Start Methode Create_Printjob")
Dim log As New clsLog
Dim data As New DataTable
Dim Partno As String = ""
data = get_dokumente(druckjobid)
Dim anzdok As Integer = data.Rows.Count
Dim snrpar00 As String = ""
Dim c As Integer = 0
Dim i As Integer
Dim NewFile As Boolean = True
Dim owriter As System.IO.StreamWriter = Nothing
Try
For i = 0 To data.Rows.Count - 1
If NewFile Then
NewFile = False
part = part + 1
Partno = LTrim(Str(part))
While Len(Partno) < 2
Partno = "0" + Partno
End While
'Je nachdem ob das System im Testmodus läuft, das Parameterfile im entsprechenden Pfad ablegen
If Globals.UseTestMode Then
owriter = File.CreateText(Globals.TestParamFilePath & "\" & userid & Partno & timestamp & ".123")
Else
owriter = File.CreateText(Globals.ParamFileOutputPath & "\" & userid & Partno & timestamp & ".123")
End If
End If
Try
snrpar00 = data.Rows(i).Item("nrpar00")
Catch ex As Exception
m_log.Log("RCVerarbeitung:Create_Printjob:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
''''NOVA!!
'While Len(snrpar00) < 9
'snrpar00 = "0" + snrpar00
'End While
If data.Rows(i).Item("Typ") = 3 Then
'HOST ALT
If Len(snrpar00) > 8 Then
snrpar00 = "'" + snrpar00 + "'"
owriter.WriteLine(Globals.DruckjobParameter & " [-o Dok" & Format(i, "D5") & ".pdf] [-i where NRPAR00 = " & snrpar00 & " and NRDOK00 = '" & data.Rows(i).Item("dokumentid") & "']")
Else
'HOST NEU
snrpar00 = "'" + snrpar00 + "'"
owriter.WriteLine(Globals.DruckjobParameterAVQ & " [-o Dok" & Format(i, "D5") & ".pdf] [-i where BPKEYNRINHAB = " & snrpar00 & " and MAILINGID = '" & data.Rows(i).Item("dokumentid") & "']")
End If
Else
snrpar00 = "'" + snrpar00 + "'"
owriter.WriteLine(Globals.DruckjobParameter & " [-o Dok" & Format(i, "D5") & ".pdf] [-i where NRPAR00 = " & snrpar00 & " and NRDOC00 = '" & data.Rows(i).Item("dokumentid") & "']")
End If
c = c + 1
If c = Globals.DokPerPackage Then
If part > 0 Then insert_part(druckjobid, part, c)
c = 0
NewFile = True
owriter.Close()
'send_file(userid, timestamp, Partno, druckjobid)
End If
Next
owriter.Close()
If NewFile = False Then
If part > 0 Then insert_part(druckjobid, part, c)
'send_file(userid, timestamp, Partno, druckjobid)
data.Dispose()
End If
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler bei Create_Printjob " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & druckjobid, clsLog.Enum_InfoTyp.Warnung)
Finally
Try
Dim partRename As Integer
partRename = part
While partRename >= 0
Partno = LTrim(Str(partRename))
While Len(Partno) < 2
Partno = "0" + Partno
End While
If Globals.UseTestMode Then
Rename(Globals.TestParamFilePath & "\" & userid & Partno & timestamp & ".123", Globals.TestParamFilePath & "\" & userid & Partno & timestamp & ".txt")
Else
Rename(Globals.ParamFileOutputPath & "\" & userid & Partno & timestamp & ".123", Globals.TestParamFilePath & "\" & userid & Partno & timestamp & ".txt")
End If
partRename = partRename - 1
End While
Catch ex As Exception
m_log.Log("EDKB07: Fehler beim umbenennen " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & druckjobid, clsLog.Enum_InfoTyp.Warnung)
End Try
End Try
Return anzdok
End Function
'Private Sub send_file(ByVal userid As String, ByVal timestamp As String, ByVal partno As String, ByVal druckjobid As Integer)
' Dim log As New clsLog
' If Not Globals.UseTestMode Then
' Try
' Dim owriter As System.IO.StreamWriter
' owriter = File.CreateText(Globals.CMDFilePath & "\" & userid & partno & timestamp & ".cmd")
' Dim cmd1 As String
' cmd1 = Globals.CMDFile1Content.Replace("xfilenamex", userid & partno & timestamp & ".txt")
' owriter.WriteLine(cmd1)
' ' cmd2 = Globals.CMDFile2Content.Replace("xfilenamex", userid & timestamp & ".txt")
' ' owriter.WriteLine(cmd2)
' owriter.Close()
' owriter = Nothing
' Dim i As Integer
' i = Shell(Globals.CMDFilePath & "\" & userid & partno & timestamp & ".cmd", AppWinStyle.NormalFocus, True, 120000)
' Threading.Thread.Sleep(3000)
' 'File.Delete(Globals.CMDFilePath & "\" & userid & timestamp & ".cmd")
' log.InsertJournale("EDKB07: Parameterfile per DTO an Cold übergeben " & CType(Now, String) & " DruckjobID: " & druckjobid, clsLog.Enum_InfoTyp.Keine)
' Catch ex As Exception
' log.InsertJournale("EDKB07: Fehler bei Übergabe des Parameterfiles an Cold " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & druckjobid, clsLog.Enum_InfoTyp.Warnung)
' End Try
' End If
'End Sub
Private Function insert_part(ByVal druckjobid As Integer, ByVal part As Integer, ByVal anzdok As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_insert_druckjobpart"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@druckjobid", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, druckjobid))
scmCmdToExecute.Parameters.Add(New SqlParameter("@partno", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, part))
scmCmdToExecute.Parameters.Add(New SqlParameter("@anzahl_dokumente", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, anzdok))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Try
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()
Globals.conn_edoka.CloseConnection(True)
End Try
End Function
Private Function get_dokumente(ByVal druckjobid As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_EDEX_BL_GET_DRUCK_Dokumente"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Parameters.Add(New SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, druckjobid))
scmCmdToExecute.Connection = Globals.conn_edoka.scoDBConnection
Globals.conn_edoka.OpenConnection()
Try
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()
Globals.conn_edoka.CloseConnection(True)
End Try
End Function
Public Sub PrintJobF(ByVal alnr As Integer, ByVal partno As Integer) Implements EDKB07Verarbeitung.EDKB07Verarbeitung.IEDKB07.PrintJobF
Print_Docs(alnr, partno)
End Sub
Public Sub PrepareWordandDistiller()
If Globals.Office2010 = True Then Exit Sub
'20071002 RGL
Dim log As New clsLog
Dim proc As System.Diagnostics.Process
Dim plist() As Process
Dim counter1 As Integer = 0
'1. Suche ob bereits ein anderer EDKB07 Prozess läuft.
plist = Process.GetProcessesByName(Globals.OwnName)
For Each proc In plist
counter1 = counter1 + 1
If counter1 > 1 Then
Exit Sub
End If
Next
'2. Suche nach allen Word Instanzen die länger als X Minuten laufen, diese werden beendet.
plist = Process.GetProcessesByName(Globals.ProcessToKill)
For Each proc In plist
Try
If (proc.StartTime < (DateAdd(DateInterval.Minute, -CInt(Globals.ProcessIdleTime), Now()))) Then
log.InsertJournale("EDKB07: Beenden Prozess: " + CStr(proc.ProcessName), clsLog.Enum_InfoTyp.Keine)
proc.Kill()
End If
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler beim Killen von Programminstanz", clsLog.Enum_InfoTyp.Keine)
End Try
Next
'3. Prüfen ob andere Batches laufen, die den Distiller brauchen (EDKB09)
' - Suche nach Prozessname
If Trim(Globals.OtherBatch1) <> "" Then
plist = Process.GetProcessesByName(Globals.OtherBatch1)
For Each proc In plist
Exit Sub
Next
End If
If Trim(Globals.OtherBatch2) <> "" Then
plist = Process.GetProcessesByName(Globals.OtherBatch2)
For Each proc In plist
Exit Sub
Next
End If
If Trim(Globals.OtherBatch3) <> "" Then
plist = Process.GetProcessesByName(Globals.OtherBatch3)
For Each proc In plist
Exit Sub
Next
End If
'20071002 Distiller neu Starten
If Trim(Globals.NameDistiller) <> "" Then
plist = Process.GetProcessesByName(Globals.NameDistiller)
For Each proc In plist
Try
log.InsertJournale("EDKB07: Distiller Close", clsLog.Enum_InfoTyp.Information)
proc.Close() 'Variante1 mit CLOSE
Threading.Thread.Sleep(2000)
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler beim Regulären Beenden der Distiller Instanz", clsLog.Enum_InfoTyp.Keine)
End Try
Next
End If
If Trim(Globals.NameDistiller) <> "" Then
plist = Process.GetProcessesByName(Globals.NameDistiller)
For Each proc In plist
Try
log.InsertJournale("EDKB07: Distiller Kill", clsLog.Enum_InfoTyp.Keine)
proc.Kill() 'Variante 2 mit KILL
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler beim Killen der Distiller Instanz", clsLog.Enum_InfoTyp.Keine)
End Try
Next
End If
Try
If UCase(Globals.OpenModeDistiller) = "TRUE" Then
log.InsertJournale("EDKB07: Distiller Start", clsLog.Enum_InfoTyp.Keine)
Shell(Globals.PathDistiller, AppWinStyle.NormalNoFocus, True)
Else
log.InsertJournale("EDKB07: Distiller Start", clsLog.Enum_InfoTyp.Keine)
Shell(Globals.PathDistiller, AppWinStyle.NormalNoFocus, False)
End If
Catch ex As Exception
log.InsertJournale("EDKB07: Fehler beim Start von Distiller", clsLog.Enum_InfoTyp.Keine)
End Try
End Sub
#Region " Cold-Mehrfachdruck"
Public Sub GetColdMehrfachDruck(ByVal sTGNummer As String, ByVal iJobID As Integer, ByVal colData As Object, ByRef binOutput As Object) Implements EDKB07Verarbeitung.EDKB07Verarbeitung.IEDKB07.GetColdMehrfachDruck
'Aufbereiten des Mehrfachdrucks
Dim log As New clsLog
Try
log.InsertJournale("EDKB07: Mehrfachdruck von " & sTGNummer & " angefordert " & CType(Now, String) + " DruckjobID: " & iJobID, clsLog.Enum_InfoTyp.Keine)
StartMehrfachDruck(sTGNummer, iJobID, colData, binOutput)
log.InsertJournale("EDKB07: Mehrfachdruck von " & sTGNummer & " angeschlossen " & CType(Now, String) + " DruckjobID: " & iJobID, clsLog.Enum_InfoTyp.Keine)
Catch ex As Exception
log.InsertJournale("EDKB07: Mehrfachdruck Allg. Fehler: " & CType(Now, String) & " Error: " & ex.Message & " DruckjobID: " & iJobID, clsLog.Enum_InfoTyp.Warnung)
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="ResMimeType">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="Version">
<value>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,431 @@
Imports System.ServiceProcess
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Xml
Imports System.Data.SqlClient
Imports System.IO
Imports System.Reflection
Public Class Service1
Inherits System.ServiceProcess.ServiceBase
#Region " Vom Component Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf wird vom Komponenten-Designer benötigt.
InitializeComponent()
' Fügen Sie Initialisierungscode hinter dem InitializeComponent()-Aufruf ein
End Sub
'UserService überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Der Haupteinstiegspunkt für den Vorgang
<MTAThread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' Innerhalb desselben Prozesses können mehrere NT-Dienste ausgeführt werden. Um einen
' weiteren Dienst zum Prozess hinzuzufügen, änderen Sie die folgende Zeile,
' um ein zweites Dienstprojekt zu erstellen. Z.B.,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service1()}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
' Für Komponenten-Designer erforderlich
Private components As System.ComponentModel.IContainer
' HINWEIS: Die folgende Prozedur wird vom Komponenten-Designer benötigt.
' Sie kann mit dem Komponenten-Designer modifiziert werden. Verwenden Sie nicht
' den Code-Editor zur Bearbeitung.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.ServiceName = "Service1"
End Sub
#End Region
Dim WithEvents fwinput As New FileSystemWatcher
Protected Overrides Sub OnStart(ByVal args() As String)
PrintLog("Start EDKB07")
'BUD - 12.10.2006 - BMS eingebaut Job 9
Try
Dim m_log1 As New bms.Logging(9, Common.Common.JobType.WatchJob)
m_log = m_log1
m_log.Start()
Catch ex As Exception
WirteLog("BMS-Connection / XML: " + ex.Message, ApplicationPath() + "Error.txt")
Exit Sub
End Try
Dim fwinput As New FileSystemWatcher
Try
PrintLog("1")
'Definition der Remotingklasse aus dem Applikationskonfigurationsfile lesen
PrintLog(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile,False)
PrintLog("2")
'XML-Konfigurationsfile einlesen und damit Variabeln der Globals-Klasse füllen
Dim xmldoc As New XmlDocument
Globals.PrintLog("Applpath:" & Me.ApplicationPath)
xmldoc.Load(Me.ApplicationPath & "EDKB07.XML")
Globals.sConnectionString = xmldoc.SelectSingleNode("/Configuration/SQLConnectionString").InnerText
Globals.conn_edoka.sConnectionString = Globals.sConnectionString
Globals.PrintLog("EDOKA-Connection::" & Globals.sConnectionString)
Globals.conn_journale.sConnectionString = xmldoc.SelectSingleNode("/Configuration/SQLConnectionStringJournale").InnerText
Globals.sConnectionString_journale = xmldoc.SelectSingleNode("/Configuration/SQLConnectionStringJournale").InnerText
Globals.PrintLog("Journale-Connection::" & Globals.sConnectionString_journale)
Globals.DruckjobParameter = xmldoc.SelectSingleNode("/Configuration/bldruckjobParam").InnerText
'Neuer Avaloq Parameter
Globals.DruckjobParameterAVQ = xmldoc.SelectSingleNode("/Configuration/bldruckjobParamXOMA").InnerText
Globals.ColdOutputFolder = xmldoc.SelectSingleNode("/Configuration/ColdOutputFolder").InnerText
Globals.Deckblatt = xmldoc.SelectSingleNode("/Configuration/BLDruckDeckblatt").InnerText
Globals.Schlussblatt = xmldoc.SelectSingleNode("/Configuration/BLDruckSchlussblatt").InnerText
Globals.TempPath = xmldoc.SelectSingleNode("/Configuration/TempFilePath").InnerText
Globals.OutputFolder = xmldoc.SelectSingleNode("/Configuration/EDKB07OutputFolder").InnerText
Globals.UseTestMode = xmldoc.SelectSingleNode("/Configuration/UseTestMode").InnerText
Globals.TestParamFilePath = xmldoc.SelectSingleNode("/Configuration/TestParamFilePath").InnerText
Globals.ParamFileOutputPath = xmldoc.SelectSingleNode("/Configuration/ParamFileOutputPath").InnerText
Globals.CMDFilePath = xmldoc.SelectSingleNode("/Configuration/CMDFilePath").InnerText
Globals.CMDFile1Content = xmldoc.SelectSingleNode("/Configuration/CMDFile1Content").InnerText
Globals.CMDFile2Content = xmldoc.SelectSingleNode("/Configuration/CMDFile2Content").InnerText
Globals.PSPrinter = xmldoc.SelectSingleNode("/Configuration/PSPrinter").InnerText
Globals.Vorlagenverzeichnis = xmldoc.SelectSingleNode("/Configuration/Vorlagenverzeichnis").InnerText
Globals.Workverzeichnis = xmldoc.SelectSingleNode("/Configuration/Workverzeichnis").InnerText
Globals.psdir = xmldoc.SelectSingleNode("/Configuration/PSDir").InnerText
Globals.PDFdir = xmldoc.SelectSingleNode("/Configuration/PDFDir").InnerText
Globals.PrintLog("Vorlagenverzeichnis:" + Vorlagenverzeichnis, EventLogEntryType.Information)
Globals.PrintLog("Workverzeichnis:" + Workverzeichnis, EventLogEntryType.Information)
Globals.PrintLog("PSDir:" + psdir, EventLogEntryType.Information)
Globals.PrintLog("PDFDir:" + PDFdir, EventLogEntryType.Information)
Globals.PrintLog("PSPrinter:" + PSPrinter, EventLogEntryType.Information)
Globals.DokPerPackage = xmldoc.SelectSingleNode("/Configuration/DokPerPackage").InnerText
'File-Watcher konfigurieren, dass er nur auf .ret-Files reagiert
'File-Watcher konfigurieren, dass er nur auf .ret-Files reagiert
Globals.ProcessToKill = xmldoc.SelectSingleNode("/Configuration/ProcessToKill").InnerText
Try
Globals.ProcessIdleTime = CInt(xmldoc.SelectSingleNode("/Configuration/ProcessIdleTime").InnerText)
Catch ex As Exception
Globals.ProcessIdleTime = 525600 ' entspricht einem Jahr
End Try
Globals.OwnName = xmldoc.SelectSingleNode("/Configuration/OwnName").InnerText
Globals.OtherBatch1 = xmldoc.SelectSingleNode("/Configuration/OtherBatch1").InnerText
Globals.OtherBatch2 = xmldoc.SelectSingleNode("/Configuration/OtherBatch2").InnerText
Globals.OtherBatch3 = xmldoc.SelectSingleNode("/Configuration/OtherBatch3").InnerText
Globals.NameDistiller = xmldoc.SelectSingleNode("/Configuration/NameDistiller").InnerText
Globals.PathDistiller = xmldoc.SelectSingleNode("/Configuration/PathDistiller").InnerText
Globals.OpenModeDistiller = xmldoc.SelectSingleNode("/Configuration/OpenModeDistiller").InnerText
Globals.PrintLog("Vor SHU", EventLogEntryType.Information)
'SHU 20120104
Try
Globals.Beilage_1 = xmldoc.SelectSingleNode("/Configuration/Beilage_1").InnerText
Globals.PrintLog("Beilage 1 " + Globals.Beilage_1, EventLogEntryType.Information)
Globals.Beilage_2 = xmldoc.SelectSingleNode("/Configuration/Beilage_2").InnerText
Globals.PrintLog("Beilage 1 " + Globals.Beilage_2, EventLogEntryType.Information)
Globals.Beilage_3 = xmldoc.SelectSingleNode("/Configuration/Beilage_3").InnerText
Globals.PrintLog("Beilage 3 " + Globals.Beilage_3, EventLogEntryType.Information)
Globals.Beilage_1_ab = xmldoc.SelectSingleNode("/Configuration/Beilage_1_AbDatum").InnerText
Globals.PrintLog("Beilage 1 ab " + Globals.Beilage_1_ab, EventLogEntryType.Information)
Globals.Beilage_2_ab = xmldoc.SelectSingleNode("/Configuration/Beilage_2_AbDatum").InnerText
Globals.PrintLog("Beilage 2 ab " + Globals.Beilage_2_ab, EventLogEntryType.Information)
Globals.Beilage_3_ab = xmldoc.SelectSingleNode("/Configuration/Beilage_3_AbDatum").InnerText
Globals.PrintLog("Beilage 3 ab " + Globals.Beilage_3_ab, EventLogEntryType.Information)
Catch ex As Exception
Globals.PrintLog(ex.Message, EventLogEntryType.Information)
End Try
Me.fwinput.Path = Globals.ColdOutputFolder
'Me.fwinput.Filter = "*.ret"
Me.fwinput.EnableRaisingEvents = True
'Log-Eintrag beginnen beim Start der Applikation
Dim log As New clsLog
Globals.PrintLog("Vor Start Log:", EventLogEntryType.Information)
log.Startlog(1)
log.InsertJournale("EDKB07: Start EDKB07 " & CType(Now, String), clsLog.Enum_InfoTyp.Keine)
'Cold Mehrfachdruck Initialisierung / BUD / 10.01.2006
Init_ColdMehrfachdruck()
log = Nothing
Catch ex As Exception
PrintLog(ex.Message, EventLogEntryType.Error)
Dim log As New clsLog
log.Startlog(1)
log.InsertJournale("EDKB07: Fehler beim Starten von EDKB07 " & CType(Now, String) & " Error: " & ex.Message, clsLog.Enum_InfoTyp.Fehler)
log = Nothing
End Try
End Sub
Private Sub Init_ColdMehrfachdruck()
'Initialisiert den ColdMehrfachdruck, d.h. liest da Configfile
'BUD / 10.01.2006
Try
Dim xmlColdMehrfachdruck As New XmlDocument
xmlColdMehrfachdruck.Load(Me.ApplicationPath & "EDKB07_ColdMehrfach.XML")
Global_md_ColdMDOutputFolder = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ColdMDOutputFolder").InnerText()
Global_md_TempFilePath = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/TempFilePath").InnerText()
Global_md_EDKB07_MDOutputFolder = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/EDKB07_MDOutputFolder").InnerText()
Global_md_ParamFileOutputPath = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ParamFileOutputPath").InnerText()
Global_md_CMDFilePath = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/CMDFilePath").InnerText()
Global_md_CMDFile1Content = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/CMDFile1Content").InnerText()
Global_md_CMDFile2Content = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/CMDFile2Content").InnerText()
Global_md_ParamCfgAvaloq = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ParamCfgAVALOQ").InnerText()
Global_md_ParamCfgEdoka = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ParamCfgEdoka").InnerText()
Global_md_ParamCfgHost = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ParamCfgHost").InnerText()
Global_md_ParamCfgZv = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/ParamCfgZv").InnerText()
Global_md_MaxWaitTime = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/MaxWaitTime").InnerText()
Global_md_UseTestMode = xmlColdMehrfachdruck.SelectSingleNode("/Configuration/UseTestMode").InnerText()
Catch ex As Exception
m_log.Log("Service1:Init_ColdMehrfachdruck:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
PrintLog(ex.Message, EventLogEntryType.Error)
Dim log As New clsLog
log.Startlog(1)
log.InsertJournale("EDKB07: Cold Mehrfachdruck Initialisieren fehlgeschlagen. " & CType(Now, String) & " Error: " & ex.Message, clsLog.Enum_InfoTyp.Fehler)
log = Nothing
Global_md_Error = 1
End Try
End Sub
Protected Overrides Sub OnStop()
Try
Dim log As New clsLog
log.InsertJournale("EDKB07: Stop EDKB07 " & CType(Now, String), clsLog.Enum_InfoTyp.Keine)
'BUD - 12.10.2006 - BMS eingefügt
m_log.Ende()
Catch ex As Exception
WirteLog("BMS-Connection / XML: " + ex.Message, ApplicationPath() + "Error.txt")
Exit Sub
End Try
End Sub
Private Sub WirteLog(ByVal stext As String, ByVal sPfad As String)
'BUD - 12.10.2006 - BMS eingefügt
Try
Dim FiStr As FileStream = New FileStream(sPfad, FileMode.Append)
Dim StrWr As StreamWriter = New StreamWriter(FiStr)
StrWr.WriteLine("Fehler: " + Now())
StrWr.WriteLine("Fehlertext:" + stext)
StrWr.Close()
Catch ex As Exception
End Try
End Sub
Private Sub fwInput_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles fwinput.Created
System.Threading.Thread.Sleep(5000)
'Wenn ein .ret-File erstellt wurde Prozedur CheckForRetFiles aufrufen
Me.CheckForRetFiles()
End Sub
Public Sub CheckForRetFiles()
Dim inputFile As String
Dim inputFileFullPath As String
Dim fi As FileInfo
Dim dir As New DirectoryInfo(fwinput.Path)
'Alle Files im überwachten Verzeichnis überprüfen
Threading.Thread.Sleep(1000)
For Each fi In dir.GetFiles
If fi.Extension = ".ret" Then 'Wenn ein .ret-File gefunden wird Prozedur ProcessColdOutput aufrufen
Dim s As String
If File.Exists(fi.FullName) Then
s = fi.FullName
Try
Rename(s, s + "_done")
Catch ex As Exception
m_log.Log("Service1:CheckForRetFiles:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
inputFile = fi.Name + "_done"
inputFileFullPath = fi.FullName + "_done"
ProcessColdOutput(inputFile, inputFileFullPath)
'ModPrintjob.Print_Docs(7703, 0)
End If
End If
'Erweiterung um den "FAILED" Fall abzufangen
If fi.Extension = ".FAILED" Then 'Wenn ein .FAILED-File gefunden wird Prozedur ProcessColdOutputNOK aufrufen
Dim s As String
If File.Exists(fi.FullName) Then
s = fi.FullName
Try
Rename(s, s + "_done")
Catch ex As Exception
m_log.Log("Service1:CheckForFailedFiles:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
inputFile = fi.Name + "_done"
inputFileFullPath = fi.FullName + "_done"
ProcessColdOutputNOK(inputFile, inputFileFullPath)
End If
End If
Next
End Sub
Public Sub ProcessColdOutput(ByVal fname As String, ByVal fullpath As String)
Dim log As New clsLog
Dim SqlConn As New SqlConnection
SqlConn.ConnectionString = Globals.sConnectionString
Dim SqlCmd As New SqlCommand
Dim TGNr, Timestmp, partno As String
Dim erstelltam As String
TGNr = Left(fname, fname.Length - (16 + 9))
' TGNr = Mid(fname, 1, 13) 'TG-Nummer aus dem Dateinamen extrahieren
Timestmp = Mid(fname, Len(TGNr) + 3, fname.Length - (Len(TGNr) + 11)) 'Timestamp aus dem Dateinamen extrahieren
partno = Mid(fname, Len(TGNr) + 1, 2)
'TGNr = Mid(fname, 1, 6) 'TG-Nummer aus dem Dateinamen extrahieren
'Timestmp = Mid(fname, 7, 14) 'Timestamp aus dem Dateinamen extrahieren
'Den Timestamp formatieren, dass dieser in einer DB-Abfrage verwendet werden kann
'erstelltam = Mid(Timestmp, 1, 4) & "-" & Mid(Timestmp, 5, 2) & "-" & Mid(Timestmp, 7, 2) & " " & Mid(Timestmp, 9, 2) & ":" & Mid(Timestmp, 11, 2) & ":" & Mid(Timestmp, 13, 2)
erstelltam = Timestmp
'.ret-File öffnen und lesen
Dim oReader As StreamReader
oReader = New StreamReader(fullpath)
Dim s As String
s = oReader.ReadLine
If s <> "" Then 'Rückmeldung von Cold, Aufbereitung OK
oReader.Close()
log.InsertJournale("EDKB07: Rückmeldung von Cold, Aufbereitung OK " & CType(Now, String) & " TGNr: " & TGNr & " Erstelltam: " & Timestmp, clsLog.Enum_InfoTyp.Keine)
Dim PartnerKurzname As String = ""
Dim AnzahlDokumente, PartnerNr As Integer
Dim DR As SqlDataReader
'Angaben zum Druckjob aus der DB lesen
SqlCmd.CommandText = "SP_EDEX_BL_GET_DRUCK_PDFParameter"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Userid", TGNr)
SqlCmd.Parameters.AddWithValue("@filetimestamp", erstelltam)
SqlCmd.Connection = SqlConn
SqlConn.Open()
DR = SqlCmd.ExecuteReader()
While DR.Read
AnzahlDokumente = DR.Item("anzahl_dokumente")
PartnerNr = DR.Item("nrpar00")
PartnerKurzname = DR.Item("BKPAR00")
End While
SqlConn.Close()
SqlCmd.Parameters.Clear()
Dim verarbeitung As New EDKB07WS.Verarbeitung
oReader.Close()
'Funktion zum hinzufügen der Deckblätter und der Zusammenfassung aufrufen
If verarbeitung.AddPageToPDF(TGNr, Timestmp, AnzahlDokumente, PartnerNr, PartnerKurzname, partno) Then
Try
File.Delete(fullpath) '.ret-File löschen
Catch ex As Exception
m_log.Log("Service1:CheckForRetFiles:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
'Status auf 'aufbereitet' (2) ändern
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_Status"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 2)
SqlCmd.Parameters.AddWithValue("@Userid", TGNr)
SqlCmd.Parameters.AddWithValue("@erstelltam", erstelltam)
SqlCmd.Parameters.AddWithValue("@part", Val(partno))
SqlCmd.Connection = SqlConn
SqlConn.Open()
SqlCmd.ExecuteNonQuery()
SqlConn.Close()
SqlCmd.Parameters.Clear()
Else 'Fehler beim ergänzen des PDF-Files oder beim speichern in die Datenbank
'Status auf 'abvereckt' (3) ändern
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_Status"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 3)
SqlCmd.Parameters.AddWithValue("@Userid", TGNr)
SqlCmd.Parameters.AddWithValue("@erstelltam", erstelltam)
SqlCmd.Parameters.AddWithValue("@part", Val(partno))
SqlCmd.Connection = SqlConn
SqlConn.Open()
SqlCmd.ExecuteNonQuery()
SqlConn.Close()
SqlCmd.Parameters.Clear()
End If
Else 'Rückmeldung von Cold, Aufbereitung fehlerhaft
log.InsertJournale("EDKB07_BL: Fehler von Cold " & CType(Now, String) & " TGNr: " & TGNr & " Erstelltam: " & Timestmp, clsLog.Enum_InfoTyp.Keine)
'Status auf 'abvereckt' (3) ändern
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_Status"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 3)
SqlCmd.Parameters.AddWithValue("@Userid", TGNr)
SqlCmd.Parameters.AddWithValue("@erstelltam", erstelltam)
SqlCmd.Connection = SqlConn
SqlConn.Open()
SqlCmd.ExecuteNonQuery()
SqlConn.Close()
SqlCmd.Parameters.Clear()
End If
'Überprüfung auf .ret-Files nochmals aufrufen, da in der Zwischenzeit eine weiter Datei
'hätte ankommen könne, auf die der Filewatcher nicht reagiert hat
Me.CheckForRetFiles()
End Sub
Public Sub ProcessColdOutputNOK(ByVal fname As String, ByVal fullpath As String)
Dim log As New clsLog
Dim SqlConn As New SqlConnection
SqlConn.ConnectionString = Globals.sConnectionString
Dim SqlCmd As New SqlCommand
Dim TGNr, Timestmp, partno As String
Dim erstelltam As String
'TGI62430020080918174819.FAILED_done
'TGI62430020080918174819.RET
TGNr = Left(fname, fname.Length - (16 + 12)) 'TG-Nummer aus dem Dateinamen extrahieren
Timestmp = Mid(fname, Len(TGNr) + 3, fname.Length - (Len(TGNr) + 14)) 'Timestamp aus dem Dateinamen extrahieren
partno = Mid(fname, Len(TGNr) + 1, 2)
erstelltam = Timestmp
'Rückmeldung von Cold, Aufbereitung fehlerhaft
'log.InsertJournale("EDKB07_BL: Fehler von Cold " & CType(Now, String) & " TGNr: " & TGNr & " Erstelltam: " & Timestmp, clsLog.Enum_InfoTyp.Keine)
SqlCmd.CommandText = "SP_EDEX_BL_UPDATE_DRUCK_Status"
SqlCmd.CommandType = CommandType.StoredProcedure
SqlCmd.Parameters.AddWithValue("@Status", 3)
SqlCmd.Parameters.AddWithValue("@Userid", TGNr)
SqlCmd.Parameters.AddWithValue("@erstelltam", erstelltam)
SqlCmd.Parameters.AddWithValue("@part", Val(partno))
SqlCmd.Connection = SqlConn
SqlConn.Open()
SqlCmd.ExecuteNonQuery()
SqlConn.Close()
SqlCmd.Parameters.Clear()
'Überprüfung auf Files nochmals aufrufen, da in der Zwischenzeit eine weiter Datei
'hätte ankommen könne, auf die der Filewatcher nicht reagiert hat
Me.CheckForRetFiles()
End Sub
Public Function ApplicationPath() As String
Return Path.GetDirectoryName([Assembly].GetEntryAssembly().Location) + "\"
End Function
End Class

View File

@@ -0,0 +1,92 @@
Imports System.Xml
Imports System.IO
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Public Class Verarbeitung
Public Function AddPageToPDF(ByVal TGNr As String, ByVal timestmp As String, ByVal AnzahlDokumente As Integer, ByVal PartnerNr As Integer, ByVal PartnerKurzname As String, ByVal partno As Integer) As Boolean
Dim log As New clsLog
Dim spartno As String = LTrim(Str(partno))
While Len(spartno) < 2
spartno = "0" + spartno
End While
Try
'Normal - mit einer Returndatei
If partno = 0 Then
Dim con As New SqlConnection(Globals.sConnectionString)
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob where tgnummer ='" & TGNr & "' and filetimestamp=@erstelltam", con)
da.SelectCommand.Parameters.AddWithValue("@erstelltam", timestmp)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet
' Dim fs As New FileStream(Globals.OutputFolder & "\" & TGNr & timestmp & "_done.pdf", FileMode.OpenOrCreate, FileAccess.Read)
Dim fs As New FileStream(Globals.OutputFolder & "\" & TGNr & spartno + timestmp & ".pdf", FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
con.Open()
da.Fill(ds, "edex_bl_druckjob")
Dim myRow As DataRow
myRow = ds.Tables("edex_bl_druckjob").Rows(0)
myRow("pdfdokument") = MyData
da.Update(ds, "edex_bl_druckjob")
fs = Nothing
MyCB = Nothing
ds = Nothing
da = Nothing
con.Close()
con = Nothing
File.Delete(Globals.TempPath & "\" & TGNr & spartno & timestmp & "_summary.pdf")
log.InsertJournale("EDKB07: PDF-Ergänzung erfolgreich " & CType(Now, String) & " TGNr: " & TGNr & " Erstelltam: " & timestmp, clsLog.Enum_InfoTyp.Keine)
Return True
Else
Dim con1 As New SqlConnection(Globals.sConnectionString)
Dim da1 As New SqlDataAdapter("Select * From edex_bl_druckjob where tgnummer ='" & TGNr & "' and filetimestamp=@erstelltam", con1)
da1.SelectCommand.Parameters.AddWithValue("@erstelltam", timestmp)
Dim MyCB1 As SqlCommandBuilder = New SqlCommandBuilder(da1)
Dim ds1 As New DataSet
da1.Fill(ds1, "druckjob")
Dim druckjobnr As Integer = ds1.Tables(0).Rows(0).Item("druckjobnr")
con1.Dispose()
da1.Dispose()
MyCB1.Dispose()
ds1.Dispose()
Dim con As New SqlConnection(Globals.sConnectionString)
Dim da As New SqlDataAdapter("Select * From edex_bl_druckjob_part where druckjobnr=" + LTrim(Str(druckjobnr)) + " and partno=" + LTrim(Str(partno)), con)
'da.SelectCommand.Parameters.Add("@erstelltam", timestmp)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet
'Dim fs As New FileStream(Globals.OutputFolder & "\" & TGNr & timestmp & "_done.pdf", FileMode.OpenOrCreate, FileAccess.Read)
Dim fs As New FileStream(Globals.OutputFolder & "\" & TGNr & spartno & timestmp & ".pdf", FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
con.Open()
da.Fill(ds, "edex_bl_druckjob_part")
Dim myRow As DataRow
myRow = ds.Tables("edex_bl_druckjob_part").Rows(0)
myRow("pdfdokument") = MyData
da.Update(ds, "edex_bl_druckjob_part")
fs = Nothing
MyCB = Nothing
ds = Nothing
da = Nothing
con.Close()
con = Nothing
File.Delete(Globals.TempPath & "\" & TGNr & spartno & timestmp & "_summary.pdf")
log.InsertJournale("EDKB07: PDF-Ergänzung erfolgreich " & CType(Now, String) & " TGNr: " & TGNr & " Erstelltam: " & timestmp, clsLog.Enum_InfoTyp.Keine)
Return True
End If
Catch ex As Exception
log.InsertJournale("EDKB07: PDF-Ergänzung gescheitert " & CType(Now, String) & " Error: " & ex.Message & " TGNr: " & TGNr & " Erstelltam: " + timestmp, clsLog.Enum_InfoTyp.Warnung)
Return False
Finally
log = Nothing
End Try
End Function
End Class

106
EDKB07WS/Backup1/clsLog.vb Normal file
View File

@@ -0,0 +1,106 @@
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
'BUD - 12.10.2006 - Log mit BMS ergänzt
Public Enum Enum_InfoTyp
Keine = 0
Information = 1
Warnung = 2
Fehler = 3
End Enum
#End Region
Public Sub Startlog(ByVal ApplicationID As Integer)
Try
'clsapplikation.iApplikationnr = New SqlInt32(CType(ApplicationID, Int32))
'clsapplikation.cpMainConnectionProvider = conn_journale
'clsapplikation.SelectOne()
Me.m_applikationid = ApplicationID
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()
Globals.m_journalid = clsjournal.iJournalnr.Value
conn_journale.CloseConnection(True)
Catch ex As Exception
Globals.PrintLog("Journalzugriff:" + ex.Message)
m_log.Log("clsLog:Startlog:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
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(Globals.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
Connection.Open()
DA.Fill(ds, "docs")
Dim myRow As DataRow
myRow = ds.Tables(0).NewRow
myRow.Item(1) = Globals.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
m_log.Log("clsLog:insert_journaldatei:1:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
Return False
End Try
fs = Nothing
cb = Nothing
ds = Nothing
DA = Nothing
Connection.Close()
Connection = Nothing
Catch ex As Exception
m_log.Log("clsLog:insert_journaldatei:2:" + ex.Message + ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
Return True
End Function
End Class