Exemplo n.º 1
0
        private void FillData(string filter, int userID)
        {
            TradingDAO tradingDAO = new TradingDAO();
            BookDAO    bookDAO    = new BookDAO();
            UserDAO    userDAO    = new UserDAO();

            if (filter == "Available")
            {
                tradings   = tradingDAO.GetAvailableLending(userID, page);
                totalPages = tradingDAO.getPages("AvailableLending", userID);
            }
            else if (filter == "Pending")
            {
                tradings   = tradingDAO.GetPendingLending(userID, page);
                totalPages = tradingDAO.getPages("PendingLending", userID);
            }
            else if (filter == "Lending")
            {
                tradings   = tradingDAO.GetLending(userID, page);
                totalPages = tradingDAO.getPages("Lending", userID);
            }
            else if (filter == "Completed")
            {
                tradings   = tradingDAO.GetCompletedLending(userID, page);
                totalPages = tradingDAO.getPages("CompletedLending", userID);
            }

            foreach (Trading t in tradings)
            {
                books.Add(bookDAO.GetById(t.BookID));
                if (filter != "Available")
                {
                    borrowers.Add(userDAO.GetById(t.BorrowerID));
                }
            }
        }