private void ajouterLivre_btn_Click(object sender, EventArgs e) { if (quantite.Text.Trim().Length != 0 && selectedBook.Text != "HERE") { if (int.TryParse(quantite.Text, out int quantit)) { Connection.db.Open(); MySqlCommand command = Connection.db.CreateCommand(); command.Parameters.AddWithValue("@quantite", quantit); command.Parameters.AddWithValue("@titre", selectedBook.Text); command.CommandText = "UPDATE livres set quantite = @quantite, stat_livre = '1' where titre = @titre "; command.ExecuteNonQuery(); Connection.db.Close(); MessageBox.Show(" livre ajouté"); this.Close(); AjoutLivre aj1 = new AjoutLivre(); aj1.Show(); } else { MessageBox.Show("Erreur, Champs non valide"); } } else { MessageBox.Show("Veuillez à bien choisir un livre et mettre une quantite, s'il n'y a pas de livre veuillez demander à un gérant de site de faire une demande d'ajout."); } }
private void ajouterUnLivreToolStripMenuItem_Click(object sender, EventArgs e) { AjoutLivre al = new AjoutLivre(); al.Show(); }