private void btnGetSQLBooks_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); } }
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); } }
private void btnHae_Click(object sender, RoutedEventArgs e) { dgBooks.DataContext = BookShop.GetTestBooks(); }
private void btnGetTestBooks_Click(object sender, RoutedEventArgs e) { //haetaan testikirjoja, UI-testi books = BookShop.GetTestBooks(); dgBooks.DataContext = books; }