예제 #1
0
 public bool UpdateBook(Book book)
 {
     if (BookDAOMySql.Instance().updateBook(book))
     {
         books[books.IndexOf(this.GetBook(book.isbn))] = book;
         return true;
     }
     return false;
 }
예제 #2
0
 public bool DeleteBook(Book book)
 {
     if (BookDAOMySql.Instance().deleteBook(book))
     {
         books.RemoveAt(books.IndexOf(this.GetBook(book.isbn)));
         return true;
     }
     return false;
 }
예제 #3
0
 public bool AddBook(Book book)
 {
     if (BookDAOMySql.Instance().addBook(book))
     {
         this.books.Add(book);
         return true;
     }
     return false;
 }
 public void EditBook_OnClick(object sender, RoutedEventArgs e, Book book)
 {
     EditBook editBook = new EditBook(book);
     Content.Children.Clear();
     Content.Children.Add(editBook);
     MenuToggleButton.IsChecked = true;
     MenuToggleButton.IsHitTestVisible = true;
     ToolbarName.Text = book.Name;
     AddButton.Visibility = Visibility.Hidden;
 }
 public EditBook(Book book)
 {
     InitializeComponent();
     this.book = book;
     imageUrl = book.Picture;
     CoverImage.Text = book.Picture;
     Name.Text = book.Name;
     Description.Text = book.Description;
     Author.Text = book.Author;
     Status.Text = book.Status;
     Date.Text = book.PublishDate;
     PageCount.Text = book.PageCount.ToString();
 }
예제 #6
0
        private void DeleteButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Do you want to delete this book?",
              "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                this.Visibility = Visibility.Collapsed;
                mainWindow.ProgressBar.Visibility = Visibility.Visible;

                selectedBook = (Book)(sender as Button).DataContext;
                var deleteBookHandler = new HttpHandler(null, this);
                deleteBookHandler.RequestCompleted += HandlerDeleteBookRequestCompleted;
                deleteBookHandler.DeleteBook(selectedBook.Id);
            }
        }
예제 #7
0
 private void fillTexts(Book book)
 {
     if(book != null)
     {
         this.isbnTB.Text = book.isbn;
         this.titleTB.Text = book.title;
         this.authorTB.Text = book.author;
         this.subjectTB.Text = book.subject;
         this.descriptionTB.Text = book.description;
         if (book.is_available) this.is_availableCB.Text = "In Library";
         else
         {
             this.is_availableCB.Text = "Not Available";
             is_availableCB.Enabled = false;
         }
     }
 }
        public void ViewBook(object sender, RoutedEventArgs e, Book book)
        {
            EditBook editBook = new EditBook(book);
            Content.Children.Clear();
            Content.Children.Add(editBook);
            MenuToggleButton.IsChecked = true;
            MenuToggleButton.IsHitTestVisible = true;
            ToolbarName.Text = book.Name;

            editBook.CoverImage.IsReadOnly = true;
            editBook.Name.IsReadOnly = true;
            editBook.Description.IsReadOnly = true;
            editBook.Status.IsEnabled = false;      
            editBook.Author.IsReadOnly = true;
            editBook.Date.IsEnabled = false;
            editBook.PageCount.IsReadOnly = true;

            editBook.BrowseImage.Visibility = Visibility.Hidden;
            editBook.AddButton.Visibility = Visibility.Hidden;
            editBook.CancelButton.Visibility = Visibility.Hidden;
            AddButton.Visibility = Visibility.Hidden;
        }
예제 #9
0
 partial void DeleteBook(Book instance);
예제 #10
0
 partial void UpdateBook(Book instance);
예제 #11
0
 partial void InsertBook(Book instance);