public Book RetrieveBookDetails(int bookId)
        {
            Book book = null;

            BookCheckInCheckOutDBOperations db = BookCheckInCheckOutDBOperations.getInstance();

            IDataReader reader = db.RetrieveBooksList(bookId);

            if (reader != null)
            {
                while (reader.Read())
                {
                    book = new Book
                    {
                        BookID      = (int)reader["BookID"],
                        Title       = (string)reader["Title"],
                        ISBN        = (string)reader["ISBN"],
                        PublishYear = (string)reader["PublishYear"],
                        CoverPrice  = (decimal)reader["CoverPrice"],
                        ModifiedOn  = (DateTime)reader["ModifiedOn"],
                        CheckOutStatusDescription = (string)reader["CheckOutStatusDescription"]
                    };
                }
            }

            return(book);
        }
        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);
        }
예제 #3
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);
        }