private async void FilterAndUpdateLastSearchList() { NameListView.Items.Clear(); TypeListView.Items.Clear(); IsBorrowedListView.Items.Clear(); if (BookRadioButton.IsChecked == false && JournalRadioButton.IsChecked == false) { MessageDialog msg = new MessageDialog("You must choose either Book or Journal to continue. "); await msg.ShowAsync(); } lastSearch = LiteraryOperations.FilterItems(data, (BookRadioButton.IsChecked == true), (JournalRadioButton.IsChecked == true), Name_TextBox.Text, Author_TextBox.Text, PublishingYear_TextBox.Text, CopyNumber_TextBox.Text, JournalType_TextBox.Text, JournalCategory_TextBox.Text, BookCategory_TextBox.Text); foreach (AbstractItem ai in lastSearch) { NameListView.Items.Add(ai.Name); TypeListView.Items.Add((ai is Book) ? "Book" : "Journal"); IsBorrowedListView.Items.Add((ai.IsBorrowed) ? "Yes" : "No"); } }
private void AddItem_BTN_Click(object sender, RoutedEventArgs e) { LiteraryOperations.AddItem(data, (BookRadioButton.IsChecked == true), (JournalRadioButton.IsChecked == true), Name_TextBox.Text, Author_TextBox.Text, PublishingYear_TextBox.Text, JournalType_TextBox.Text, JournalCategory_TextBox.Text, BookCategory_TextBox.Text, CopyNumber_TextBox.Text); FilterAndUpdateLastSearchList(); }
private void FilterAndUpdateLastSearchList() { Name_LIstView.Items.Clear(); Type_ListView.Items.Clear(); IsBorrowed_ListView.Items.Clear(); lastSearch = LiteraryOperations.FilterItems(data, (CustomerBookRadioButton.IsChecked == true), (CustomerJournalRadioButton.IsChecked == true), CustomerName_TextBox.Text, CustomerAuthor_TextBox.Text, CustomerPublishingYear_TextBox.Text, CustomerCopyNumber_TextBox.Text, CustomerJournalType_TextBox.Text, CustomerJournalCategory_TextBox.Text, CustomerBookCategory_TextBox.Text); foreach (AbstractItem ai in lastSearch) { Name_LIstView.Items.Add(ai.Name); Type_ListView.Items.Add((ai is Book) ? "Book" : "Journal"); //IsBorrowed_ListView.Items.Add((data.CurrentUser.Borrowed.Contains(CurrentItem) ? "Yes" : "No")); IsBorrowed_ListView.Items.Add((ai.IsBorrowed) ? "Yes" : "No"); } }