private void modif_btn_Click(object sender, EventArgs e) { bool verify2; try { int codePlat = 0; float prix = 0; string nom = ""; string categorie = ""; int var_disponible = 1; if (string.IsNullOrWhiteSpace(code_plat_box.Text)) { throw new Ex("vous devez selectionner la commande \n que vous voulez modifier !!"); } else { codePlat = int.Parse(code_plat_box.Text); } if (string.IsNullOrWhiteSpace(nom_plat_box.Text)) { throw new Ex("vous devez remplir le champ nom!!"); } else { nom = nom_plat_box.Text; } verify2 = float.TryParse(prix_plat_box.Text, out prix); if (!verify2) { throw new Ex("le prix doit etre un nombre reel ! "); } if (categorie_box.SelectedIndex == -1 || string.IsNullOrWhiteSpace(categorie_box.SelectedItem.ToString())) { throw new Ex("vous devez remplir le champ categorie !!"); } else { categorie = categorie_box.SelectedItem.ToString(); } // si l'admin coche la case non-disponible c'est bon, sinon la disponibilte du plat est tjrs true if (disponible_combo.Text == "non disponible") { var_disponible = 0; } db.Modifier_Plat(codePlat, nom, prix, var_disponible, categorie); MessageBox.Show("succes!!"); ClearTextBoxes(); db.Afficher_Plat(plat_grid); }//fin try catch (Exception ex) { } }//fin fct