/// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a FulltimeEmployee /// </summary> /// <param name="ftEmployee"></param> /// <returns>a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(FulltimeEmployee ftEmployee) { bool confirmed = true; bool[] test = new bool[] { validateName(ftEmployee.Type, ftEmployee.FirstName), validateName(ftEmployee.Type, ftEmployee.LastName), validateDob(ftEmployee.DOB), validateSIN(ftEmployee.Type, ftEmployee.SIN, ftEmployee.DOB), validateStartDate(ftEmployee.DOB, ftEmployee.DateOfHire), validateStopDate(ftEmployee.DateOfHire, ftEmployee.DateOfTermination), validatePay(ftEmployee.Salary) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[FulltimeEmployee.Validate] Employee - " + ftEmployee.LastName + ", " + ftEmployee.FirstName + " (" + ftEmployee.SIN + ") - INVALID"); break; } } return(confirmed); }
/// <summary> /// \brief <b>Description</b> /// \details takes all values in a fulltime Employee and constructs a string /// to be used in the presentation class to display employee details /// </summary> /// <returns>string thats formated to be displayed in the presentation class</returns> public static string display(FulltimeEmployee employee, bool shouldLog) { string sinTemp = employee.SIN; sinTemp = sinTemp.Insert(6, " "); sinTemp = sinTemp.Insert(3, " "); string print = "Employee Classification : Full Time \n" + "First Name : " + employee.FirstName + "\n" + "Last Name : " + employee.LastName + "\n" + "Date Of Birth : " + employee.DOB.ToString(DateFormat) + "\n" + "SIN : " + sinTemp + "\n" + "Date Of Hire : " + employee.DateOfHire.ToString(DateFormat) + "\n"; if (employee.DateOfTermination != null) { DateTime date = (DateTime)employee.DateOfTermination; print += "Date Of Termination : " + date.ToString(DateFormat) + "\n"; } print += "Salary : " + employee.Salary.ToString() + "\n"; if (shouldLog) { Logging.Log("[FulltimeEmployee.Display] Employee: \n" + print); } return(print); }
// TODO /// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a ParttimeEmployee /// </summary> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="dob"></param> /// <param name="sin"></param> /// <param name="dateOfHire"></param> /// <param name="dateOfTermination"></param> /// <param name="hourlyRate"></param> /// <returns>a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(string firstName, string lastName, DateTime dob, string sin, DateTime dateOfHire, DateTime?dateOfTermination, double hourlyRate) { bool confirmed = true; bool[] test = new bool[] { validateName(EmployeeType.PT, firstName), validateName(EmployeeType.PT, lastName), validateDob(dob), validateSIN(EmployeeType.PT, sin, dob), FulltimeEmployee.validateStartDate(dob, dateOfHire), FulltimeEmployee.validateStopDate(dateOfHire, dateOfTermination), FulltimeEmployee.validatePay(hourlyRate) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[ParttimeEmployee.Validate] Employee - " + lastName + ", " + firstName + " (" + sin + ") - INVALID"); break; } } return(confirmed); }
// TODO /// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a SeasonalEmployee /// </summary> /// <param name="lastName"></param> /// <param name="dob"></param> /// <param name="sin"></param> /// <param name="contractStartDate"></param> /// <param name="contractStopDate"></param> /// <param name="fixedContractAmount"></param> /// <returns> a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(string lastName, DateTime dob, string sin, DateTime contractStartDate, DateTime contractStopDate, double fixedContractAmount) { bool confirmed = true; bool[] test = new bool[] { validateName(EmployeeType.CT, lastName), validateDob(dob), validateSIN(EmployeeType.CT, sin, dob), FulltimeEmployee.validateStartDate(dob, contractStartDate), FulltimeEmployee.validateStopDate(contractStartDate, contractStopDate), FulltimeEmployee.validatePay(fixedContractAmount) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[ContractEmployee.Validate] Employee - " + lastName + " (" + sin + ") - INVALID"); break; } } return(confirmed); }
/// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a SeasonalEmployee /// </summary> /// <param name="seEmployee"></param> /// <returns>a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(SeasonalEmployee seEmployee) { bool confirmed = true; bool[] test = new bool[] { validateName(seEmployee.Type, seEmployee.FirstName), validateName(seEmployee.Type, seEmployee.LastName), validateDob(seEmployee.DOB), validateSIN(seEmployee.Type, seEmployee.SIN, seEmployee.DOB), validateSeason(seEmployee.Season), FulltimeEmployee.validatePay(seEmployee.PiecePay) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[SeasonalEmployee.Validate] Employee - " + seEmployee.LastName + ", " + seEmployee.FirstName + " (" + seEmployee.SIN + ") - INVALID"); break; } } return(confirmed); }
// TODO /// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a SeasonalEmployee /// </summary> /// <param name="firstName">first name of the employee</param> /// <param name="lastName">last name of the employee</param> /// <param name="dob">Date of birth of the employee</param> /// <param name="sin">Social Insurance Number of the employee</param> /// <param name="season">season the employee works in</param> /// <param name="piecePay">piecePay of the employee</param> /// <returns>a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(string firstName, string lastName, DateTime dob, string sin, Seasons season, double piecePay) { bool confirmed = true; bool[] test = new bool[] { validateName(EmployeeType.SN, firstName), validateName(EmployeeType.SN, lastName), validateDob(dob), validateSIN(EmployeeType.SN, sin, dob), validateSeason(season), FulltimeEmployee.validatePay(piecePay) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[SeasonalEmployee.Validate] Employee - " + lastName + ", " + firstName + " (" + sin + ") - INVALID"); break; } } return(confirmed); }
/// <summary> /// \brief <b>Description</b> /// \details takes a Fulltimeemployee object and puts all attributes into a string[], /// and then joins all items in the string array into a "|" delimited string. /// </summary> /// <param name="emp"></param> /// <returns>returns the string that holds all the attributes of the employee object delimited by "|"</returns> public static string join(FulltimeEmployee emp) { string term = "N/A"; if (emp.DateOfTermination != null) { DateTime date = (DateTime)emp.DateOfTermination; term = date.ToString(DateFormat); } string[] item = new string[] { emp.Type.ToString(), emp.LastName, emp.FirstName, emp.SIN, emp.DOB.ToString(DateFormat), emp.DateOfHire.ToString(DateFormat), term, emp.Salary.ToString() }; return(string.Join("|", item)); }
/// <summary> /// \brief <b>Description</b> /// \details Validates all attributes associated with a SeasonalEmployee /// </summary> /// <param name="ctEmployee"></param> /// <returns> a bool that indicates whether the values to validate are acceptable</returns> public static bool validate(ContractEmployee ctEmployee) { bool confirmed = true; bool[] test = new bool[] { validateName(ctEmployee.Type, ctEmployee.LastName), validateDob(ctEmployee.DOB), validateSIN(ctEmployee.Type, ctEmployee.SIN, ctEmployee.DOB), FulltimeEmployee.validateStartDate(ctEmployee.DOB, ctEmployee.ContractStartDate), FulltimeEmployee.validateStopDate(ctEmployee.ContractStartDate, ctEmployee.ContractStopDate), FulltimeEmployee.validatePay(ctEmployee.FixedContractAmount) }; foreach (bool flag in test) { if (!flag) { confirmed = false; Logging.Log("[ContractEmployee.Validate] Employee - " + ctEmployee.LastName + " (" + ctEmployee.SIN + ") - INVALID"); break; } } return(confirmed); }