Listing B
'##############################################################################
' Author: Kevin Koch
' Description:  This class represents a facade layer and the component
'               tier where business logic is contained for functionality
'              regarding Orders
'##############################################################################
 
 
 
 
Public Class OrderServices
    Private Const CLASS_NAME As String = "OrderServices"
 
 
    '#########################################################################################################################
    ' Searches the orders table for a particular customers orders
    '#########################################################################################################################
    Public Function GetOrdersByCustomer(ByVal CustomerId As Int32, ByVal OrderStatus As String) As DataSet
        Const METHOD_NAME As String = "GetOrdersByCustomer"
 
 
        Try
            Dim DbObj As OrderDb = New OrderDb()
            Return DbObj.GetOrdersByCustomer(CustomerId, OrderStatus)
 
 
        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
 
 
 
 
    '#########################################################################################################################
    ' Creates a new pending order
    '#########################################################################################################################
    Public Function CreateOrder(ByVal CustomerId As Int32) As Int32
        Const METHOD_NAME As String = "CreateOrder"
 
 
        Try
            Dim DbObj As OrderDb = New OrderDb()
            Return DbObj.CreateOrder(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
 
 
 
 
    '#########################################################################################################################
    ' Deletes the OrderId specified
    '#########################################################################################################################
    Public Sub DeleteOrder(ByVal OrderId As Int32)
        Const METHOD_NAME As String = "DeleteOrder"
 
 
        Try
            Dim DbObj As OrderDb = New OrderDb()
            DbObj.DeleteOrder(OrderId)
 
 
        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
 
 
 
 
    '#########################################################################################################################
    ' Confirms a pending order by updating its status to Complete
    '#########################################################################################################################
    Public Function ConfirmOrder(ByVal OrderId As Int32) As DataSet
        Const METHOD_NAME As String = "ConfirmOrder"
 
 
        Try
            Dim DbObj As OrderDb = New OrderDb()
            Return DbObj.ConfirmOrder(OrderId)
 
 
        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