' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'WindowPositions' ' // Generated by LLBLGen v1.2.1045.38210 Final on: Montag, 3. Februar 2003, 22:23:16 ' // 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 'WindowPositions'. ' /// Public Class clsWindowPositions Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_iTopleft, m_iWidth, m_iHeight, m_iEintragnr, m_iMitarbeiternr As SqlInt32 Private m_sWindow 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_WindowPositions_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("@swindow", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sWindow)) scmCmdToExecute.Parameters.Add(New SqlParameter("@itopleft", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iTopleft)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iwidth", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iWidth)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iheight", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iHeight)) scmCmdToExecute.Parameters.Add(new SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr)) 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_iEintragnr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@ieintragnr").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 'pr_WindowPositions_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("clsWindowPositions::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_WindowPositions_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@imitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMitarbeiternr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@swindow", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sWindow)) scmCmdToExecute.Parameters.Add(New SqlParameter("@itopleft", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iTopleft)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iwidth", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iWidth)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iheight", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iHeight)) 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_WindowPositions_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("clsWindowPositions::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_WindowPositions_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr)) 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_WindowPositions_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("clsWindowPositions::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_WindowPositions_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("WindowPositions") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr)) 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_WindowPositions_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iEintragnr = New SqlInt32(CType(dtToReturn.Rows(0)("eintragnr"), 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)("window") Is System.DBNull.Value Then m_sWindow = SqlString.Null Else m_sWindow = New SqlString(CType(dtToReturn.Rows(0)("window"), String)) End If If dtToReturn.Rows(0)("topleft") Is System.DBNull.Value Then m_iTopleft = SqlInt32.Null Else m_iTopleft = New SqlInt32(CType(dtToReturn.Rows(0)("topleft"), Integer)) End If If dtToReturn.Rows(0)("width") Is System.DBNull.Value Then m_iWidth = SqlInt32.Null Else m_iWidth = New SqlInt32(CType(dtToReturn.Rows(0)("width"), Integer)) End If If dtToReturn.Rows(0)("height") Is System.DBNull.Value Then m_iHeight = SqlInt32.Null Else m_iHeight = New SqlInt32(CType(dtToReturn.Rows(0)("height"), 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("clsWindowPositions::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_WindowPositions_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("WindowPositions") 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_WindowPositions_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("clsWindowPositions::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 [iEintragnr]() As SqlInt32 Get Return m_iEintragnr End Get Set(ByVal Value As SqlInt32) Dim iEintragnrTmp As SqlInt32 = Value If iEintragnrTmp.IsNull Then Throw New ArgumentOutOfRangeException("iEintragnr", "iEintragnr can't be NULL") End If m_iEintragnr = 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 [sWindow]() As SqlString Get Return m_sWindow End Get Set(ByVal Value As SqlString) m_sWindow = Value End Set End Property Public Property [iTopleft]() As SqlInt32 Get Return m_iTopleft End Get Set(ByVal Value As SqlInt32) m_iTopleft = Value End Set End Property Public Property [iWidth]() As SqlInt32 Get Return m_iWidth End Get Set(ByVal Value As SqlInt32) m_iWidth = Value End Set End Property Public Property [iHeight]() As SqlInt32 Get Return m_iHeight End Get Set(ByVal Value As SqlInt32) m_iHeight = Value End Set End Property #End Region End Class End Namespace