private void BooksListButton_Click(object sender, RoutedEventArgs e)
 {
     if (int.TryParse(this.PersonIDKTextBox.Text?.Trim(), out int idc))
     {
         using (var db = new DataContext()) {
             var filtered = db.Books.Where(b => b.Borrower.IDC == idc);
             if (filtered.Count() == 0)
             {
                 MessageBox.Show("This person has no books or doesn't exist", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                 this.PersonIDKTextBox.Clear();
                 return;
             }
             BooksWindow bw = new BooksWindow(filtered.ToList());
             bw.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Error while parsing IDC", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     this.PersonIDKTextBox.Clear();
 }
示例#2
0
        private void booksButton_Click(object sender, RoutedEventArgs e)
        {
            var booksWindow = new BooksWindow(unitOfWork);

            booksWindow.ShowDialog();
        }