Exemplo n.º 1
0
        private void FindAnimalButton_Click(object sender, RoutedEventArgs e)
        {
            FindAnimal findAnimal = new FindAnimal();

            findAnimal.chooseAnimal.Visibility = Visibility.Hidden;
            findAnimal.Show();
        }
Exemplo n.º 2
0
        private void Animal_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            animalInfo.Clear();

            FindAnimal findAnimal = new FindAnimal();

            findAnimal.exportButton.Visibility = Visibility.Hidden;
            findAnimal.ShowDialog();
            this.passportId = findAnimal.ChooseAnimal();

            using (var db = DBConfig.Connection)
            {
                db.Open();
                MySqlDataReader reader    = null;
                string          selectCmd = "SELECT p.animal_name, b.animal_type_name FROM passport p JOIN animal_type b USING(animal_type_id) WHERE p.passport_id =" + this.passportId;

                MySqlCommand command = new MySqlCommand(selectCmd, db);
                reader = command.ExecuteReader();

                while (reader.Read())
                {
                    string animalName = (string)reader["animal_name"];
                    string animalType = (string)reader["animal_type_name"];

                    animalInfo.Text = animalName + " " + animalType;
                }
                db.Close();
            }
        }
Exemplo n.º 3
0
        public static bool FindAnimalFrom(this List <Animal> animals, FindAnimal findAnimal)
        {
            foreach (var a in animals)
            {
                if (findAnimal(a))
                {
                    return(true);
                }
            }

            return(false);
        }