Beispiel #1
0
        private void supprimer_btn_Click(object sender, EventArgs e)
        {
            try
            {
                string id = table_code_box.Text;

                //verifier si le text box est non vide || verifier si le code existe
                if (!db.check_Existence("Tablee", id) || string.IsNullOrWhiteSpace(id))
                {
                    throw new Ex("vous devez remplir le champ id correctement (type:entier) !");
                }


                //verifier si la table est deja reservée
                int  code    = int.Parse(id);
                bool reserve = db.Verify_Reserved_Table(code);

                if (reserve)
                {
                    throw new Ex("la table que vous voulez supprimer est deja reservée!");
                }
                else
                {
                    if (MessageBox.Show("Voulez vous vraiment supprimer cette Table ?", "Supprimer Table", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

                    {
                        db.Supprimer_Table(code);
                        table_code_box.Clear();
                        db.Afficher_Table(Table_grid);
                    }

                    else
                    {
                        MessageBox.Show("Table non Supprimée !", "Spprimer Table", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }