Update 20230511

This commit is contained in:
2023-05-11 07:16:02 +02:00
parent 216c1102cd
commit 340847a5ae
135 changed files with 118556 additions and 118187 deletions

View File

@@ -0,0 +1,267 @@
-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Mittwoch, 10. Mai 2023, 18:42:06
-- For the Low Level Business Logic Layer for the database 'bea_20210830'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [bea_20210830]
GO
-- ========================================================================================================
-- [Stored Procedures generated for table: Personal]
GO
-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Personal_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_Insert]
GO
---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Personal'
-- Gets: @iPersonalnr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sTGNummer varchar(255)
-- Gets: @sName varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @sVerantwTKBMA varchar(255)
-- Gets: @sNextControlDate varchar(255)
-- Gets: @sEMail varchar(255)
-- Gets: @sHauptnutzer varchar(255)
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Insert]
@iPersonalnr int,
@iParentID int,
@sBezeichnung varchar(255),
@sBeschreibung varchar(255),
@sTGNummer varchar(255),
@sName varchar(255),
@iSequenz int,
@bAktiv bit,
@daErstellt_am datetime,
@daMutiert_am datetime,
@iMutierer int,
@sVerantwTKBMA varchar(255),
@sNextControlDate varchar(255),
@sEMail varchar(255),
@sHauptnutzer varchar(255),
@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Personal]
(
[Personalnr],
[ParentID],
[Bezeichnung],
[Beschreibung],
[TGNummer],
[Name],
[Sequenz],
[Aktiv],
[Erstellt_am],
[Mutiert_am],
[Mutierer],
[VerantwTKBMA],
[NextControlDate],
[EMail],
[Hauptnutzer]
)
VALUES
(
@iPersonalnr,
@iParentID,
@sBezeichnung,
@sBeschreibung,
@sTGNummer,
@sName,
@iSequenz,
@bAktiv,
@daErstellt_am,
@daMutiert_am,
@iMutierer,
@sVerantwTKBMA,
@sNextControlDate,
@sEMail,
@sHauptnutzer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO
-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Personal_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_Update]
GO
---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Personal'
-- Gets: @iPersonalnr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sTGNummer varchar(255)
-- Gets: @sName varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @sVerantwTKBMA varchar(255)
-- Gets: @sNextControlDate varchar(255)
-- Gets: @sEMail varchar(255)
-- Gets: @sHauptnutzer varchar(255)
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Update]
@iPersonalnr int,
@iParentID int,
@sBezeichnung varchar(255),
@sBeschreibung varchar(255),
@sTGNummer varchar(255),
@sName varchar(255),
@iSequenz int,
@bAktiv bit,
@daErstellt_am datetime,
@daMutiert_am datetime,
@iMutierer int,
@sVerantwTKBMA varchar(255),
@sNextControlDate varchar(255),
@sEMail varchar(255),
@sHauptnutzer varchar(255),
@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Personal]
SET
[ParentID] = @iParentID,
[Bezeichnung] = @sBezeichnung,
[Beschreibung] = @sBeschreibung,
[TGNummer] = @sTGNummer,
[Name] = @sName,
[Sequenz] = @iSequenz,
[Aktiv] = @bAktiv,
[Erstellt_am] = @daErstellt_am,
[Mutiert_am] = @daMutiert_am,
[Mutierer] = @iMutierer,
[VerantwTKBMA] = @sVerantwTKBMA,
[NextControlDate] = @sNextControlDate,
[EMail] = @sEMail,
[Hauptnutzer] = @sHauptnutzer
WHERE
[Personalnr] = @iPersonalnr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO
-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Personal_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_Delete]
GO
---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Personal'
-- using the Primary Key.
-- Gets: @iPersonalnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Delete]
@iPersonalnr int,
@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Personal]
WHERE
[Personalnr] = @iPersonalnr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO
-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Personal_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_SelectOne]
GO
---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Personal'
-- based on the Primary Key.
-- Gets: @iPersonalnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_SelectOne]
@iPersonalnr int,
@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
[Personalnr],
[ParentID],
[Bezeichnung],
[Beschreibung],
[TGNummer],
[Name],
[Sequenz],
[Aktiv],
[Erstellt_am],
[Mutiert_am],
[Mutierer],
[VerantwTKBMA],
[NextControlDate],
[EMail],
[Hauptnutzer]
FROM [dbo].[Personal]
WHERE
[Personalnr] = @iPersonalnr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO
-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Personal_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_SelectAll]
GO
---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Personal'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_SelectAll]
@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
[Personalnr],
[ParentID],
[Bezeichnung],
[Beschreibung],
[TGNummer],
[Name],
[Sequenz],
[Aktiv],
[Erstellt_am],
[Mutiert_am],
[Mutierer],
[VerantwTKBMA],
[NextControlDate],
[EMail],
[Hauptnutzer]
FROM [dbo].[Personal]
ORDER BY
[Personalnr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO
-- [End of Stored Procedures for table: Personal]
-- ========================================================================================================
GO

View File

@@ -1,236 +1,236 @@
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Namespace DB
Public Class clsConnectionProvider
Implements IDisposable
#Region " Class Member Declarations "
Private m_scoDBConnection As SqlConnection
Private m_bIsTransactionPending, m_bIsDisposed As Boolean
Private m_stCurrentTransaction As SqlTransaction
Private m_alSavePoints As ArrayList
#End Region
Public Sub New()
' // Init the class
InitClass()
End Sub
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If Not (m_stCurrentTransaction Is Nothing) Then
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
End If
If Not (m_scoDBConnection Is Nothing) Then
' // closing the connection will abort (rollback) any pending transactions
m_scoDBConnection.Close()
m_scoDBConnection.Dispose()
m_scoDBConnection = Nothing
End If
End If
End If
m_bIsDisposed = True
End Sub
Private Sub InitClass()
' // Create all the objects and initialize other members.
m_scoDBConnection = new SqlConnection()
m_bIsDisposed = False
m_stCurrentTransaction = Nothing
m_bIsTransactionPending = False
m_alSavePoints = new ArrayList()
End Sub
Public Function OpenConnection() As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) > 0 Then
' // It's already open.
Throw New Exception("OpenConnection::Connection is already open.")
End If
m_scoDBConnection.Open()
m_bIsTransactionPending = False
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function BeginTransaction(sTransactionName As String) As Boolean
Try
If m_bIsTransactionPending Then
' // no nested transactions allowed.
Throw New Exception("BeginTransaction::Already transaction pending. Nesting not allowed")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("BeginTransaction::Connection is not open.")
End If
' // begin the transaction and store the transaction object.
m_stCurrentTransaction = m_scoDBConnection.BeginTransaction(IsolationLevel.ReadCommitted, sTransactionName)
m_bIsTransactionPending = True
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function CommitTransaction() As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("CommitTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("CommitTransaction::Connection is not open.")
End if
' // commit the transaction
m_stCurrentTransaction.Commit()
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function RollbackTransaction(sTransactionToRollback As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("RollbackTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("RollbackTransaction::Connection is not open.")
End If
' // rollback the transaction
m_stCurrentTransaction.Rollback(sTransactionToRollback)
' // if this wasn't a savepoint, we've rolled back the complete transaction, so we
' // can clean it up.
If Not m_alSavePoints.Contains(sTransactionToRollback) Then
' // it's not a savepoint
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function SaveTransaction(sSavePointName As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("SaveTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("SaveTransaction::Connection is not open.")
End If
' // save the transaction
m_stCurrentTransaction.Save(sSavePointName)
' // Store the savepoint in the list.
m_alSavePoints.Add(sSavePointName)
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function CloseConnection(bCommitPendingTransaction As Boolean) As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // No open connection
Return False
End If
If m_bIsTransactionPending Then
If bCommitPendingTransaction Then
' // Commit the pending transaction
m_stCurrentTransaction.Commit()
Else
' // Rollback the pending transaction
m_stCurrentTransaction.Rollback()
End If
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
' // close the connection
m_scoDBConnection.Close()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
#Region " Class Property Declarations "
Public ReadOnly Property stCurrentTransaction() As SqlTransaction
Get
Return m_stCurrentTransaction
End Get
End Property
Public ReadOnly Property bIsTransactionPending() As Boolean
Get
Return m_bIsTransactionPending
End Get
End Property
Public ReadOnly Property scoDBConnection() As SqlConnection
Get
Return m_scoDBConnection
End Get
End Property
Public WriteOnly Property sConnectionString() As String
Set (ByVal Value As String)
m_scoDBConnection.ConnectionString = Value
End Set
End Property
#End Region
End Class
End Namespace
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Namespace DB
Public Class clsConnectionProvider
Implements IDisposable
#Region " Class Member Declarations "
Private m_scoDBConnection As SqlConnection
Private m_bIsTransactionPending, m_bIsDisposed As Boolean
Private m_stCurrentTransaction As SqlTransaction
Private m_alSavePoints As ArrayList
#End Region
Public Sub New()
' // Init the class
InitClass()
End Sub
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If Not (m_stCurrentTransaction Is Nothing) Then
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
End If
If Not (m_scoDBConnection Is Nothing) Then
' // closing the connection will abort (rollback) any pending transactions
m_scoDBConnection.Close()
m_scoDBConnection.Dispose()
m_scoDBConnection = Nothing
End If
End If
End If
m_bIsDisposed = True
End Sub
Private Sub InitClass()
' // Create all the objects and initialize other members.
m_scoDBConnection = new SqlConnection()
m_bIsDisposed = False
m_stCurrentTransaction = Nothing
m_bIsTransactionPending = False
m_alSavePoints = new ArrayList()
End Sub
Public Function OpenConnection() As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) > 0 Then
' // It's already open.
Throw New Exception("OpenConnection::Connection is already open.")
End If
m_scoDBConnection.Open()
m_bIsTransactionPending = False
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function BeginTransaction(sTransactionName As String) As Boolean
Try
If m_bIsTransactionPending Then
' // no nested transactions allowed.
Throw New Exception("BeginTransaction::Already transaction pending. Nesting not allowed")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("BeginTransaction::Connection is not open.")
End If
' // begin the transaction and store the transaction object.
m_stCurrentTransaction = m_scoDBConnection.BeginTransaction(IsolationLevel.ReadCommitted, sTransactionName)
m_bIsTransactionPending = True
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function CommitTransaction() As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("CommitTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("CommitTransaction::Connection is not open.")
End if
' // commit the transaction
m_stCurrentTransaction.Commit()
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function RollbackTransaction(sTransactionToRollback As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("RollbackTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("RollbackTransaction::Connection is not open.")
End If
' // rollback the transaction
m_stCurrentTransaction.Rollback(sTransactionToRollback)
' // if this wasn't a savepoint, we've rolled back the complete transaction, so we
' // can clean it up.
If Not m_alSavePoints.Contains(sTransactionToRollback) Then
' // it's not a savepoint
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function SaveTransaction(sSavePointName As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("SaveTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("SaveTransaction::Connection is not open.")
End If
' // save the transaction
m_stCurrentTransaction.Save(sSavePointName)
' // Store the savepoint in the list.
m_alSavePoints.Add(sSavePointName)
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
Public Function CloseConnection(bCommitPendingTransaction As Boolean) As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // No open connection
Return False
End If
If m_bIsTransactionPending Then
If bCommitPendingTransaction Then
' // Commit the pending transaction
m_stCurrentTransaction.Commit()
Else
' // Rollback the pending transaction
m_stCurrentTransaction.Rollback()
End If
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
' // close the connection
m_scoDBConnection.Close()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
#Region " Class Property Declarations "
Public ReadOnly Property stCurrentTransaction() As SqlTransaction
Get
Return m_stCurrentTransaction
End Get
End Property
Public ReadOnly Property bIsTransactionPending() As Boolean
Get
Return m_bIsTransactionPending
End Get
End Property
Public ReadOnly Property scoDBConnection() As SqlConnection
Get
Return m_scoDBConnection
End Get
End Property
Public WriteOnly Property sConnectionString() As String
Set (ByVal Value As String)
m_scoDBConnection.ConnectionString = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -1,167 +1,167 @@
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Namespace DB
Public Enum LLBLError
AllOk
' // Add more here (check the comma's!)
End Enum
Public Interface ICommonDBAccess
Function Insert() As Boolean
Function Update() As Boolean
Function Delete() As Boolean
Function SelectOne() As DataTable
Function SelectAll() As DataTable
End Interface
Public MustInherit Class clsDBInteractionBase
Implements IDisposable
Implements ICommonDBAccess
#Region " Class Member Declarations "
Protected m_scoMainConnection As SqlConnection
Protected m_iRowsAffected As Integer
Protected m_iErrorCode As SqlInt32
Protected m_bMainConnectionIsCreatedLocal As Boolean
Protected m_cpMainConnectionProvider As clsConnectionProvider
Private m_sConnectionString As String
Private m_bIsDisposed As Boolean
#End Region
Public Sub New()
' // Initialize the class' members.
InitClass()
End Sub
Private Sub InitClass()
' // create all the objects and initialize other members.
m_scoMainConnection = new SqlConnection()
m_bMainConnectionIsCreatedLocal = True
m_cpMainConnectionProvider = Nothing
m_iErrorCode = New SqlInt32(LLBLError.AllOk)
m_bIsDisposed = False
End Sub
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If m_bMainConnectionIsCreatedLocal Then
' // Object is created in this class, so destroy it here.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
m_bMainConnectionIsCreatedLocal = True
End If
m_cpMainConnectionProvider = Nothing
m_scoMainConnection = Nothing
End If
End If
m_bIsDisposed = True
End Sub
Public Overridable Function Insert() As Boolean Implements ICommonDBAccess.Insert
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function Delete() As Boolean Implements ICommonDBAccess.Delete
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function Update() As Boolean Implements ICommonDBAccess.Update
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function SelectOne() As DataTable Implements ICommonDBAccess.SelectOne
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function SelectAll() As DataTable Implements ICommonDBAccess.SelectAll
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
#Region " Class Property Declarations "
Public WriteOnly Property cpMainConnectionProvider() As clsConnectionProvider
Set(ByVal Value As clsConnectionProvider)
If Value Is Nothing Then
' // Invalid value
Throw New ArgumentNullException("cpMainConnectionProvider", "Nothing passed as value to this property which is not allowed.")
End If
' // A connection provider object is passed to this class.
' // Retrieve the SqlConnection object, if present and create a
' // reference to it. If there is already a MainConnection object
' // referenced by the membervar, destroy that one or simply
' // remove the reference, based on the flag.
If Not (m_scoMainConnection Is Nothing) Then
' // First get rid of current connection object. Caller is responsible
If m_bMainConnectionIsCreatedLocal Then
' // Is local created object, close it and dispose it.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
End If
' // Remove reference.
m_scoMainConnection = Nothing
End If
m_cpMainConnectionProvider = CType(Value, clsConnectionProvider)
m_scoMainConnection = m_cpMainConnectionProvider.scoDBConnection
m_bMainConnectionIsCreatedLocal = False
End Set
End Property
Public ReadOnly Property iErrorCode() As SqlInt32
Get
Return m_iErrorCode
End Get
End Property
Public Property sConnectionString() As String
Get
Return m_sConnectionString
End Get
Set (ByVal Value As String)
m_sConnectionString = Value
m_scoMainConnection.ConnectionString = m_sConnectionString
End Set
End Property
Public Readonly Property iRowsAffected() As Integer
Get
Return m_iRowsAffected
End Get
End Property
#End Region
End Class
End Namespace
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Namespace DB
Public Enum LLBLError
AllOk
' // Add more here (check the comma's!)
End Enum
Public Interface ICommonDBAccess
Function Insert() As Boolean
Function Update() As Boolean
Function Delete() As Boolean
Function SelectOne() As DataTable
Function SelectAll() As DataTable
End Interface
Public MustInherit Class clsDBInteractionBase
Implements IDisposable
Implements ICommonDBAccess
#Region " Class Member Declarations "
Protected m_scoMainConnection As SqlConnection
Protected m_iRowsAffected As Integer
Protected m_iErrorCode As SqlInt32
Protected m_bMainConnectionIsCreatedLocal As Boolean
Protected m_cpMainConnectionProvider As clsConnectionProvider
Private m_sConnectionString As String
Private m_bIsDisposed As Boolean
#End Region
Public Sub New()
' // Initialize the class' members.
InitClass()
End Sub
Private Sub InitClass()
' // create all the objects and initialize other members.
m_scoMainConnection = new SqlConnection()
m_bMainConnectionIsCreatedLocal = True
m_cpMainConnectionProvider = Nothing
m_iErrorCode = New SqlInt32(LLBLError.AllOk)
m_bIsDisposed = False
End Sub
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If m_bMainConnectionIsCreatedLocal Then
' // Object is created in this class, so destroy it here.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
m_bMainConnectionIsCreatedLocal = True
End If
m_cpMainConnectionProvider = Nothing
m_scoMainConnection = Nothing
End If
End If
m_bIsDisposed = True
End Sub
Public Overridable Function Insert() As Boolean Implements ICommonDBAccess.Insert
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function Delete() As Boolean Implements ICommonDBAccess.Delete
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function Update() As Boolean Implements ICommonDBAccess.Update
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function SelectOne() As DataTable Implements ICommonDBAccess.SelectOne
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
Public Overridable Function SelectAll() As DataTable Implements ICommonDBAccess.SelectAll
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
#Region " Class Property Declarations "
Public WriteOnly Property cpMainConnectionProvider() As clsConnectionProvider
Set(ByVal Value As clsConnectionProvider)
If Value Is Nothing Then
' // Invalid value
Throw New ArgumentNullException("cpMainConnectionProvider", "Nothing passed as value to this property which is not allowed.")
End If
' // A connection provider object is passed to this class.
' // Retrieve the SqlConnection object, if present and create a
' // reference to it. If there is already a MainConnection object
' // referenced by the membervar, destroy that one or simply
' // remove the reference, based on the flag.
If Not (m_scoMainConnection Is Nothing) Then
' // First get rid of current connection object. Caller is responsible
If m_bMainConnectionIsCreatedLocal Then
' // Is local created object, close it and dispose it.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
End If
' // Remove reference.
m_scoMainConnection = Nothing
End If
m_cpMainConnectionProvider = CType(Value, clsConnectionProvider)
m_scoMainConnection = m_cpMainConnectionProvider.scoDBConnection
m_bMainConnectionIsCreatedLocal = False
End Set
End Property
Public ReadOnly Property iErrorCode() As SqlInt32
Get
Return m_iErrorCode
End Get
End Property
Public Property sConnectionString() As String
Get
Return m_sConnectionString
End Get
Set (ByVal Value As String)
m_sConnectionString = Value
m_scoMainConnection.ConnectionString = m_sConnectionString
End Set
End Property
Public Readonly Property iRowsAffected() As Integer
Get
Return m_iRowsAffected
End Get
End Property
#End Region
End Class
End Namespace

File diff suppressed because it is too large Load Diff