Esempio n. 1
0
        private void BTN_MIMenuUpdate_Click(object sender, EventArgs e)
        {
            decimal price;

            if (TXTB_MIMenuName.Text == string.Empty)
            {
                MessageBox.Show("Fill in a menu name");
                return;
            }

            if (!decimal.TryParse(TXTB_MIPrice.Text, out price))
            {
                MessageBox.Show("Fill in correct price");
                return;
            }
            int    MenuItemID = this.selectedMenuItem.Id;
            string MenuName   = TXTB_MIMenuName.Text;

            price = decimal.Parse(TXTB_MIPrice.Text) / 100;

            menuItemService.UpdateMenuItem(MenuItemID, MenuName, price);

            if (TXTB_Menutype.Text != string.Empty)
            {
                bool found = false;
                foreach (var x in menuItemService.getMenuTypes())
                {
                    if (x.Type == TXTB_Menutype.Text)
                    {
                        found = true;
                    }
                }
                if (found == true)
                {
                    MessageBox.Show("Changed this menu item " + selectedMenuItem.Name + " to this menu" + selectedMenu.Type);
                    menuItemService.UpdateMenuItemType(MenuItemID, this.selectedMenu.Id);
                }
                else
                {
                    MessageBox.Show("Menu type not found!");
                }
            }
            MessageBox.Show("De Item wijzigingen zijn doorgevoerd", "Item Wijzigingen!", MessageBoxButtons.OK);
            displayGrid();
        }