示例#1
0
        /*
         * Pre:
         * Post: If the entered data is valid, the students of the From teacher are associated with the To teacher
         */
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool success = true;

            if (dataIsValid())
            {
                int fromTeacherId = Convert.ToInt32(ddlFrom.SelectedValue);
                int toTeacherId   = Convert.ToInt32(ddlTo.SelectedValue);

                //do student transfer
                success = DbInterfaceStudent.TransferStudents(fromTeacherId, toTeacherId);

                //display message depending on whether or not the operation was successful
                if (success)
                {
                    showSuccessMessage("The students were successfully transferred.");
                    clearPage();
                }
                else
                {
                    showErrorMessage("Error: An error occurred while transferring the students.");
                }
            }
        }