public void ValidateInputValues() { List <string> ValidationErrors = new List <string>(); if (PaySlipEntries.Any(ps => ps.AnnualSalary < MinAnnualSalary)) { ValidationErrors.Add(String.Format(CultureInfo.CurrentCulture, "Annual Salaries ({0})", String.Join(Display.CommaSpaceSeparator, PaySlipEntries.Where(ps => ps.AnnualSalary < MinAnnualSalary).Select(s => s.AnnualSalary.ToString(CultureInfo.CurrentCulture)).ToList()))); } if (PaySlipEntries.Any(ps => (ps.SuperRate <= MinSuperRate || ps.SuperRate >= MaxSuperRate))) { ValidationErrors.Add(String.Format(CultureInfo.CurrentCulture, "Super Rates ({0})", String.Join(Display.CommaSpaceSeparator, PaySlipEntries.Where(ps => (ps.SuperRate <= MinSuperRate || ps.SuperRate >= MaxSuperRate)).Select(s => s.SuperRate.ToString(CultureInfo.CurrentCulture)).ToList()))); } if (ValidationErrors.Any()) { throw new ValidationException(String.Format(CultureInfo.CurrentCulture, "Validation failed, {0} are outside the expected thresholds.", String.Join(Display.CommaSpaceSeparator, ValidationErrors))); } }
public IEnumerator <PaySlipEntry> GetEnumerator() { return(PaySlipEntries.GetEnumerator()); }