예제 #1
0
        public void AddSubject()
        {
            if (teacherController.CheckIfSubjectExists(SubjectName))
            {
                if (teacherController.CheckIfSubjectIsWritten(SubjectName))
                {
                    teacherController.SetCurrentSubjectName(SubjectName);
                }
                else
                {
                    MessageBox.Show("Please add a subject name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Subject already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            teacherController.CommitChangedSubject();
            MessageBox.Show("Success!", "Operation Completed", MessageBoxButtons.OK);

            // Clears the subjectNameTxtBox so it can be ready for the next time it's needed
            subjectNameTxtBox.Clear();
        } // R