// Bouton validation private void BTN_Valider_Click(object sender, EventArgs e) { if (TXT_Titre.Text == "") { MessageBox.Show("Veuillez indiquer un titre", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_Titre.Focus(); } else if (TXT_Langue.Text == "") { MessageBox.Show("Veuillez indiquer une langue", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_Langue.Text = "Français"; TXT_Langue.Focus(); } else if (TXT_AnneeSortie.Text == "") { MessageBox.Show("Veuillez indiquer une année de sortie", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_AnneeSortie.Focus(); } else { int anneeParsee; Film film = new Film(); film.SetNom(TXT_Titre.Text); film.SetLangue(TXT_Langue.Text); film.SetType((TypeMedia)CB_TypeMedia.SelectedItem); anneeParsee = int.Parse(TXT_AnneeSortie.Text); film.SetAnneeSortie(anneeParsee); if (action == ActionSelectionnee.Ajouter) { film.Ajouter(); } else if (action == ActionSelectionnee.Modifier) { film.SetCode(codeCDSelectionne); film.Modifier(); } AfficherMasquerChamps(false); ObtenirListeFilms(); } }
// Bouton validation private void BTN_Valider_Click(object sender, EventArgs e) { if (TXT_Album.Text == "") { MessageBox.Show("Veuillez indiquer un nom d'album", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_Album.Focus(); } else if (TXT_Artiste.Text == "") { MessageBox.Show("Veuillez indiquer un nom d'artiste", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_Artiste.Focus(); } else if (TXT_AnneeSortie.Text == "") { MessageBox.Show("Veuillez indiquer une date de sortie", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TXT_AnneeSortie.Focus(); } else { int anneeParsee; CDAudio cd = new CDAudio(); cd.SetAlbum(TXT_Album.Text); cd.SetArtiste(TXT_Artiste.Text); anneeParsee = int.Parse(TXT_AnneeSortie.Text); cd.SetAnneeSortie(anneeParsee); if (action == ActionSelectionnee.Ajouter) { cd.Ajouter(); } else if (action == ActionSelectionnee.Modifier) { cd.SetCode(codeCDSelectionne); cd.Modifier(); } AfficherMasquerChamps(false); ObtenirListeCDs(); } }