Пример #1
0
        private void activityUpdateBtn_Click(object sender, EventArgs e)
        {
            if (activityIdBox.Text == "" || activityDescBox.Text == "" ||
                activityStudBox.Text == "" || activitySuperBox.Text == "")
            {
                // show a message if a user did not enter a value
                MessageBox.Show("Please enter a value for all fields before clicking on Update", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                // reading data from the textboxes
                int    id                 = int.Parse(activityIdBox.Text);
                string desc               = activityDescBox.Text;
                int    numberOfStudent    = int.Parse(activityStudBox.Text);
                int    numberOfSupervisor = int.Parse(activitySuperBox.Text);

                // passing data to the UI layer
                SomerenUI.uppdateActivity(id, desc, numberOfStudent, numberOfSupervisor);

                // show a messagebox after clicking on update button
                MessageBox.Show("You have successfully updated 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();
        }