Exemple #1
0
 private void bnAddBook_Click(object sender, EventArgs e)
 {
     // XXX Add Book button event handler
     while (true)
     {
         try
         { // to capture an exception from Price/Stock of bookDialog
             // also throw an exception if the ISBN is already registered
             bookDialog.ClearDisplayItems();
             if (bookDialog.ShowDialog() == DialogResult.Cancel)
             {
                 return;
             }
             // Edit Done button is pressed
             BookShopControl.addNewBook(bookDialog.BookTitle, bookDialog.Author, bookDialog.Publisher, bookDialog.ISBN, bookDialog.Price, bookDialog.Date, bookDialog.Stock);
             return;
         }
         catch (BookShopException bsex)
         {
             MessageBox.Show(this, bsex.ErrorMessage);
             continue;
         }
     }
 }