'############################################################################## ' Author: Kevin Koch ' Description: This class represents a facade layer and the component ' tier where business logic is contained for functionality ' regarding Books '############################################################################## Public Class BookServices Private Const CLASS_NAME As String = "BookServices" '######################################################################################################################### ' Returns a set of books, filtered by the criteria parameters '######################################################################################################################### Public Function GetBooks(ByVal BookId As Int32, ByVal AuthorName As String, ByVal BookName As String, ByVal AvailabilityId As Int32) As DataSet Const METHOD_NAME As String = "GetBooks" Try Dim DbObj As BookDb = New BookDb() Return DbObj.GetBooks(BookId, AuthorName, BookName, AvailabilityId) 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 '######################################################################################################################### ' Updates the BookId specified with the parameter values '######################################################################################################################### Public Sub UpdateBook(ByVal BookId As Int32, ByVal AuthorName As String, ByVal BookName As String, ByVal Price As Double, _ ByVal AvailabilityId As Int32) Const METHOD_NAME As String = "UpdateBook" Try Dim DbObj As BookDb = New BookDb() DbObj.UpdateBook(BookId, AuthorName, BookName, Price, AvailabilityId) 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 '######################################################################################################################### ' Returns a set of books, filtered by the ids in the arraylist '######################################################################################################################### Public Function GetBooksByIds(ByVal BookIds As ArrayList) As DataSet Const METHOD_NAME As String = "GetBooksByIds" Try Dim DbObj As BookDb = New BookDb() Return DbObj.GetBooksByIds(BookIds) 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 |