示例#1
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            Item food = new Item();

            food.Food_ID = tbx_ID.Text;
            DialogResult dialogResult = MessageBox.Show("Do you want to delete this food?", "Warning!", MessageBoxButtons.YesNo);

            String uri     = "";
            IFood  foodbll = (IFood)Activator.GetObject(typeof(IFood), uri);

            if (dialogResult == DialogResult.Yes)
            {
                if (foodbll.Delete_Food(food))
                {
                    dataGridView.DataSource = foodbll.Load_Item();
                    MessageBox.Show("Delete complete", "Result", MessageBoxButtons.OK);
                }
            }
            else if (dialogResult == DialogResult.No)
            {
                return;
            }
        }