You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

470 lines
18 KiB

' ///////////////////////////////////////////////////////////////////////////
' // Description: Data Access class for the table 'Import_Job'
' // Generated by LLBLGen v1.2.1045.38210 Final on: Dienstag, 5. April 2005, 22:50:00
' // 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 'Import_Job'.
' /// </summary>
Public Class clsImport_Job
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_daEnde_TS, m_daStart_TS, m_daJournal_Datum As SqlDateTime
Private m_iJournal_Ausgeliefert, m_iApplikationNr, m_iImport_JobNr, m_iFeherhaft As SqlInt32
#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>daStart_TS. May be SqlDateTime.Null</LI>
' /// <LI>daEnde_TS. May be SqlDateTime.Null</LI>
' /// <LI>iFeherhaft. May be SqlInt32.Null</LI>
' /// <LI>iApplikationNr. May be SqlInt32.Null</LI>
' /// <LI>iJournal_Ausgeliefert. May be SqlInt32.Null</LI>
' /// <LI>daJournal_Datum. May be SqlDateTime.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iImport_JobNr</LI>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Import_Job_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@daStart_TS", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daStart_TS))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daEnde_TS", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daEnde_TS))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iFeherhaft", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iFeherhaft))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iApplikationNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iJournal_Ausgeliefert", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iJournal_Ausgeliefert))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daJournal_Datum", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daJournal_Datum))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iImport_JobNr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iImport_JobNr))
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_iImport_JobNr = scmCmdToExecute.Parameters.Item("@iImport_JobNr").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_Import_Job_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("clsImport_Job::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>iImport_JobNr</LI>
' /// <LI>daStart_TS. May be SqlDateTime.Null</LI>
' /// <LI>daEnde_TS. May be SqlDateTime.Null</LI>
' /// <LI>iFeherhaft. May be SqlInt32.Null</LI>
' /// <LI>iApplikationNr. May be SqlInt32.Null</LI>
' /// <LI>iJournal_Ausgeliefert. May be SqlInt32.Null</LI>
' /// <LI>daJournal_Datum. 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_Import_Job_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iImport_JobNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iImport_JobNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daStart_TS", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daStart_TS))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daEnde_TS", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daEnde_TS))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iFeherhaft", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iFeherhaft))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iApplikationNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iJournal_Ausgeliefert", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iJournal_Ausgeliefert))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daJournal_Datum", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daJournal_Datum))
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_Import_Job_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("clsImport_Job::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>iImport_JobNr</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_Import_Job_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iImport_JobNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iImport_JobNr))
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_Import_Job_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("clsImport_Job::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>iImport_JobNr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// <LI>iImport_JobNr</LI>
' /// <LI>daStart_TS</LI>
' /// <LI>daEnde_TS</LI>
' /// <LI>iFeherhaft</LI>
' /// <LI>iApplikationNr</LI>
' /// <LI>iJournal_Ausgeliefert</LI>
' /// <LI>daJournal_Datum</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_Import_Job_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Import_Job")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iImport_JobNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iImport_JobNr))
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_Import_Job_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iImport_JobNr = New SqlInt32(CType(dtToReturn.Rows(0)("Import_JobNr"), Integer))
If dtToReturn.Rows(0)("Start_TS") Is System.DBNull.Value Then
m_daStart_TS = SqlDateTime.Null
Else
m_daStart_TS = New SqlDateTime(CType(dtToReturn.Rows(0)("Start_TS"), Date))
End If
If dtToReturn.Rows(0)("Ende_TS") Is System.DBNull.Value Then
m_daEnde_TS = SqlDateTime.Null
Else
m_daEnde_TS = New SqlDateTime(CType(dtToReturn.Rows(0)("Ende_TS"), Date))
End If
If dtToReturn.Rows(0)("Feherhaft") Is System.DBNull.Value Then
m_iFeherhaft = SqlInt32.Null
Else
m_iFeherhaft = New SqlInt32(CType(dtToReturn.Rows(0)("Feherhaft"), Integer))
End If
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)("Journal_Ausgeliefert") Is System.DBNull.Value Then
m_iJournal_Ausgeliefert = SqlInt32.Null
Else
m_iJournal_Ausgeliefert = New SqlInt32(CType(dtToReturn.Rows(0)("Journal_Ausgeliefert"), Integer))
End If
If dtToReturn.Rows(0)("Journal_Datum") Is System.DBNull.Value Then
m_daJournal_Datum = SqlDateTime.Null
Else
m_daJournal_Datum = New SqlDateTime(CType(dtToReturn.Rows(0)("Journal_Datum"), 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("clsImport_Job::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_Import_Job_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Import_Job")
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_Import_Job_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("clsImport_Job::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 [iImport_JobNr]() As SqlInt32
Get
Return m_iImport_JobNr
End Get
Set(ByVal Value As SqlInt32)
Dim iImport_JobNrTmp As SqlInt32 = Value
If iImport_JobNrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iImport_JobNr", "iImport_JobNr can't be NULL")
End If
m_iImport_JobNr = Value
End Set
End Property
Public Property [daStart_TS]() As SqlDateTime
Get
Return m_daStart_TS
End Get
Set(ByVal Value As SqlDateTime)
m_daStart_TS = Value
End Set
End Property
Public Property [daEnde_TS]() As SqlDateTime
Get
Return m_daEnde_TS
End Get
Set(ByVal Value As SqlDateTime)
m_daEnde_TS = Value
End Set
End Property
Public Property [iFeherhaft]() As SqlInt32
Get
Return m_iFeherhaft
End Get
Set(ByVal Value As SqlInt32)
m_iFeherhaft = 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 [iJournal_Ausgeliefert]() As SqlInt32
Get
Return m_iJournal_Ausgeliefert
End Get
Set(ByVal Value As SqlInt32)
m_iJournal_Ausgeliefert = Value
End Set
End Property
Public Property [daJournal_Datum]() As SqlDateTime
Get
Return m_daJournal_Datum
End Get
Set(ByVal Value As SqlDateTime)
m_daJournal_Datum = Value
End Set
End Property
#End Region
End Class
End Namespace