Listing A
'##############################################################################
' Author: Kevin Koch
' Description:  This class represents a facade layer and the component
'               tier where business logic is contained for functionality
'              regarding Customers.
'##############################################################################
 
 
 
 
Public Class CustomerServices
 
 
    Private Const CLASS_NAME As String = "CustomerServices"
 
 
 
 
 
 
    '#########################################################################################################################
    ' Creates a new customer
    '#########################################################################################################################
    Public Sub CreateCustomer(ByVal Email As String, ByVal Password As String, ByVal FirstName As String, ByVal LastName As String)
        Const METHOD_NAME As String = "CreateCustomer"
 
 
        Try
            Dim CustDb As CustomerDb = New CustomerDb()
            CustDb.CreateCustomer(Email, Password, FirstName, LastName)
 
 
        Catch dbEx As DbTierException
            'Exception has already been logged, just throw it to the ASPX
            Throw dbEx
        Catch ex As Exception
            'Exception occurred within this method, log it
            Log.WriteLogEntry(ex, Me.CLASS_NAME, METHOD_NAME)
            Throw New BizTierException(ex.Message, ex)
        End Try
    End Sub
 
 
 
 
    '#########################################################################################################################
    ' Validates a customer's email and password
    '#########################################################################################################################
    Public Function CustomerExists(ByVal Email As String, ByVal Password As String) As DataSet
        Const METHOD_NAME As String = "CustomerExists"
 
 
        Try
            Dim CustDb As CustomerDb = New CustomerDb()
            Return CustDb.CustomerExists(Email, Password)
 
 
        Catch dbEx As DbTierException
            'Exception has already been logged, just throw it to the ASPX
            Throw dbEx
        Catch ex As Exception
            'Exception occurred within this method, log it
            Log.WriteLogEntry(ex, Me.CLASS_NAME, METHOD_NAME)
            Throw New BizTierException(ex.Message, ex)
        End Try
    End Function
 
 
 
 
    '#########################################################################################################################
    ' Returns the customer by the specified Id
    '#########################################################################################################################
    Public Function GetCustomerById(ByVal CustomerId As Int32) As DataSet
        Const METHOD_NAME As String = "GetCustomerById"
 
 
        Try
            Dim CustDb As CustomerDb = New CustomerDb()
            Return CustDb.GetCustomerById(CustomerId)
 
 
        Catch dbEx As DbTierException
            'Exception has already been logged, just throw it to the ASPX
            Throw dbEx
        Catch ex As Exception
            'Exception occurred within this method, log it
            Log.WriteLogEntry(ex, Me.CLASS_NAME, METHOD_NAME)
            Throw New BizTierException(ex.Message, ex)
        End Try
    End Function
 
 
End Class