Exemple #1
0
        /// <summary>
        /// Check if the ISBN if present in the viewBookBorrowed table
        /// </summary>
        /// <param name="ISBN">string</param>
        /// <returns></returns>
        public List <ViewBookBorrowedModel> CheckBookSelected(string ISBN)
        {
            List <ViewBookBorrowedModel> _books = new List <ViewBookBorrowedModel>();

            _borrowTable = _bookDao.CheckBookBorrowed(ISBN);

            foreach (DataSet1.ViewBookBorrowedRow booksRow in _borrowTable.Rows)
            {
                ViewBookBorrowedModel tempRow = ViewBookBorrowedModel.Parse(booksRow);
                _books.Add(tempRow);
            }

            return(_books);
        }
Exemple #2
0
        public List <ViewBookBorrowedModel> ListBooksBorrowed()
        {
            List <ViewBookBorrowedModel> _books = new List <ViewBookBorrowedModel>();

            _borrowTable = _bookDao.ListBooksBorrowed();

            foreach (DataSet1.ViewBookBorrowedRow bookRows in _borrowTable.Rows)
            {
                ViewBookBorrowedModel tempRow = ViewBookBorrowedModel.Parse(bookRows);
                _books.Add(tempRow);
            }

            return(_books);
        }
Exemple #3
0
        /// <summary>
        /// Return all registers from Book Borrowed by UserId.
        /// </summary>
        /// <param name="userId">int userId</param>
        /// <returns>List<ViewBookBorrowedModel></returns>
        public List <ViewBookBorrowedModel> GetAllBorrowedBooksByUserId(int userId)
        {
            try
            {
                _listViewBooksBorrowedModel = new List <ViewBookBorrowedModel>();
                _viewBookBorrowedDataTable  = _bookDAO.GetAllBooksBorrowedView();

                foreach (BookDS.ViewBookBorrowedRow row in _viewBookBorrowedDataTable.Rows)
                {
                    _listViewBooksBorrowedModel.Add(ViewBookBorrowedModel.Parse(row));
                }

                return(_listViewBooksBorrowedModel);
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                throw new BusinessLogicException(ex.Message);
            }
        }