示例#1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         dataGrid.DataContext = BLBookshop.GetBooks(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
 private void btnRemove_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Book book = (Book)spRigth.DataContext;
         if (BLBookshop.DeleteBook(book))
         {
             MessageBox.Show("Poistettu");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#3
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Book current = (Book)spRigth.DataContext;
         if (BLBookshop.UpdateBook(current) > 0)
         {
             MessageBox.Show("Tallennus onnistui!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#4
0
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     if (btnNew.Content.ToString() == "Uusi")
     {
         Book book = new Book(0);
         book.Name           = "Anna kirjan nimi";
         spRigth.DataContext = book;
         btnNew.Content      = "Tallenna uusi kirja";
     }
     else
     {
         Book book = (Book)spRigth.DataContext;
         BLBookshop.InsertBook(book);
         dataGrid.DataContext = BLBookshop.GetBooks(true);
         btnNew.Content       = "Uusi";
     }
 }
示例#5
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     spRigth.DataContext = BLBookshop.GetTestBooks();
 }