Beispiel #1
0
        public void ReturnBook()
        {
            var returnbookwindow = new BorrowersBorrowedBooks();

            returnbookwindow.DataContext = this;
            var result = returnbookwindow.ShowDialog();

            if (result == true)
            {
                for (int a = 0; a < BOOKSLIST.Count; a++)
                {
                    if (BOOKSLIST[a].BookIDNumber == SelectedReturnBook.BookIDNumber)
                    {
                        BOOKSLIST[a].BookAvailability = Availability.AVAILABLE.ToString();
                        SelectedBorrower.BORROWERBOOKSBORROWED.Remove(SelectedReturnBook);
                        if (SelectedBorrower.BORROWERBOOKSBORROWED.Count > 0)
                        {
                            SelectedBorrower.BorrowerCheckBorrowingBooks = CheckBorrowedBook.BORROWING.ToString();
                        }
                        else if (SelectedBorrower.BORROWERBOOKSBORROWED.Count == 0)
                        {
                            SelectedBorrower.BorrowerCheckBorrowingBooks = CheckBorrowedBook.NONE.ToString();
                        }
                        SelectedReturnBook = null;
                        break;
                    }
                }
                MessageBox.Show("successfully returned the book");
            }
        }
Beispiel #2
0
        public void AddBook()
        {
            var addbookwindow = new AddBookWindow();

            addbookwindow.DataContext = this;
            var result = addbookwindow.ShowDialog();

            if (result == true)
            {
                if (title == null | category == null | bookid.Count == 0 | bookauthor.Count == 0)
                {
                    MessageBox.Show("incomplete of filling up the information");
                }
                else
                {
                    for (int i = 0; i < bookid.Count; i++)
                    {
                        var newbook = new BOOK();
                        newbook.BookTitle        = title;
                        newbook.BookCategory     = category;
                        newbook.BookAvailability = Availability.AVAILABLE.ToString();
                        for (int a = 0; a < bookauthor.Count; a++)
                        {
                            newbook.BOOKAUTHOR.Add(bookauthor[a]);
                        }
                        newbook.BookIDNumber = bookid[i];
                        BOOKSLIST.Add(newbook);
                    }
                    MessageBox.Show("successfully added the book");
                }
                title    = null;
                category = null;
                bookid.Clear();
                bookauthor.Clear();
            }
            else
            {
                title    = null;
                category = null;
                bookid.Clear();
                bookauthor.Clear();
            }
        }