Exemplo n.º 1
0
 /// <summary>
 /// Creator: Ethan Murphy
 /// Created: 5/5/2020
 /// Approver: Chuck Baxter 5/5/2020
 ///
 /// Used to search for an animal
 /// <remarks>
 /// Updater:
 /// Updated:
 /// Update:
 /// </remarks>
 private void btnSearchAnimal_Click(object sender, RoutedEventArgs e)
 {
     if (btnSearchAnimal.Content.ToString() == "Search")
     {
         List <Animal> list;
         btnSearchAnimal.Content = "Reset";
         try
         {
             list = !(bool)chkActive.IsChecked ?
                    _animalManager.RetrieveAnimalsByActive() :
                    _animalManager.RetrieveAnimalsByInactive();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return;
         }
         dgActiveAnimals.ItemsSource = null;
         dgActiveAnimals.ItemsSource = _animalManager.RetrieveAnimalsByName(
             txtSearchAnimal.Text, list);
     }
     else
     {
         btnSearchAnimal.Content = "Search";
         txtSearchAnimal.Text    = "";
         if (!(bool)chkActive.IsChecked)
         {
             refreshActiveData();
         }
         else
         {
             refreshInactiveData();
         }
     }
 }