Beispiel #1
0
 // 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
Beispiel #2
0
        private void frmOwlCommunity_Load(System.Object sender, System.EventArgs e)
        {
            // Read serialized binary data file
            SFManager.readFromFile(ref thisOwlMemberList, FileName);

            FormController.clear(this);
            FormController.activateAddButtons(this);

            // get initial Tooltips
            toolTip1.SetToolTip(btnCreateGraduateStudent, ttCreateGraduateStudent);
            toolTip1.SetToolTip(btnCreateUndergraduateStudent, ttCreateUndergraduateStudent);
            toolTip1.SetToolTip(btnCreateFaculty, ttCreateFaculty);
            toolTip1.SetToolTip(btnCreateChairperson, ttCreateChairperson);

            toolTip1.SetToolTip(btnClear, ttClear);
            toolTip1.SetToolTip(btnDelete, ttDelete);
            toolTip1.SetToolTip(btnEdit, ttEdit);
            toolTip1.SetToolTip(btnFind, ttFind);
            toolTip1.SetToolTip(btnExit, ttExit);

            toolTip1.SetToolTip(txtUndergraduateStudentTuition, ttUndergradTuition);
            toolTip1.SetToolTip(cbUndergraduateStudentYear, ttUndergradYear);
            toolTip1.SetToolTip(txtUndergraduateStudentCredits, ttUndergradCredits);
            toolTip1.SetToolTip(txtGraduateStudentStipend, ttGraduateStudentStipend);
            toolTip1.SetToolTip(cbGraduateStudentDegreeProgram, ttGraduateStudentDegreeProgram);
            toolTip1.SetToolTip(txtOwlMemberName, ttOwlName);
            toolTip1.SetToolTip(dtpOwlMemberBirthDate, ttOwlBirthDate);
            toolTip1.SetToolTip(txtOwlMemberID, ttOwlID);
            toolTip1.SetToolTip(txtStudentMajor, ttStudentMajor);
            toolTip1.SetToolTip(txtStudentMajor, ttStudentGPA);
            toolTip1.SetToolTip(txtFacultyDepartment, ttFacultyDepartment);
            toolTip1.SetToolTip(cbFacultyRank, ttFacultyRank);
            toolTip1.SetToolTip(txtChairPersonStipend, ttChairpersonStipend);
        } // end frmEmpMan_Load
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isFound = false;
            int  member2 = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out isFound);

            if (isFound)
            {
                OwlMember p = thisOwlMemberList.getAnItem(member2);
                p.Display(this);

                if (MessageBox.Show("Are you sure you want to delete", "", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    thisOwlMemberList.removeFromList(p);
                    FormController.clear(this);
                    txtTargetID.Text = "";
                }
                else
                {
                    FormController.clear(this);
                }
            }
            else
            {
                MessageBox.Show("No member exists with that ID");
            }
        }
Beispiel #4
0
        }//end btnFind

        // Validates OwlID and Tries to Find It
        private bool findAnItem
            (string operationType)
        {
            bool success;

            btnEdit.Enabled           = false;
            btnDelete.Enabled         = false;
            btnSaveEditUpdate.Enabled = false;
            if (txtTargetID.Text.Length != 9)
            {
                MessageBox.Show("Valid Owl ID required for a " + operationType + " Renter ID.",
                                "Invalid ID for " + operationType, MessageBoxButtons.OK);
                FormController.clear(this);
                txtOwlMemberID.Text = "";
                txtOwlMemberID.Focus();
                // FormController.resetForm(this);
                success = false;
            }
            else if (thisOwlMemberList.getCount() == 0)
            {
                MessageBox.Show("No Owls to " + operationType + "Try a different command.",
                                "No " + operationType + " Empty List", MessageBoxButtons.OK);
                FormController.clear(this);
                txtOwlMemberID.Text = "";
                txtOwlMemberID.Focus();
                // FormController.resetForm(this);
                success = false;
            }
            else
            {
                // Try to find and display item to process
                bool found;
                currentIndex = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out found);
                if (!found)  // Display results for processing (Find, Delete, or Edit/Update)
                {
                    MessageBox.Show("Error. ID entered does not appear in the OwlList. Reenter.",
                                    "ID Not Found Error on " + operationType, MessageBoxButtons.OK);
                    txtOwlMemberID.Text = "";
                    txtOwlMemberID.Focus();
                    success = false;
                }
                else
                // Verify and then display list element and DB element
                {
                    OwlMember p = thisOwlMemberList.getAnItem(currentIndex);
                    displayRelevantFormPart(p);
                    p.Display(this);
                    success = true;
                    recordsProcessedCount++;
                } // end if-else on found
            }     // end multiple alternative if
            return(success);
        }         // end findAnItem
Beispiel #5
0
        } // 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();
                }
            }
        }
Beispiel #6
0
 private void btnCreateGraduateStudent_Click(object sender, EventArgs e)
 {
     DisplayGraduateStudentForm();
     if (clickCounter == 0)
     {
         DisplayGraduateStudentForm();
         //MessageBox.Show("Clickcounter = " + clickCounter);
         clickCounter++;
         //MessageBox.Show("Clickcounter = " + clickCounter);
     }
     else
     {
         GraduateStudent member = new GraduateStudent();
         member.Save(this);
         thisOwlMemberList.addToList(member);
         clickCounter += 1;
         FormController.clear(this);
         FormController.activateAddButtons(this);
     }
 }
Beispiel #7
0
        private void btnCreateChairperson_Click(object sender, EventArgs e)
        {
            DisplayChairPersonForm();
            if (clickCounter == 0)
            {
                DisplayChairPersonForm();
                //MessageBox.Show("Clickcounter = " + clickCounter);
                clickCounter++;
                //MessageBox.Show("Clickcounter = " + clickCounter);
            }
            else
            {
                FacultyChairPerson member = new FacultyChairPerson();
                member.Save(this);
                thisOwlMemberList.addToList(member);

                clickCounter += 1;

                FormController.clear(this);
                FormController.activateAddButtons(this);
            }
        }
Beispiel #8
0
        } // end DisplayFacultyForm

        //Displays the part of the form for Undergrad processing
        void DisplayGraduateStudentForm()
        {
            // Display form for Create/Insert or Find/SELECT or Edit/Update or Delete a Undergrad
            btnCreateGraduateStudent.Text = "Save GraduateStudent";
            FormController.formAddMode(this);
            txtOwlMemberID.Enabled                = true;
            txtOwlMemberName.Enabled              = true;
            dtpOwlMemberBirthDate.Enabled         = true;
            txtFacultyDepartment.Enabled          = false;
            cbFacultyRank.Enabled                 = false;
            btnCreateGraduateStudent.Enabled      = true;
            btnCreateUndergraduateStudent.Enabled = false;
            btnCreateFaculty.Enabled              = false;
            btnCreateChairperson.Enabled          = false;
            txtChairPersonStipend.Enabled         = false;
            btnEnterID.Enabled = false;
            FormController.deactivateFaculty(this);
            FormController.activateGraduateStudent(this);
            FormController.deactivateChairperson(this);
            FormController.deactivateUndergraduateStudent(this);
            toolTip1.SetToolTip(btnCreateGraduateStudent, ttSaveGraduateStudent);
        } // end DisplayGraduateForm
Beispiel #9
0
        private void btnCreateUndergraduateStudent_Click(object sender, EventArgs e)
        {
            if (clickCounter == 0)
            {
                DisplayUndergraduateStudentForm();
                //MessageBox.Show("Clickcounter = " + clickCounter);
                clickCounter++;
                //MessageBox.Show("Clickcounter = " + clickCounter);
            }
            else
            {
                OwlMember member = new UndergraduateStudent();
                member.Save(this);
                thisOwlMemberList.addToList(member);
                thisOwlMemberList.displayMembers();
                SFManager.writeToFile(thisOwlMemberList, FileName);

                clickCounter += 1;

                FormController.clear(this);
                FormController.activateAddButtons(this);
            }
        }
Beispiel #10
0
        private void btnSaveEditUpdate_Click(object sender, EventArgs e)
        {
            bool isFound = false;
            int  member2 = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out isFound);

            if (isFound)
            {
                OwlMember p = thisOwlMemberList.getAnItem(member2);

                if (MessageBox.Show("Are you sure you want to Save update", "", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    if (p.GetType() == typeof(UndergraduateStudent))
                    {
                        bool one   = validator.ValidateID(txtOwlMemberID.Text);
                        bool two   = validator.ValidGPA(txtStudentGPA.Text);
                        bool three = validator.ValidateCredits(txtUndergraduateStudentCredits.Text);
                        bool four  = validator.ValidateMajor(txtStudentMajor.Text);
                        bool five  = validator.ValidateName(txtOwlMemberName.Text);
                        bool six   = validator.ValidateTuition(txtUndergraduateStudentTuition.Text);
                        bool seven = validator.ValidateYear(cbUndergraduateStudentYear.Text);
                        if (one == false || two == false || three == false || four == false || five == false || six == false || seven == false)
                        {
                            txtTargetID.Focus();
                            MessageBox.Show("Go back");
                        }
                        else
                        {
                            p.Save(this);
                            thisOwlMemberList.displayMembers();
                            FormController.clear(this);
                        }
                    }

                    if (p.GetType() == typeof(GraduateStudent))
                    {
                        bool one   = validator.ValidateID(txtOwlMemberID.Text);
                        bool two   = validator.ValidGPA(txtStudentGPA.Text);
                        bool three = validator.ValidateGraduateStipend(txtGraduateStudentStipend.Text);
                        bool four  = validator.ValidateMajor(txtStudentMajor.Text);
                        bool five  = validator.ValidateName(txtOwlMemberName.Text);
                        bool six   = validator.ValidateDegreeProgram(cbGraduateStudentDegreeProgram.Text);
                        if (one == false || two == false || three == false || four == false || five == false || six == false)
                        {
                            txtTargetID.Focus();
                            MessageBox.Show("Go back");
                        }
                        else
                        {
                            p.Save(this);
                            thisOwlMemberList.displayMembers();
                            FormController.clear(this);
                        }
                    }
                    if (p.GetType() == typeof(FacultyMember))
                    {
                        bool one   = validator.ValidateID(txtOwlMemberID.Text);
                        bool two   = validator.ValidateName(txtOwlMemberName.Text);
                        bool three = validator.ValidateDepartment(txtFacultyDepartment.Text);
                        bool four  = validator.ValidateRank(cbFacultyRank.Text);

                        if (one == false || two == false || three == false || four == false)
                        {
                            txtTargetID.Focus();
                            MessageBox.Show("Go back");
                        }
                        else
                        {
                            p.Save(this);
                            thisOwlMemberList.displayMembers();
                            FormController.clear(this);
                        }
                    }

                    if (p.GetType() == typeof(FacultyChairPerson))
                    {
                        bool one   = validator.ValidateID(txtOwlMemberID.Text);
                        bool two   = validator.ValidateName(txtOwlMemberName.Text);
                        bool three = validator.ValidateDepartment(txtFacultyDepartment.Text);
                        bool four  = validator.ValidateRank(cbFacultyRank.Text);
                        bool five  = validator.ValidateChairpersonStipend(txtChairPersonStipend.Text);

                        if (one == false || two == false || three == false || four == false || five == false)
                        {
                            txtTargetID.Focus();
                            MessageBox.Show("Go back");
                        }
                        else
                        {
                            p.Save(this);
                            thisOwlMemberList.displayMembers();
                            FormController.clear(this);
                        }
                    }
                }
                else
                {
                    FormController.clear(this);
                }
            }
        }
Beispiel #11
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     FormController.clear(this);
     FormController.activateAddButtons(this);
     buttonpress = 0;
 }