public List <Book> RetrieveBooksList()
        {
            List <Book> books = null;

            BookCheckInCheckOutDBOperations db = BookCheckInCheckOutDBOperations.getInstance();

            IDataReader reader = db.RetrieveBooksList();

            DataTable dt = SchemaInfo.CreateBookDetailsSchemaTable();


            if (reader != null)
            {
                books = new List <Book>();

                while (reader.Read())
                {
                    books.Add(new Book
                    {
                        BookID      = (int)reader["BookID"],
                        Title       = (string)reader["Title"],
                        ISBN        = (string)reader["ISBN"],
                        PublishYear = (string)reader["PublishYear"],
                        CoverPrice  = (decimal)reader["CoverPrice"],
                        CheckOutStatusDescription = (string)reader["CheckOutStatusDescription"]
                    });
                }
            }



            return(books);
        }
Esempio n. 2
0
        public List <Book> RetrieveBooksList()
        {
            try
            {
                List <Book> books = null;

                BookCheckInCheckOutDBOperations db = BookCheckInCheckOutDBOperations.getInstance();

                IDataReader reader = db.RetrieveBooksList();

                DataTable dt = SchemaInfo.CreateBookDetailsSchemaTable();


                if (reader != null)
                {
                    books = new List <Book>();

                    while (reader.Read())
                    {
                        books.Add(new Book
                        {
                            BookID      = (int)reader["BookID"],
                            Title       = (string)reader["Title"],
                            ISBN        = (string)reader["ISBN"],
                            PublishYear = (string)reader["PublishYear"],
                            CoverPrice  = (decimal)reader["CoverPrice"],
                            CheckOutStatusDescription = (string)reader["CheckOutStatusDescription"]
                            ,
                            CurrentBorrowerID = Convert.ToString(reader["CurrentBorrowerID"])
                        });
                    }
                }



                return(books);
            }
            catch (Exception ex)
            {
                base.logger.SaveException(ex.Message);
            }
            return(null);
        }