' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'coldupdate' ' // Generated by LLBLGen v1.2.1045.38210 Final on: Donnerstag, 5. Juni 2003, 22:13:30 ' // 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 'coldupdate'. ' /// Public Class clsColdupdate Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_iStatus, m_iStatusdatum, m_iNreintrag As SqlInt32 Private m_sNeuerwert, m_sAlterwert, m_sDokumentid, m_sColddokumentid, m_sFeldname 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.[pr_coldupdate_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@sdokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sDokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@scolddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sColddokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sfeldname", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sFeldname)) scmCmdToExecute.Parameters.Add(New SqlParameter("@salterwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAlterwert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sneuerwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sNeuerwert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@istatus", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iStatus)) scmCmdToExecute.Parameters.Add(New SqlParameter("@istatusdatum", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iStatusdatum)) 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 = scmCmdToExecute.Parameters.Item("@inreintrag").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_coldupdate_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("clsColdupdate::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_coldupdate_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("@sdokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sDokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@scolddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sColddokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sfeldname", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sFeldname)) scmCmdToExecute.Parameters.Add(New SqlParameter("@salterwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAlterwert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sneuerwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sNeuerwert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@istatus", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iStatus)) scmCmdToExecute.Parameters.Add(New SqlParameter("@istatusdatum", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iStatusdatum)) 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_coldupdate_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("clsColdupdate::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_coldupdate_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 = scmCmdToExecute.Parameters.Item("@iErrorCode").Value If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_coldupdate_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("clsColdupdate::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_coldupdate_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("coldupdate") 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 = scmCmdToExecute.Parameters.Item("@iErrorCode").Value If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_coldupdate_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)("dokumentid") Is System.DBNull.Value Then m_sDokumentid = SqlString.Null Else m_sDokumentid = New SqlString(CType(dtToReturn.Rows(0)("dokumentid"), String)) End If If dtToReturn.Rows(0)("colddokumentid") Is System.DBNull.Value Then m_sColddokumentid = SqlString.Null Else m_sColddokumentid = New SqlString(CType(dtToReturn.Rows(0)("colddokumentid"), String)) End If If dtToReturn.Rows(0)("feldname") Is System.DBNull.Value Then m_sFeldname = SqlString.Null Else m_sFeldname = New SqlString(CType(dtToReturn.Rows(0)("feldname"), String)) End If If dtToReturn.Rows(0)("alterwert") Is System.DBNull.Value Then m_sAlterwert = SqlString.Null Else m_sAlterwert = New SqlString(CType(dtToReturn.Rows(0)("alterwert"), String)) End If If dtToReturn.Rows(0)("neuerwert") Is System.DBNull.Value Then m_sNeuerwert = SqlString.Null Else m_sNeuerwert = New SqlString(CType(dtToReturn.Rows(0)("neuerwert"), String)) End If If dtToReturn.Rows(0)("status") Is System.DBNull.Value Then m_iStatus = SqlInt32.Null Else m_iStatus = New SqlInt32(CType(dtToReturn.Rows(0)("status"), Integer)) End If If dtToReturn.Rows(0)("statusdatum") Is System.DBNull.Value Then m_iStatusdatum = SqlInt32.Null Else m_iStatusdatum = New SqlInt32(CType(dtToReturn.Rows(0)("statusdatum"), 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("clsColdupdate::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_coldupdate_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("coldupdate") 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_coldupdate_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("clsColdupdate::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 [sDokumentid]() As SqlString Get Return m_sDokumentid End Get Set(ByVal Value As SqlString) m_sDokumentid = Value End Set End Property Public Property [sColddokumentid]() As SqlString Get Return m_sColddokumentid End Get Set(ByVal Value As SqlString) m_sColddokumentid = Value End Set End Property Public Property [sFeldname]() As SqlString Get Return m_sFeldname End Get Set(ByVal Value As SqlString) m_sFeldname = Value End Set End Property Public Property [sAlterwert]() As SqlString Get Return m_sAlterwert End Get Set(ByVal Value As SqlString) m_sAlterwert = Value End Set End Property Public Property [sNeuerwert]() As SqlString Get Return m_sNeuerwert End Get Set(ByVal Value As SqlString) m_sNeuerwert = Value End Set End Property Public Property [iStatus]() As SqlInt32 Get Return m_iStatus End Get Set(ByVal Value As SqlInt32) m_iStatus = Value End Set End Property Public Property [iStatusdatum]() As SqlInt32 Get Return m_iStatusdatum End Get Set(ByVal Value As SqlInt32) m_iStatusdatum = Value End Set End Property #End Region End Class End Namespace