Esempio n. 1
0
        /*
         * Given a book ISBN(entered by the user) and a book record(read from
         * the currentBookFile) checks to see if the user ISBN matches the record
         * ISBN(the first  field of the record_. If there is a match, this method splits
         * the record into its 6 component parts and saves them
         */
        public Boolean findAndSaveBook(String ISBN)
        {
            string  nextRecord;
            Boolean isEndOfFile = true;
            Boolean success;

            nextRecord = currentBookFile.getNextRecord(ref isEndOfFile);
            while (!isEndOfFile)
            {
                Book tempBook = new Book();
                success = tempBook.populateBookObject(nextRecord);

                if (success != true)
                {
                    MessageBox.Show
                        ("Unable to create a Book Object",
                        "Book object creation Failed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return(false);
                }
                if (tempBook.bookMatch(ISBN, tempBook))
                {
                    book = tempBook;
                    return(true);
                }
                nextRecord = BookStore.currentBookFile.getNextRecord(ref isEndOfFile);
            } //end While
            return(false);
        }