' /////////////////////////////////////////////////////////////////////////// ' // 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 ' /// ' /// Purpose: Data Access class for the table 'Import_Job'. ' /// 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 ' /// ' /// Purpose: Class constructor. ' /// Public Sub New() ' // Nothing for now. End Sub ' /// ' /// Purpose: Insert method. This method will insert one new row into the database. ' /// ' /// True if succeeded, otherwise an Exception is thrown. ' /// ' /// Properties needed for this method: ' /// ' /// Properties set after a succesful call of this method: ' /// ' /// 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 ' /// ' /// Purpose: Update method. This method will Update one existing row in the database. ' /// ' /// True if succeeded, otherwise an Exception is thrown. ' /// ' /// Properties needed for this method: ' /// ' /// Properties set after a succesful call of this method: ' /// ' /// 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 ' /// ' /// Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key. ' /// ' /// True if succeeded, otherwise an Exception is thrown. ' /// ' /// Properties needed for this method: ' /// ' /// Properties set after a succesful call of this method: ' /// ' /// 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 ' /// ' /// Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key. ' /// ' /// DataTable object if succeeded, otherwise an Exception is thrown. ' /// ' /// Properties needed for this method: ' /// ' /// Properties set after a succesful call of this method: ' /// ' /// Will fill all properties corresponding with a field in the table with the value of the row selected. ' /// 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 ' /// ' /// Purpose: SelectAll method. This method will Select all rows from the table. ' /// ' /// DataTable object if succeeded, otherwise an Exception is thrown. ' /// ' /// Properties set after a succesful call of this method: ' /// ' /// 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