Esempio n. 1
0
        private void activityDeleteBtn_Click(object sender, EventArgs e)
        {
            if (activityIdBox.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
            {
                // reading data from the textboxes
                int id = int.Parse(activityIdBox.Text);

                if (MessageBox.Show("Are you sure that you wish to remove this activity?", "Warning"
                                    , MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    // passing data to the UI layer
                    SomerenUI.deleteActivity(id);

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

            // clearing data from textboxes
            activityIdBox.Clear();
            activityDescBox.Clear();
            activityStudBox.Clear();
            activitySuperBox.Clear();
        }