/// <summary> /// /// Click trigger function for the cancel button. /// This will send the user back the ConfirmApplicantForm. /// /// </summary> private void Button_Cancel_Click(object sender, EventArgs e) { Hide(); ConfirmApplicantForm instance_ConfirmApplicantForm = new ConfirmApplicantForm(false); instance_ConfirmApplicantForm.Show(); }
/// <summary> /// /// Click trigger function for the save button. /// This will check the field requirements are met, /// then it will add the applicant to the list and /// send the user to the ConfirmApplicantForm. /// /// </summary> private void Button_Save_Click(object sender, EventArgs e) { // Checks whether an item in the tempTypeBox has been selected // AND whether all the fields have been filled if ((ListBox_TemplateList.SelectedItem != null) && ((TextBox_DetailsFullName.Text.Length > 0) && (TextBox_DetailsJobPosition.Text.Length > 0) && (TextBox_DetailsEmail.Text.Length > 0))) { if ((TextBox_DetailsFullName.Text.Length <= 50) && (TextBox_DetailsJobPosition.Text.Length <= 50) && (TextBox_DetailsEmail.Text.Length <= 50)) { // Insert applicant details into the database Connection.GetDbConn().CreateCommand(SqlQueries.InsertApplicant(TextBox_DetailsFullName.Text, TextBox_DetailsEmail.Text, TextBox_DetailsJobPosition.Text, Recruiter.GetInstance().Id)); // Crearte a new instance of the applicant class Applicant applicant = new Applicant(TextBox_DetailsFullName.Text, TextBox_DetailsEmail.Text, TextBox_DetailsJobPosition.Text, Recruiter.GetInstance().Id, ListBox_TemplateList.SelectedItem.ToString()); // Add the instance into the applicant list Applicant.applicants.Add(applicant); Template.GenerateTemplateForApplicant(applicant, ListBox_TemplateList.SelectedItem.ToString()); Hide(); // Create a new ConfApplDetails form passing the value false ConfirmApplicantForm instance_ConfirmApplicantForm = new ConfirmApplicantForm(true); instance_ConfirmApplicantForm.Show(); } else { Label_Error.Visible = true; Label_Error.Text = "Fields must be 50 characters or less"; } } else { // Displays the error message Label_Error.Visible = true; Label_Error.Text = "Missing required fields"; } }
/// <summary> /// /// Click trigger function for back button. /// This will return to the previous applicant /// feedback, or if at the start of the list, /// return back to the total applicant list. /// If in preview mode, this will bring the user /// back to the preview form. /// /// </summary> private void Button_Back_Click(object sender, EventArgs e) { if (currentMode == Mode.Feedback) { if (currentPosition > 0) { Hide(); FeedbackForm instance_FeedbackForm = NextForm(Direction.Backward, currentPosition); instance_FeedbackForm.Show(); } else if (currentPosition == 0) { Hide(); ConfirmApplicantForm instance_ConfirmApplicantForm = new ConfirmApplicantForm(false); instance_ConfirmApplicantForm.Show(); } } else if (currentMode == Mode.Preview) { Hide(); PreviewForm instance_PreviewForm = new PreviewForm(); instance_PreviewForm.Show(); } }