예제 #1
0
        private void EditItemButton_Click(object sender, EventArgs e)
        {
            if (BronzeDiscountValue < 0)
            {
                BronzeDiscountValue        = 0.0;
                BronzeDiscountTextbox.Text = "0.00";
            }
            if (BronzeDiscountTextbox.Text == "0.00")
            {
                CorrectBronzeFormat = true;
            }

            if (CorrectNameFormat && CorrectPriceFormat && CorrectBronzeFormat)
            {
                ErrorMessageLabel.Visible = false;
                var NewPrice = Convert.ToDouble(Price);
                var NewItem  = new FoodItem(MenuItemId, MenuItemName, NewPrice, RestaurantId, BronzeDiscountValue,
                                            SilverDiscountValue, GoldDiscountValue, false);
                StaticAccessor.DB.UpdateFoodItem(NewItem);
                MessageBox.Show("Item: " + MenuItemName + " edited");
                Hide();
                var RAVM = new RestAdminViewMenu(AdminId, RestaurantId);
                RAVM.ShowDialog();
            }
            else
            {
                ErrorMessageLabel.Visible = true;
                ErrorMessageLabel.Text    = "Error Message: " + ErrorMessage;
            }
        }
        private void button1_Click(object sender, EventArgs e) //View Menu
        {
            Hide();
            var RAMI = new RestAdminViewMenu(AdminId, RestaurantId);

            RAMI.ShowDialog();
        }
예제 #3
0
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            //remove item from db
            var NewPrice     = Convert.ToDouble(Price);
            var ItemToDelete = new FoodItem(MenuItemId, MenuItemName, NewPrice, RestaurantId, BronzeDiscountValue,
                                            SilverDiscountValue, GoldDiscountValue, true);

            StaticAccessor.DB.UpdateFoodItem(ItemToDelete);
            MessageBox.Show("Item: " + MenuItemName + " Removed");
            Hide();
            var RAVM = new RestAdminViewMenu(AdminId, RestaurantId);

            RAVM.ShowDialog();
        }