Exemplo n.º 1
0
        private void UpdateBook(object sender, RoutedEventArgs e)
        {
            BookDialog dialog = new BookDialog(Window.GetWindow(this), SelectedBook.title, SelectedBook.quantity, SelectedBook.price);

            if (dialog.ShowDialog() == true)
            {
                SelectedBook.title    = dialog.BookTitle;
                SelectedBook.quantity = dialog.BookQuantity;
                SelectedBook.price    = dialog.BookPrice;

                app.clientProxy.updateBook(SelectedBook);

                refreshBookList(null, null);
            }
        }
Exemplo n.º 2
0
        private void AddBook(object sender, RoutedEventArgs e)
        {
            BookDialog dialog = new BookDialog(Window.GetWindow(this));

            if (dialog.ShowDialog() == true)
            {
                BookData b = new BookData();
                b.title    = dialog.BookTitle;
                b.quantity = dialog.BookQuantity;
                b.price    = dialog.BookPrice;

                Response rep = app.clientProxy.addBook(b);

                if (rep.State != "success")
                {
                    System.Windows.MessageBox.Show(Window.GetWindow(this), "The book is already registered!", "Repeated book", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                refreshBookList(null, null);
            }
        }