' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'edex_dpinstanz' ' // Generated by LLBLGen v1.2.1045.38210 Final on: Dienstag, 8. Februar 2005, 10:41:34 ' // 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 'edex_dpinstanz'. ' /// Public Class clsEdex_dpinstanz Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_bIndividuellesDP As SqlBoolean Private m_daErstellt_am As SqlDateTime Private m_iDokumentpaketnr, m_iProfilnr, m_iNrpar00, m_iMitarbeiternr, m_iNreintrag As SqlInt32 Private m_sHacken, m_sDokumentpaketnummern As SqlString #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.[edex_pr_edex_dpinstanz_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@imitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiternr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sdokumentpaketnummern", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sDokumentpaketnummern)) scmCmdToExecute.Parameters.Add(New SqlParameter("@shacken", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sHacken)) scmCmdToExecute.Parameters.Add(New SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iDokumentpaketnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iDokumentpaketnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bIndividuellesDP", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bIndividuellesDP)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iProfilnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iProfilnr)) scmCmdToExecute.Parameters.Add(new SqlParameter("@inreintrag", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iNreintrag)) 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_iNreintrag = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@inreintrag").Value, SqlInt32)) m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_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("clsEdex_dpinstanz::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.[edex_pr_edex_dpinstanz_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inreintrag", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNreintrag)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiternr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sdokumentpaketnummern", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sDokumentpaketnummern)) scmCmdToExecute.Parameters.Add(New SqlParameter("@shacken", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sHacken)) scmCmdToExecute.Parameters.Add(New SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iDokumentpaketnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iDokumentpaketnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bIndividuellesDP", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bIndividuellesDP)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iProfilnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iProfilnr)) 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_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("clsEdex_dpinstanz::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: ' /// ' /// Public Overrides Function Delete() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[edex_pr_edex_dpinstanz_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inreintrag", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNreintrag)) 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_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("clsEdex_dpinstanz::Delete::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function Public Function SelectByDPNr(ByVal DPNr As Integer) As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[edex_pr_edex_dpinstanz_SelectByDPNr]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("edex_dpinstanz") Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@DPNR", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, DPNr)) 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iNreintrag = New SqlInt32(CType(dtToReturn.Rows(0)("nreintrag"), Integer)) If dtToReturn.Rows(0)("mitarbeiternr") Is System.DBNull.Value Then m_iMitarbeiternr = SqlInt32.Null Else m_iMitarbeiternr = New SqlInt32(CType(dtToReturn.Rows(0)("mitarbeiternr"), Integer)) End If If dtToReturn.Rows(0)("dokumentpaketnummern") Is System.DBNull.Value Then m_sDokumentpaketnummern = SqlString.Null Else m_sDokumentpaketnummern = New SqlString(CType(dtToReturn.Rows(0)("dokumentpaketnummern"), String)) End If If dtToReturn.Rows(0)("hacken") Is System.DBNull.Value Then m_sHacken = SqlString.Null Else m_sHacken = New SqlString(CType(dtToReturn.Rows(0)("hacken"), String)) End If If dtToReturn.Rows(0)("nrpar00") Is System.DBNull.Value Then m_iNrpar00 = SqlInt32.Null Else m_iNrpar00 = New SqlInt32(CType(dtToReturn.Rows(0)("nrpar00"), Integer)) End If If dtToReturn.Rows(0)("erstellt_am") Is System.DBNull.Value Then m_daErstellt_am = SqlDateTime.Null Else m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("erstellt_am"), Date)) End If If dtToReturn.Rows(0)("Dokumentpaketnr") Is System.DBNull.Value Then m_iDokumentpaketnr = SqlInt32.Null Else m_iDokumentpaketnr = New SqlInt32(CType(dtToReturn.Rows(0)("Dokumentpaketnr"), Integer)) End If If dtToReturn.Rows(0)("IndividuellesDP") Is System.DBNull.Value Then m_bIndividuellesDP = SqlBoolean.Null Else m_bIndividuellesDP = New SqlBoolean(CType(dtToReturn.Rows(0)("IndividuellesDP"), Boolean)) End If If dtToReturn.Rows(0)("Profilnr") Is System.DBNull.Value Then m_iProfilnr = SqlInt32.Null Else m_iProfilnr = New SqlInt32(CType(dtToReturn.Rows(0)("Profilnr"), Integer)) End If End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsEdex_dpinstanz::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: 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. ' /// Public Overrides Function SelectOne() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[edex_pr_edex_dpinstanz_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("edex_dpinstanz") Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inreintrag", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNreintrag)) 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iNreintrag = New SqlInt32(CType(dtToReturn.Rows(0)("nreintrag"), Integer)) If dtToReturn.Rows(0)("mitarbeiternr") Is System.DBNull.Value Then m_iMitarbeiternr = SqlInt32.Null Else m_iMitarbeiternr = New SqlInt32(CType(dtToReturn.Rows(0)("mitarbeiternr"), Integer)) End If If dtToReturn.Rows(0)("dokumentpaketnummern") Is System.DBNull.Value Then m_sDokumentpaketnummern = SqlString.Null Else m_sDokumentpaketnummern = New SqlString(CType(dtToReturn.Rows(0)("dokumentpaketnummern"), String)) End If If dtToReturn.Rows(0)("hacken") Is System.DBNull.Value Then m_sHacken = SqlString.Null Else m_sHacken = New SqlString(CType(dtToReturn.Rows(0)("hacken"), String)) End If If dtToReturn.Rows(0)("nrpar00") Is System.DBNull.Value Then m_iNrpar00 = SqlInt32.Null Else m_iNrpar00 = New SqlInt32(CType(dtToReturn.Rows(0)("nrpar00"), Integer)) End If If dtToReturn.Rows(0)("erstellt_am") Is System.DBNull.Value Then m_daErstellt_am = SqlDateTime.Null Else m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("erstellt_am"), Date)) End If If dtToReturn.Rows(0)("Dokumentpaketnr") Is System.DBNull.Value Then m_iDokumentpaketnr = SqlInt32.Null Else m_iDokumentpaketnr = New SqlInt32(CType(dtToReturn.Rows(0)("Dokumentpaketnr"), Integer)) End If If dtToReturn.Rows(0)("IndividuellesDP") Is System.DBNull.Value Then m_bIndividuellesDP = SqlBoolean.Null Else m_bIndividuellesDP = New SqlBoolean(CType(dtToReturn.Rows(0)("IndividuellesDP"), Boolean)) End If If dtToReturn.Rows(0)("Profilnr") Is System.DBNull.Value Then m_iProfilnr = SqlInt32.Null Else m_iProfilnr = New SqlInt32(CType(dtToReturn.Rows(0)("Profilnr"), Integer)) End If End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsEdex_dpinstanz::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: ' /// ' /// Public Overrides Function SelectAll() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[edex_pr_edex_dpinstanz_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("edex_dpinstanz") 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'edex_pr_edex_dpinstanz_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("clsEdex_dpinstanz::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 [iNreintrag]() As SqlInt32 Get Return m_iNreintrag End Get Set(ByVal Value As SqlInt32) Dim iNreintragTmp As SqlInt32 = Value If iNreintragTmp.IsNull Then Throw New ArgumentOutOfRangeException("iNreintrag", "iNreintrag can't be NULL") End If m_iNreintrag = Value End Set End Property Public Property [iMitarbeiternr]() As SqlInt32 Get Return m_iMitarbeiternr End Get Set(ByVal Value As SqlInt32) m_iMitarbeiternr = Value End Set End Property Public Property [sDokumentpaketnummern]() As SqlString Get Return m_sDokumentpaketnummern End Get Set(ByVal Value As SqlString) m_sDokumentpaketnummern = Value End Set End Property Public Property [sHacken]() As SqlString Get Return m_sHacken End Get Set(ByVal Value As SqlString) m_sHacken = Value End Set End Property Public Property [iNrpar00]() As SqlInt32 Get Return m_iNrpar00 End Get Set(ByVal Value As SqlInt32) m_iNrpar00 = Value End Set End Property Public Property [daErstellt_am]() As SqlDateTime Get Return m_daErstellt_am End Get Set(ByVal Value As SqlDateTime) m_daErstellt_am = Value End Set End Property Public Property [iDokumentpaketnr]() As SqlInt32 Get Return m_iDokumentpaketnr End Get Set(ByVal Value As SqlInt32) m_iDokumentpaketnr = Value End Set End Property Public Property [bIndividuellesDP]() As SqlBoolean Get Return m_bIndividuellesDP End Get Set(ByVal Value As SqlBoolean) m_bIndividuellesDP = Value End Set End Property Public Property [iProfilnr]() As SqlInt32 Get Return m_iProfilnr End Get Set(ByVal Value As SqlInt32) m_iProfilnr = Value End Set End Property #End Region End Class End Namespace