/// <summary> /// Constructor /// </summary> /// <exception cref="ex">BusinessLogicException</exception> public BookLogic() { try { _bookDAO = new BookDAO(); _tabBookDataTable = new BookDS.TabReservedDataTable(); _listBooksView = new List <ViewBookModel>(); _viewBookView = new BookDS.ViewBookDataTable(); _listTabReservedModel = new List <TabReservedModel>(); _tabReservedDataTable = new BookDS.TabReservedDataTable(); _viewBookAvailableDataTable = new BookDS.ViewBookAvailableDataTable(); _listViewBooksAvailableModel = new List <ViewBookAvailableModel>(); _viewBookReservedDataTable = new BookDS.ViewBookReservedDataTable(); _listViewBooksReservedModel = new List <ViewBookReservedModel>(); _viewBookBorrowedWithUserDataTable = new BookDS.ViewBookBorrowedWithUserDataTable(); _listViewBooksBorrowedWithUserModel = new List <ViewBookBorrowedWithUserModel>(); } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); throw new BusinessLogicException(ex.Message); } }
/// <summary> /// Return all registers from Book Available. /// </summary> /// <returns>List<T</returns> public List <ViewBookAvailableModel> GetAllAvailableBooks() { try { _listViewBooksAvailableModel = new List <ViewBookAvailableModel>(); _viewBookAvailableDataTable = _bookDAO.GetAllBooksAvailableView(); foreach (BookDS.ViewBookAvailableRow row in _viewBookAvailableDataTable.Rows) { _listViewBooksAvailableModel.Add(ViewBookAvailableModel.Parse(row)); } return(_listViewBooksAvailableModel); } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); throw new BusinessLogicException(ex.Message); } }
/// <summary> /// Search availabe books using ISBN, book name and author, only book name and only author. /// The book name and author are searched with partialy letter, it is not mandotory /// to inform the exact name. /// </summary> /// <param name="bookName">string bookName</param> /// <param name="author">string author</param> /// <returns>List<ViewBookAvailableModel></returns> public List <ViewBookAvailableModel> GetAllBooksAvailableByBookNameAndAuthor(string bookName, string author) { try { _listViewBooksAvailableModel = new List <ViewBookAvailableModel>(); if (bookName != "" || author != "") { _viewBookAvailableDataTable = _bookDAO.GetAllBooksAvailableByBookNameAndAuthorView(bookName, author); foreach (BookDS.ViewBookAvailableRow row in _viewBookAvailableDataTable.Rows) { _listViewBooksAvailableModel.Add(ViewBookAvailableModel.Parse(row)); } } return(_listViewBooksAvailableModel); } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); throw new BusinessLogicException(ex.Message); } }