コード例 #1
0
 private IList<ClientTable> RetriveData(Engine.SearchClientEngine search)
 {
     if(search_all_radiobutton.IsChecked == true)
     {
          return search.FindAllData().ToList();
     }
     else if(search_using_ID_radiobutton.IsChecked == true)
     {
         if(id_textBox.Text == null)
         {
             System.Windows.MessageBox.Show("You have enter anything");
         }
         else
         {
             try
             {
                 int id = Int32.Parse(id_textBox.Text);
                 return search.FindClientWithID(id).ToList();
             }
             catch (FormatException e)
             {
                 System.Console.WriteLine(e.Message);
             }
         }
     }
     else if(search_using_Names_radiobutton.IsChecked == true)
     {
         if (forename_textbox.Text == null && surname_textBox.Text == null)
         {
             System.Windows.MessageBox.Show("You have not entered names");
         }
         else
         {
             return search.FindClientsWithNames(forename_textbox.Text, surname_textBox.Text).ToList();
         }
     }
     else if(search_Clients_Using_Location_radiobutton.IsChecked == true)
     {
         if(city_textBox.Text == null && country_textBox.Text == null)
         {
             System.Windows.MessageBox.Show("you haven't entered antthing");
         }
         else
         {
             return search.FindClientLivingIn(city_textBox.Text, country_textBox.Text).ToList();
         }
     }
     return null;
 }