Ejemplo n.º 1
0
        }//fin fct

        private void supprimer_btn_Click(object sender, EventArgs e)
        {
            string code = code_plat_box.Text;

            try
            {
                if (string.IsNullOrWhiteSpace(code))
                {
                    throw new Ex("vous devez selectionner le plat\nque vous voulez supprimer!");
                }

                if (MessageBox.Show("Voulez vous vraiment supprimer ce plat ?", "Supprimer Plat", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

                {
                    int id = int.Parse(code);
                    db.Supprimer_Plat(id);
                    db.Afficher_Plat(plat_grid);
                    ClearTextBoxes();
                }

                else
                {
                    MessageBox.Show("Plat non Supprimé !", "Spprimer Plat", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }catch (Exception ex)
            {
                int id = int.Parse(code);
                db.Supprimer_Plat(id);
                db.Afficher_Plat(plat_grid);
                db.Fill_Disponible(disponible_combo);
                ClearTextBoxes();
                MessageBox.Show("succes!!");
            }
        }