/// <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); }
/// <summary> /// \brief <b>Description</b> /// \details takes a Seasonalemployee 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(SeasonalEmployee emp) { string[] item = new string[] { emp.Type.ToString(), emp.LastName, emp.FirstName, emp.SIN, emp.DOB.ToString(DateFormat), emp.Season.ToString().ToUpper(), emp.PiecePay.ToString() }; return(string.Join("|", item)); }
/// <summary> /// \brief <b>Description</b> /// \details takes all values in a Seasonal Employee and constructs a string /// to be used in the presentation class to display employee details /// </summary> /// <param name="season">working season for the seasonal employee</param> /// <returns>string thats formated to be displayed in the presentation class</returns> public static string display(SeasonalEmployee employee, bool shouldLog) { string sinTemp = employee.SIN; sinTemp = sinTemp.Insert(6, " "); sinTemp = sinTemp.Insert(3, " "); string print = "Employee Classification : Seasonal \n" + "First Name : " + employee.FirstName + "\n" + "Last Name : " + employee.LastName + "\n" + "Date Of Birth : " + employee.DOB.ToString("yyyy-MM-dd") + "\n" + "SIN : " + sinTemp + "\n" + "Season : " + employee.Season + "\n" + "Piece Pay : " + employee.PiecePay.ToString() + "\n"; if (shouldLog) { Logging.Log("[SeasonalEmployee.Display] Employee: \n" + print); } return(print); }