' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table '__Migr_ProdukteDB' ' // Generated by LLBLGen v1.21.2003.712 Final on: Montag, 9. November 2009, 17:12:10 ' // 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 TKB.VV.DB ''' ''' Purpose: Data Access class for the table '__Migr_ProdukteDB'. ''' Public Class cls__Migr_ProdukteDB Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_bMigriert As SqlBoolean Private m_daMutationsdatum As SqlDateTime Private m_iApplikationNr, m_iNreintrag As SqlInt32 Private m_sProdukt, m_sProdukt_ITSM, m_sBemerkung 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___Migr_ProdukteDB_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@sProdukt", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sProdukt)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sProdukt_ITSM", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sProdukt_ITSM)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iApplikationNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBemerkung", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBemerkung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bMigriert", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bMigriert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutationsdatum", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutationsdatum)) 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. m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery() m_iNreintrag = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@inreintrag").Value, Integer)) 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___Migr_ProdukteDB_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("cls__Migr_ProdukteDB::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___Migr_ProdukteDB_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@sProdukt", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sProdukt)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sProdukt_ITSM", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sProdukt_ITSM)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iApplikationNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iApplikationNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBemerkung", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBemerkung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bMigriert", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bMigriert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@inreintrag", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNreintrag)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutationsdatum", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutationsdatum)) 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. m_iRowsAffected = 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___Migr_ProdukteDB_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("cls__Migr_ProdukteDB::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___Migr_ProdukteDB_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. m_iRowsAffected = 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___Migr_ProdukteDB_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("cls__Migr_ProdukteDB::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___Migr_ProdukteDB_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("__Migr_ProdukteDB") 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 'pr___Migr_ProdukteDB_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then If dtToReturn.Rows(0)("Produkt") Is System.DBNull.Value Then m_sProdukt = SqlString.Null Else m_sProdukt = New SqlString(CType(dtToReturn.Rows(0)("Produkt"), String)) End If If dtToReturn.Rows(0)("Produkt_ITSM") Is System.DBNull.Value Then m_sProdukt_ITSM = SqlString.Null Else m_sProdukt_ITSM = New SqlString(CType(dtToReturn.Rows(0)("Produkt_ITSM"), String)) 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)("Bemerkung") Is System.DBNull.Value Then m_sBemerkung = SqlString.Null Else m_sBemerkung = New SqlString(CType(dtToReturn.Rows(0)("Bemerkung"), String)) End If If dtToReturn.Rows(0)("Migriert") Is System.DBNull.Value Then m_bMigriert = SqlBoolean.Null Else m_bMigriert = New SqlBoolean(CType(dtToReturn.Rows(0)("Migriert"), Boolean)) End If m_iNreintrag = New SqlInt32(CType(dtToReturn.Rows(0)("nreintrag"), Integer)) If dtToReturn.Rows(0)("Mutationsdatum") Is System.DBNull.Value Then m_daMutationsdatum = SqlDateTime.Null Else m_daMutationsdatum = New SqlDateTime(CType(dtToReturn.Rows(0)("Mutationsdatum"), 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("cls__Migr_ProdukteDB::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___Migr_ProdukteDB_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("__Migr_ProdukteDB") 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___Migr_ProdukteDB_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("cls__Migr_ProdukteDB::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 [sProdukt]() As SqlString Get Return m_sProdukt End Get Set(ByVal Value As SqlString) m_sProdukt = Value End Set End Property Public Property [sProdukt_ITSM]() As SqlString Get Return m_sProdukt_ITSM End Get Set(ByVal Value As SqlString) m_sProdukt_ITSM = 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 [sBemerkung]() As SqlString Get Return m_sBemerkung End Get Set(ByVal Value As SqlString) m_sBemerkung = Value End Set End Property Public Property [bMigriert]() As SqlBoolean Get Return m_bMigriert End Get Set(ByVal Value As SqlBoolean) m_bMigriert = Value End Set End Property 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 [daMutationsdatum]() As SqlDateTime Get Return m_daMutationsdatum End Get Set(ByVal Value As SqlDateTime) m_daMutationsdatum = Value End Set End Property #End Region End Class End Namespace