// Display Undergrad, Faculty, or GradStudent Form Depending on Type of Object Found void displayRelevantFormPart(OwlMember p) { if (p.GetType() == typeof(UndergraduateStudent)) { FormController.activateUndergraduateStudent(this); FormController.deactivateGraduateStudent(this); FormController.deactivateFaculty(this); FormController.deactivateChairperson(this); } else if (p.GetType() == typeof(GraduateStudent)) { FormController.activateGraduateStudent(this); FormController.deactivateUndergraduateStudent(this); FormController.deactivateFaculty(this); FormController.deactivateChairperson(this); } else if (p.GetType() == typeof(FacultyMember)) { FormController.deactivateGraduateStudent(this); FormController.deactivateUndergraduateStudent(this); FormController.activateFaculty(this); FormController.deactivateChairperson(this); } else if (p.GetType() == typeof(FacultyChairPerson)) { FormController.deactivateGraduateStudent(this); FormController.deactivateUndergraduateStudent(this); FormController.deactivateFaculty(this); FormController.activateChairperson(this); } }//end displayRelevatnFormPart
} // end DisplayFacultyForm private void btnEdit_Click(object sender, EventArgs e) { bool success; btnFind.Enabled = false; btnDelete.Enabled = false; btnSaveEditUpdate.Enabled = false; success = findAnItem("Edit/Update"); if (success) { btnSaveEditUpdate.Enabled = true; btnEdit.Enabled = false; OwlMember p = thisOwlMemberList.getAnItem(currentIndex); txtOwlMemberName.Text = p.OwlName; txtOwlMemberID.Text = p.owlID.ToString(); txtOwlMemberBirthDate.Text = Convert.ToDateTime(p.owlBirthDate).ToString("MM/dd/yyyy"); MessageBox.Show("Edit/UPDATE current Owl (as shown). Press Save Updates Button", "Edit/Update Notice", MessageBoxButtons.OK); // if (thisOwlList.getAnItem(currentIndex).GetType().ToString() == "EmpMan.Undergrad") if (p.GetType() == typeof(UndergraduateStudent)) { FormController.activateUndergraduateStudent(this); FormController.deactivateFaculty(this); FormController.deactivateGraduateStudent(this); FormController.deactivateChairperson(this); FormController.deactivateAddButtons(this); txtStudentMajor.Text = ((Student)p).studentMajor; txtStudentGPA.Text = ((Student)p).studentGPA.ToString(); txtUndergraduateStudentTuition.Text = (((UndergraduateStudent)p).getUndergraduateStudentTuition()).ToString(); txtUndergraduateStudentYear.Text = (((UndergraduateStudent)p).getUndergraduateStudentYear()); txtUndergraduateStudentCredits.Text = (((UndergraduateStudent)p).getUndergraduateStudentCredits()).ToString(); } else if (p.GetType() == typeof(GraduateStudent)) { FormController.activateGraduateStudent(this); FormController.deactivateFaculty(this); FormController.deactivateUndergraduateStudent(this); FormController.deactivateChairperson(this); FormController.deactivateAddButtons(this); txtStudentMajor.Text = ((Student)p).studentMajor; txtStudentGPA.Text = ((Student)p).studentGPA.ToString(); txtGraduateStudentStipend.Text = (((GraduateStudent)p).getGraduateStudentStipend()).ToString(); txtGraduateStudentDegreeProgram.Text = (((GraduateStudent)p).getGraduateStudentDegreeProgram()).ToString(); } } }
} // end DisplayChairpersonForm //Displays the part of the form for Undergrad processing void DisplayUndergraduateStudentForm() { // Display form for Create/Insert or Find/SELECT or Edit/Update or Delete a Undergrad btnCreateUndergraduateStudent.Text = "Save Undersgraduatestudent"; FormController.formAddMode(this); txtOwlMemberID.Enabled = true; txtOwlMemberName.Enabled = true; dtpOwlMemberBirthDate.Enabled = true; txtFacultyDepartment.Enabled = false; cbFacultyRank.Enabled = false; btnCreateGraduateStudent.Enabled = false; btnCreateUndergraduateStudent.Enabled = true; btnCreateFaculty.Enabled = false; btnCreateChairperson.Enabled = false; txtChairPersonStipend.Enabled = false; btnEnterID.Enabled = false; FormController.deactivateFaculty(this); FormController.deactivateGraduateStudent(this); FormController.deactivateChairperson(this); FormController.activateUndergraduateStudent(this); toolTip1.SetToolTip(btnCreateUndergraduateStudent, ttSaveUndergraduateStudent); } // end DisplayFacultyForm