' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'EDEX_BL_BLKunde' ' // Generated by LLBLGen v1.2.1045.38210 Final on: Mittwoch, 4. Mai 2005, 19:42:17 ' // 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_BL_BLKunde'. ' /// Public Class clsEDEX_BL_BLKunde Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_sAktiv, m_sPeriodische_auslieferung As SqlString Private m_daBlerklaerung_vom, m_daMutiert_am, m_daErstellt_am As SqlDateTime Private m_iPeriodizitaet, m_iBlkundenr, m_iNRAR00, m_iMandantnr, m_iMutierer 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_edex_bl_EDEX_BL_BLKunde_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iblkundenr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iBlkundenr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iNRAR00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNRAR00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@saktiv", SqlDbType.Char, 1, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sAktiv)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 23, 3, "", DataRowVersion.Proposed, m_daMutiert_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imutierer", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMutierer)) scmCmdToExecute.Parameters.Add(New SqlParameter("@speriodische_auslieferung", SqlDbType.Char, 1, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sPeriodische_auslieferung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iperiodizitaet", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iPeriodizitaet)) scmCmdToExecute.Parameters.Add(New SqlParameter("@dablerklaerung_vom", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daBlerklaerung_vom)) 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 'pr_edex_bl_EDEX_BL_BLKunde_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_BL_BLKunde::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_edex_bl_EDEX_BL_BLKunde_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iblkundenr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iBlkundenr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iNRAR00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNRAR00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@saktiv", SqlDbType.Char, 1, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sAktiv)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 23, 3, "", DataRowVersion.Proposed, m_daMutiert_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imutierer", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMutierer)) scmCmdToExecute.Parameters.Add(New SqlParameter("@speriodische_auslieferung", SqlDbType.Char, 1, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sPeriodische_auslieferung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iperiodizitaet", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iPeriodizitaet)) scmCmdToExecute.Parameters.Add(New SqlParameter("@dablerklaerung_vom", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daBlerklaerung_vom)) 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 'pr_edex_bl_EDEX_BL_BLKunde_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_BL_BLKunde::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.[pr_edex_bl_EDEX_BL_BLKunde_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iblkundenr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iBlkundenr)) 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 'pr_edex_bl_EDEX_BL_BLKunde_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_BL_BLKunde::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_edex_bl_EDEX_BL_BLKunde_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("EDEX_BL_BLKunde") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iblkundenr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iBlkundenr)) 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 'pr_edex_bl_EDEX_BL_BLKunde_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iBlkundenr = New SqlInt32(CType(dtToReturn.Rows(0)("blkundenr"), Integer)) m_iNRAR00 = New SqlInt32(CType(dtToReturn.Rows(0)("NRAR00"), Integer)) m_iMandantnr = New SqlInt32(CType(dtToReturn.Rows(0)("mandantnr"), Integer)) m_sAktiv = New SqlString(CType(dtToReturn.Rows(0)("aktiv"), String)) m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("erstellt_am"), Date)) m_daMutiert_am = New SqlDateTime(CType(dtToReturn.Rows(0)("mutiert_am"), Date)) m_iMutierer = New SqlInt32(CType(dtToReturn.Rows(0)("mutierer"), Integer)) m_sPeriodische_auslieferung = New SqlString(CType(dtToReturn.Rows(0)("periodische_auslieferung"), String)) m_iPeriodizitaet = New SqlInt32(CType(dtToReturn.Rows(0)("periodizitaet"), Integer)) If dtToReturn.Rows(0)("blerklaerung_vom") Is System.DBNull.Value Then m_daBlerklaerung_vom = SqlDateTime.Null Else m_daBlerklaerung_vom = New SqlDateTime(CType(dtToReturn.Rows(0)("blerklaerung_vom"), 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("clsEDEX_BL_BLKunde::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.[pr_edex_bl_EDEX_BL_BLKunde_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("EDEX_BL_BLKunde") 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 'pr_edex_bl_EDEX_BL_BLKunde_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_BL_BLKunde::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 [iBlkundenr]() As SqlInt32 Get Return m_iBlkundenr End Get Set(ByVal Value As SqlInt32) Dim iBlkundenrTmp As SqlInt32 = Value If iBlkundenrTmp.IsNull Then Throw New ArgumentOutOfRangeException("iBlkundenr", "iBlkundenr can't be NULL") End If m_iBlkundenr = Value End Set End Property Public Property [iNRAR00]() As SqlInt32 Get Return m_iNRAR00 End Get Set(ByVal Value As SqlInt32) Dim iNRAR00Tmp As SqlInt32 = Value If iNRAR00Tmp.IsNull Then Throw New ArgumentOutOfRangeException("iNRAR00", "iNRAR00 can't be NULL") End If m_iNRAR00 = Value End Set End Property Public Property [iMandantnr]() As SqlInt32 Get Return m_iMandantnr End Get Set(ByVal Value As SqlInt32) m_iMandantnr = Value End Set End Property Public Property [sAktiv]() As SqlString Get Return m_sAktiv End Get Set(ByVal Value As SqlString) m_sAktiv = 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 [daMutiert_am]() As SqlDateTime Get Return m_daMutiert_am End Get Set(ByVal Value As SqlDateTime) m_daMutiert_am = Value End Set End Property Public Property [iMutierer]() As SqlInt32 Get Return m_iMutierer End Get Set(ByVal Value As SqlInt32) Dim iMutiererTmp As SqlInt32 = Value If iMutiererTmp.IsNull Then Throw New ArgumentOutOfRangeException("iMutierer", "iMutierer can't be NULL") End If m_iMutierer = Value End Set End Property Public Property [sPeriodische_auslieferung]() As SqlString Get Return m_sPeriodische_auslieferung End Get Set(ByVal Value As SqlString) m_sPeriodische_auslieferung = Value End Set End Property Public Property [iPeriodizitaet]() As SqlInt32 Get Return m_iPeriodizitaet End Get Set(ByVal Value As SqlInt32) m_iPeriodizitaet = Value End Set End Property Public Property [daBlerklaerung_vom]() As SqlDateTime Get Return m_daBlerklaerung_vom End Get Set(ByVal Value As SqlDateTime) m_daBlerklaerung_vom = Value End Set End Property #End Region End Class End Namespace