Esempio n. 1
0
        private void InitializeIntels()
        {
            nom.Text += " " + animal.Nom;
            String naissance = animal.DateNaissance.ToString();

            dateNais.Text += " " + naissance;
            poids.Text    += " " + animal.Poids.ToString();
            Clients monClient = _db.Clients.Find(animal.Clients_idClients);

            nomProprietaire.Text += " " + monClient.Nom;
            Race maRace = new Race();

            foreach (Race race in animal.Race)
            {
                maRace = race;
            }
            Especes monEspece = _db.Especes.Find(maRace.Especes_idEspeces);

            nomRace.Text   += " " + maRace.Nom;
            nomEspece.Text += " " + monEspece.Nom;

            if (animal.Sexe == null)
            {
                animal.Sexe = "M";
            }
            if (animal.Sexe.Equals("M"))
            {
                sexe.Text += " Masculin";
            }
            else
            {
                sexe.Text += " Féminin";
            }
        }
Esempio n. 2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string esp   = comboBox1.SelectedItem.ToString();
            var    races = _db.Race;

            foreach (Race race in races)
            {
                especeSelected = _db.Especes.Find(race.Especes_idEspeces);
                if (especeSelected.Nom.Equals(esp))
                {
                    comboBox2.Items.Add(race.Nom);
                }
            }
        }
Esempio n. 3
0
        public void InitializeAnimauxInterface(String request)
        {
            this.allAnimauxList.Items.Clear();
            this.animaux.Clear();

            if (request.Equals(""))
            {
                var animaux = _db.Animaux;
                foreach (Animaux animal in animaux)
                {
                    Clients monClient = _db.Clients.Find(animal.Clients_idClients);
                    Race    maRace    = new Race();
                    foreach (Race race in animal.Race)
                    {
                        maRace = race;
                    }
                    Especes monEspece   = _db.Especes.Find(maRace.Especes_idEspeces);
                    String  description = monClient.Nom + " " + animal.Nom + " "
                                          + maRace.Nom + " "
                                          + animal.Poids + " " + animal.Caractéristiques +
                                          " " + animal.Sexe
                                          + " " + animal.DateNaissance;

                    if (!this.animaux.Contains(description))
                    {
                        this.allAnimauxList.Items.Add(animal.idAnimaux + ". " + description);
                        this.animaux.Add(description);
                    }
                }
            }
            else
            {
                if (request.Equals("typed"))
                {
                    var animaux = _db.Animaux;
                    foreach (Animaux animal in animaux)
                    {
                        Clients monClient = _db.Clients.Find(animal.Clients_idClients);
                        Race    maRace    = new Race();
                        foreach (Race race in animal.Race)
                        {
                            maRace = race;
                        }
                        Especes monEspece = _db.Especes.Find(maRace.Especes_idEspeces);

                        if ((animal.Nom.StartsWith(searchName)) && (monClient.Nom.StartsWith(searchNameProprietaire)))
                        {
                            if (maRace.Nom != null)
                            {
                                if ((maRace.Nom.StartsWith(searchRace)))
                                {
                                    String description = monClient.Nom + " " + animal.Nom + " "
                                                         + maRace.Nom + " " + " "
                                                         + animal.Poids + " " + animal.Caractéristiques +
                                                         " " + animal.Sexe
                                                         + " " + animal.DateNaissance;
                                    if (!this.animaux.Contains(description))
                                    {
                                        this.allAnimauxList.Items.Add(animal.idAnimaux + ". " + description);
                                        this.animaux.Add(description);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }