' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'Mitarbeiter_Auswertungsparameter' ' // Generated by LLBLGen v1.21.2003.712 Final on: Sonntag, 18. April 2010, 08:36:51 ' // 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 'Mitarbeiter_Auswertungsparameter'. ''' Public Class clsMitarbeiter_Auswertungsparameter Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_bParamPrint As SqlBoolean Private m_iAuswertungnr, m_iMitarbeiter_AuswertungsparameterNr, m_iMitarbeiternr As SqlInt32 Private m_sTitelzeile2, m_sSQLWhere, m_sBeschreibung, m_sParameterdaten, m_sTitelzeile1 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_Mitarbeiter_Auswertungsparameter_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("@iAuswertungnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iAuswertungnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBeschreibung", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBeschreibung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sParameterdaten", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sParameterdaten)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sTitelzeile1", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTitelzeile1)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sTitelzeile2", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTitelzeile2)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bParamPrint", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bParamPrint)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sSQLWhere", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sSQLWhere)) scmCmdToExecute.Parameters.Add(new SqlParameter("@iMitarbeiter_AuswertungsparameterNr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiter_AuswertungsparameterNr)) 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_iMitarbeiter_AuswertungsparameterNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iMitarbeiter_AuswertungsparameterNr").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_Mitarbeiter_Auswertungsparameter_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("clsMitarbeiter_Auswertungsparameter::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_Mitarbeiter_Auswertungsparameter_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iMitarbeiter_AuswertungsparameterNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiter_AuswertungsparameterNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iMitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiternr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iAuswertungnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iAuswertungnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBeschreibung", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBeschreibung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sParameterdaten", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sParameterdaten)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sTitelzeile1", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTitelzeile1)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sTitelzeile2", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTitelzeile2)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bParamPrint", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bParamPrint)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sSQLWhere", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sSQLWhere)) 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_Mitarbeiter_Auswertungsparameter_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("clsMitarbeiter_Auswertungsparameter::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_Mitarbeiter_Auswertungsparameter_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iMitarbeiter_AuswertungsparameterNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiter_AuswertungsparameterNr)) 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_Mitarbeiter_Auswertungsparameter_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("clsMitarbeiter_Auswertungsparameter::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_Mitarbeiter_Auswertungsparameter_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("Mitarbeiter_Auswertungsparameter") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iMitarbeiter_AuswertungsparameterNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiter_AuswertungsparameterNr)) 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_Mitarbeiter_Auswertungsparameter_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iMitarbeiter_AuswertungsparameterNr = New SqlInt32(CType(dtToReturn.Rows(0)("Mitarbeiter_AuswertungsparameterNr"), 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)("Auswertungnr") Is System.DBNull.Value Then m_iAuswertungnr = SqlInt32.Null Else m_iAuswertungnr = New SqlInt32(CType(dtToReturn.Rows(0)("Auswertungnr"), Integer)) End If If dtToReturn.Rows(0)("Beschreibung") Is System.DBNull.Value Then m_sBeschreibung = SqlString.Null Else m_sBeschreibung = New SqlString(CType(dtToReturn.Rows(0)("Beschreibung"), String)) End If If dtToReturn.Rows(0)("Parameterdaten") Is System.DBNull.Value Then m_sParameterdaten = SqlString.Null Else m_sParameterdaten = New SqlString(CType(dtToReturn.Rows(0)("Parameterdaten"), String)) End If If dtToReturn.Rows(0)("Titelzeile1") Is System.DBNull.Value Then m_sTitelzeile1 = SqlString.Null Else m_sTitelzeile1 = New SqlString(CType(dtToReturn.Rows(0)("Titelzeile1"), String)) End If If dtToReturn.Rows(0)("Titelzeile2") Is System.DBNull.Value Then m_sTitelzeile2 = SqlString.Null Else m_sTitelzeile2 = New SqlString(CType(dtToReturn.Rows(0)("Titelzeile2"), String)) End If If dtToReturn.Rows(0)("ParamPrint") Is System.DBNull.Value Then m_bParamPrint = SqlBoolean.Null Else m_bParamPrint = New SqlBoolean(CType(dtToReturn.Rows(0)("ParamPrint"), Boolean)) End If If dtToReturn.Rows(0)("SQLWhere") Is System.DBNull.Value Then m_sSQLWhere = SqlString.Null Else m_sSQLWhere = New SqlString(CType(dtToReturn.Rows(0)("SQLWhere"), String)) End If End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsMitarbeiter_Auswertungsparameter::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_Mitarbeiter_Auswertungsparameter_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("Mitarbeiter_Auswertungsparameter") 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_Mitarbeiter_Auswertungsparameter_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("clsMitarbeiter_Auswertungsparameter::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 [iMitarbeiter_AuswertungsparameterNr]() As SqlInt32 Get Return m_iMitarbeiter_AuswertungsparameterNr End Get Set(ByVal Value As SqlInt32) Dim iMitarbeiter_AuswertungsparameterNrTmp As SqlInt32 = Value If iMitarbeiter_AuswertungsparameterNrTmp.IsNull Then Throw New ArgumentOutOfRangeException("iMitarbeiter_AuswertungsparameterNr", "iMitarbeiter_AuswertungsparameterNr can't be NULL") End If m_iMitarbeiter_AuswertungsparameterNr = 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 [iAuswertungnr]() As SqlInt32 Get Return m_iAuswertungnr End Get Set(ByVal Value As SqlInt32) m_iAuswertungnr = Value End Set End Property Public Property [sBeschreibung]() As SqlString Get Return m_sBeschreibung End Get Set(ByVal Value As SqlString) m_sBeschreibung = Value End Set End Property Public Property [sParameterdaten]() As SqlString Get Return m_sParameterdaten End Get Set(ByVal Value As SqlString) m_sParameterdaten = Value End Set End Property Public Property [sTitelzeile1]() As SqlString Get Return m_sTitelzeile1 End Get Set(ByVal Value As SqlString) m_sTitelzeile1 = Value End Set End Property Public Property [sTitelzeile2]() As SqlString Get Return m_sTitelzeile2 End Get Set(ByVal Value As SqlString) m_sTitelzeile2 = Value End Set End Property Public Property [bParamPrint]() As SqlBoolean Get Return m_bParamPrint End Get Set(ByVal Value As SqlBoolean) m_bParamPrint = Value End Set End Property Public Property [sSQLWhere]() As SqlString Get Return m_sSQLWhere End Get Set(ByVal Value As SqlString) m_sSQLWhere = Value End Set End Property #End Region End Class End Namespace