/*************************************** * * This is where the UTILITY METHODS are. * ***************************************/ /// <summary> /// This clears the form after an entry is added. /// </summary> private void ClearForm() { TxtEmpID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtMiddleName.Clear(); TxtXtraProp1.Clear(); TxtXtraProp2.Clear(); CkbActiveEmployee.Checked = true; CkbBenefits.Checked = true; CkbApproved.Checked = true; LVxCourses.Items.Clear(); TxtCourseID.Clear(); TxtGrade.Clear(); TxtDescription.Clear(); TxtDateApproved.Clear(); TxtCredits.Clear(); TxtMaritalStatus.Clear(); TxtDepartment.Clear(); TxtTitle.Clear(); TxtStartDate.Clear(); }
} // end method UpdateCurrEmp() /// <summary> /// To change eligible fields & compensation types based on the selected emp type /// </summary> /// <param name="sender">The object generating the event</param> /// <param name="e">The event args</param> private void CBxType_SelectionChangeCommitted(object sender, EventArgs e) { //Show dialog prompting user that they are about to change the emp type //Results in a change of benefit & comp values DialogResult result = MessageBox.Show(TYPE_CHANGE_MSG, TYPE_CHANGE_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //If user does want to change the emp type if (result.Equals(DialogResult.Yes)) { //Clear comp txt boxes TxtComp1.Clear(); TxtComp2.Clear(); TxtComp3.Clear(); TxtDepartment.Clear(); TxtTitle.Clear(); //Determine selected emp type if (CBxType.Text.Equals(LITERAL_HOURLY)) { //Change eligible benefits TxtOvertime.Text = LITERAL_YES; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_NO; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_HRY_RATE; LblComp2.Visible = true; TxtComp2.Visible = true; LblComp2.Text = LITERAL_HOURS_WORKED; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if if (CBxType.Text.Equals(LITERAL_SALARY)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_YES; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_SAL_RATE; LblComp2.Visible = false; TxtComp2.Visible = false; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if if (CBxType.Text.Equals(LITERAL_SALES)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_YES; TxtBenefits.Text = LITERAL_YES; TxtEduBenefits.Text = LITERAL_YES; //Change comp types LblComp1.Text = LITERAL_SAL_RATE; LblComp2.Text = LITERAL_SRY_RATE; LblComp2.Visible = true; LblComp2.Text = LITERAL_SRY_RATE; TxtComp2.Visible = true; LblComp3.Visible = true; LblComp3.Text = LITERAL_SALES; TxtComp3.Visible = true; } // end if if (CBxType.Text.Equals(LITERAL_CONTRACT)) { //Change eligible benefits TxtOvertime.Text = LITERAL_NO; TxtCommission.Text = LITERAL_NO; TxtBenefits.Text = LITERAL_NO; TxtEduBenefits.Text = LITERAL_NO; //Change comp types LblComp1.Text = LITERAL_CON_RATE; LblComp2.Visible = true; LblComp2.Text = LITERAL_AGENCY; TxtComp2.Visible = true; LblComp3.Visible = false; TxtComp3.Visible = false; } // end if //Show request approval btn based on eduBfts eligibility & prior approval //If the emp now has education benefits (whether value has changed or not) if (TxtEduBenefits.Text.Equals(LITERAL_YES)) { //If the current emp already obtained eduBft approval if (CurrEmp.EducationBenefitsApproved) { BtnEmpBenefits.Visible = true; } // end if else // emp still needs approval { //Show approval request btn BtnRequestApproval.Visible = true; } // end else } // end if } // end if - DialogResult } // end method CBxType_SelectionChangeCommitted()