Exemplo n.º 1
0
 private void btnGetSqlBooks_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         books = BookShop.GetBooks(true);
         dgBooks.DataContext = books;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private void btnGetBooks_Click(object sender, RoutedEventArgs e)
 {
     //Haetaan kirjat tietokannasta ORM=muutetaan Book-olioiksi
     try
     {
         books = BookShop.GetTestBooks();
         dgBooks.DataContext = books;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     //Valittu Book-olio tallennetaan kantaan
     try
     {
         Book current = (Book)spBook.DataContext;
         BookShop.UpdateBook(current);
         MessageBox.Show(string.Format("Kirja {0} päivitetty kantaan onnistuneesti", current.ToString()));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }