private void AffecterValeurs(Livre unlivre) { BoutonModifier.Enabled = true; BoutonValider.Enabled = false; BoutonAjouter.Enabled = true; BoutonAnnuler.Enabled = false; BoxNomLivre.Enabled = false; BoxISBN.Enabled = false; BoxNonAuteur.Enabled = false; BoxQuantiteStock.Enabled = false; BoxDateSortie.Enabled = false; BoxTarif.Enabled = false; BoxResume.Enabled = false; BoxLangue.Enabled = false; BoxEdition.Enabled = false; BoxGenre.Enabled = false; labNoLivre.Text =unlivre.NumLivre.ToString(); BoxISBN.Text = unlivre.CodeISBN1.ToString(); BoxNomLivre.Text = unlivre.NonLivre1.ToString(); BoxNonAuteur.Text = unlivre.UnAuteur1.NonAuteur1.ToString(); BoxQuantiteStock.Text = unlivre.QuantiteStock1.ToString(); BoxDateSortie.Text = unlivre.DateSortie1.ToString(); BoxTarif.Text = unlivre.Tarif1.ToString(); BoxResume.Text = unlivre.Resume1.ToString(); BoxLangue.Text = unlivre.Langue1.ToString(); BoxEdition.Text = unlivre.UneEdition.NomEdition1.ToString(); BoxGenre.Text = unlivre.UnGenre1.NonGenre1.ToString(); LabelNbPage.Text = collLivre.Count.ToString(); LabelPagueCourent.Text = NumLivreCourante.ToString(); VerouillerBouton(); }
private void BoutonValider_Click(object sender, EventArgs e) { if (TokenMandA == 1) { try { Livre unlivre = new Livre(int.Parse(labNoLivre.Text), BoxISBN.Text, BoxNomLivre.Text,new Auteur(int.Parse(collLivre[NumLivreCourante - 1].UnAuteur1.NumAuteur1.ToString()), BoxNonAuteur.Text),int.Parse(BoxQuantiteStock.Text),BoxDateSortie.Text,BoxTarif.Text,BoxResume.Text,BoxLangue.Text, collLivre[NumLivreCourante - 1].Couverture.ToString(),new Edition(int.Parse(collLivre[NumLivreCourante - 1].UneEdition.NumEdition1.ToString()),BoxEdition.Text),new Genre(int.Parse(collLivre[NumLivreCourante-1].UnGenre1.NumGenre1.ToString()),BoxGenre.Text)); M_Livre.ModifLivre(unlivre); reset(); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message); } } else { reset(); } }