private void btAjouterPlat_Click(object sender, EventArgs e) { string nom = tbNom.Text; Categorie categorie = (Categorie)cbCat.SelectedItem; string prix = tbPrix.Text; string cal = tbCal.Text; bool vegan = false; bool gluten = false; if (string.IsNullOrEmpty(nom) || string.IsNullOrEmpty(prix) || string.IsNullOrEmpty(cal)) { MessageBox.Show("Rentrez des informations valides svp"); return; } if (cbVegan.Checked) { vegan = true; } if (cbGlutenFree.Checked) { gluten = true; } Plat p = new Plat(nom, categorie, Convert.ToInt16(prix), Convert.ToInt16(cal), vegan, gluten); if (ORMPlats.AjouterPlat(p)) { MessageBox.Show("Votre plat a bien été ajouté !"); } else { MessageBox.Show("Le plat existe déjà, changez le nom du plat"); } }