コード例 #1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Are you sure to delete \"" + this.MenuItem.Name + "\"", "Confirm", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                MenuItemBLL menuItemBLL = new MenuItemBLL();
                menuItemBLL.Delete(this.MenuItem);

                // fire event
                if (this.OnDelete != null)
                {
                    this.OnDelete(this.MenuItem);
                }
            }
        }
コード例 #2
0
ファイル: TestMenuItem.cs プロジェクト: Thaibaduc/Restaurant
        public void TestDeleteMenuItem(MenuItem menuItemNew)
        {
            bool isDelete = true;

            menuItemBLL.Delete(menuItemNew);
            List <Menu>     menus     = menuBLL.ListMenu();
            List <MenuItem> menuItems = menuItemBLL.FindByMenuID(menus[0]);

            for (int i = 0; i < menuItems.Count; i++)
            {
                if (menuItems[i].ID == menuItemNew.ID)
                {
                    isDelete = false;
                }
            }
            Assert.AreEqual(isDelete, true);
        }