Beispiel #1
0
        private void drinkDeleteBtn_Click(object sender, EventArgs e)
        {
            if (boxId.Text == "")
            {
                // show a message if a user did not enter a value
                MessageBox.Show("Please enter a value for ID before clicking on Delete", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (MessageBox.Show("Are you sure that you want to remove this drink?", "Warning"
                                    , MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    // reading data from the textboxes
                    int id = int.Parse(boxId.Text);

                    // passing data to the UI layer
                    SomerenUI.deleteBarServiceUI(id);

                    // show a messagebox after clicking on update button
                    MessageBox.Show("You have successfully deleted a drink!!\n " +
                                    "Enter Refresh the list to see the changes", "",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            // clearing data from textboxes
            drinkAmountBox.Clear();
            drinkNameBox.Clear();
            drinkPriceBox.Clear();
            boxId.Clear();
        }