示例#1
0
        //add book function
        private void AddBookManually_Click(object sender, RoutedEventArgs e)
        {
            //Data into an object
            Book book = new Book();

            book.isbn        = isbn.Text;
            book.title       = title.Text;
            book.author      = author.Text;
            book.description = description.Text;
            book.stockNum    = inStock.Text;

            BookFunctions functions = new BookFunctions();

            book = functions.manualAddBook(book);
            if (book.check == false)
            {
                isbn.Text        = "Error Adding Book";
                title.Text       = "";
                author.Text      = "";
                description.Text = "";
                inStock.Text     = "";
            }
            else
            {
                isbn.Text        = "Book Addition Successful";
                title.Text       = "";
                author.Text      = "";
                description.Text = "";
                inStock.Text     = "";
            }
        }
示例#2
0
        //Editing a books info by
        private void updateBook_Click(object sender, RoutedEventArgs e)
        {
            Book editBook = new Book();

            editBook.isbn        = isbn.Text;
            editBook.title       = title.Text;
            editBook.author      = author.Text;
            editBook.description = description.Text;
            editBook.stockNum    = inStock.Text;

            BookFunctions editfunction = new BookFunctions();

            editBook = editfunction.editBook(editBook);

            if (editBook.check == false)
            {
                isbn.Text        = "Error Editing Book Info";
                title.Text       = "";
                author.Text      = "";
                description.Text = "";
                inStock.Text     = "";
            }
            else
            {
                isbn.Text        = "Book Edited Sucessfully";
                title.Text       = "";
                author.Text      = "";
                description.Text = "";
                inStock.Text     = "";
            }
        }
示例#3
0
        //Search tab function
        private void Search_Button_Click(object sender, RoutedEventArgs e)
        {
            Book searchBook = new Book();

            searchBook.isbn = ISBNInput.Text;
            BookFunctions searchFunction = new BookFunctions();

            searchBook = searchFunction.searchBook(searchBook);

            string searchBookString = (searchBook.isbn + "-" + searchBook.title + "-" + searchBook.author + "-" + searchBook.description + "-" + searchBook.stockNum);

            searchResult.Items.Add(searchBookString);
        }
示例#4
0
        private void AddBookAPI_Click(object sender, RoutedEventArgs e)
        {
            Book APIBook = new Book();

            APIBook.isbn = isbnAPI.Text;
            string uri = string.Format(@"http://isbndb.com/api/v2/json/{0}/book/{1}", key, APIBook.isbn);

            WebClient client = new WebClient();
            string    data   = client.DownloadString(uri);

            BookFunctions access = new BookFunctions();

            APIBook = access.addBookAPI(APIBook, data);
        }
示例#5
0
        private void remove_Click(object sender, RoutedEventArgs e)
        {
            Book removeBook = new Book();

            removeBook.isbn = removeISBN.Text;

            BookFunctions removeFunction = new BookFunctions();

            removeBook = removeFunction.removeBook(removeBook);
            if (removeBook.check == false)
            {
                removeISBN.Text = "Error Removing Book";
            }
            else
            {
                removeISBN.Text = "Book Removed Successfully";
            }
        }