private void FormAnimaux_Load(object sender, EventArgs e) { if (frmClients != null) { ClientCourant = frmClients.ClientCourant; } else if (frmRDV != null) { ClientCourant = frmRDV.ClientCourant; } TBox_Code.Enabled = false; TBox_Client.Enabled = false; CBox_Espèce.DataSource = MgtRace.GetEspeces(); CBox_Race.DataSource = MgtRace.GetRaces(CBox_Espèce.Items[0].ToString()); TBox_Client.Text = ClientCourant.nomPrenom; // Affichage en fonction du mode if (frmClients.ModeAnimal == "Ajout") { CBox_Genre.SelectedIndex = 0; CBox_Espèce.SelectedIndex = 0; CBox_Race.SelectedItem = 0; BTN_Dossier.Enabled = false; } else if (frmClients.ModeAnimal == "Modification") { CBox_Espèce.SelectedIndex = CBox_Espèce.FindStringExact(frmClients.AnimalCourant.espece); CBox_Race.SelectedIndex = CBox_Race.FindStringExact(frmClients.AnimalCourant.race); TBox_Tatouage.Enabled = false; AfficherAnimalCourant(); } }
/// <summary> /// Ouvre le formulaire d'ajout d'une race poru une espèce /// </summary> private void PBox_AddRace_Click(object sender, EventArgs e) { FormAjout_EspècesRaces frmAjout = new FormAjout_EspècesRaces(CBox_Espèce.SelectedValue.ToString()); frmAjout.ShowDialog(); CBox_Espèce.DataSource = MgtRace.GetEspeces(); CBox_Race.DataSource = MgtRace.GetRaces(CBox_Espèce.Items[0].ToString()); }
/// <summary> /// Affichage des races correspondantes à l'espèce selectionnée /// </summary> private void CBox_Espèce_SelectedIndexChanged(object sender, EventArgs e) { CBox_Race.DataSource = MgtRace.GetRaces(CBox_Espèce.SelectedValue.ToString()); }