Example #1
0
 private void btn_GetBooksFromSQL_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // haetaan kirjat tietokannasta ORM=muutetaan tietueet Book-olioiksi
         books = BookShop.GetBooks(true);
         dgBooks.DataContext = books;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
 private void btn_savebooks_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Book current = (Book)SP_Book.DataContext;
         BookShop.UpdateBook(current);
         MessageBox.Show(string.Format("Kirja {0} päivitetty kantaan onnistuneesti", current.ToString()));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
 private void btn_GetBooks_Click(object sender, RoutedEventArgs e)
 {
     // haetaan testiolioita
     books = BookShop.GetTestBooks();
     dgBooks.DataContext = books;
 }