コード例 #1
0
        private void activityAddBtn_Click(object sender, EventArgs e)
        {
            SomerenModel.Activities one = new SomerenModel.Activities();
            if (activityDescBox.Text == "" || activityStudBox.Text == "" || activitySuperBox.Text == "")
            {
                // show a message if a user did not enter a value
                MessageBox.Show("Please enter a value for (Description, Number of Students, Number of Supervisors) " +
                                "fields before clicking on Add", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                // reading data from the textboxes
                string desc               = activityDescBox.Text;
                int    numberOfStudent    = int.Parse(activityStudBox.Text);
                int    numberOfSupervisor = int.Parse(activitySuperBox.Text);

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

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