/// <summary> /// Search for Applicant or ForceService object from the collection and return it /// </summary> /// <param name="sType">a string represent the search term</param> /// <returns> an object of type IDisplay</returns> /// <summary> /// Display formatted data for the object passed in as parameter /// </summary> /// <param name="displayObject">an object of type IDisplay</param> /// <summary> /// Add new Student to the system /// </summary> public void AddApplicant() { //Open new form to input student's data AddNewDataForm addForm = new AddNewDataForm("applicant", applicantList, cboApplicants); addForm.ShowDialog(); if (addForm.ShowDialog() == DialogResult.OK) { // Get new applicant data from second form //Applicant newApplicant = addForm.GetApplicantData(); //Add new applicant to applicant list bool success = applicantList.AddApplicant(newApplicant); if (success) { MessageBox.Show(newApplicant.RegNo + " has been added to the list"); //redisplay list of Applicants DisplayAll(applicantList); // Display new applicant txtDisplay.Clear(); //txtDisplay.Text = newApplicant.Display(); } else { MessageBox.Show("\nUnable to add. This applicant RegNo already been used"); } } }
/// <summary> /// Add new ForceService to the system /// </summary> public void AddServiceForce() { //Open new form to input ForceService's data AddNewDataForm addForm = new AddNewDataForm("forceService"); if (addForm.ShowDialog() == DialogResult.OK) { // Get new forceService data from second form ForceService newForceService = addForm.GetForceServiceData(); //Add new forceService to forceService list bool success = forceServiceList.AddForceService(newForceService); if (success) { MessageBox.Show(newForceService.FSNo + " has been added to the list"); //redisplay list of ForceServices DisplayAll(forceServiceList); // Display new forceService txtDisplay.Clear(); //txtDisplay.Text = newForceService.Display(); } else { MessageBox.Show("\nUnable to add. This forceService FSNo already been used"); } } }
private void addNewApplicantToolStripMenuItem_Click(object sender, EventArgs e) { AddNewDataForm newApplicant = new AddNewDataForm("A", applicantList, cboApplicants); newApplicant.ShowDialog(); }