'############################################################################## ' 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" '######################################################################################################################### ' Returns a set of orders, filtered by the criteria parameters '######################################################################################################################### Public Function GetOrders(ByVal OrderId As Int32, ByVal OrderStatus As String, ByVal ClientId As Int32) As DataSet Const METHOD_NAME As String = "GetOrders" Try Dim DbObj As OrderDb = New OrderDb() Return DbObj.GetOrders(OrderId, OrderStatus, ClientId) 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 Sub CreateOrder(ByVal OrderId As Int32, ByVal BookIds As ArrayList, ByVal ClientId As Int32) Const METHOD_NAME As String = "CreateOrder" Try Dim DbObj As OrderDb = New OrderDb() DbObj.CreateOrder(OrderId, BookIds, ClientId) 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 Sub ConfirmOrder(ByVal OrderId As Int32) Const METHOD_NAME As String = "ConfirmOrder" Try Dim DbObj As OrderDb = New OrderDb() 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 Sub End Class |