private List <HCCEmployee> RetrieveManagerListRecursive(HCCEmployee P, ref List <HCCEmployee> managerList, ref bool IsCircular) { //Recursive solution //Stopping case 1 - no manager if (P.Manager == null) { IsCircular = false; return(managerList); } else { managerList.Add(P.Manager); //Stopping case Number 2 -- circular reference if (managerList.Select(m => m.Id).Distinct().Count() != managerList.Select(m => m.Id).Count()) { //Don't count GM as circular reference if (P.Manager.AccountName.ToLower() != "heathn".ToLower()) { IsCircular = true; } return(managerList); } //Recursive function call return(RetrieveManagerListRecursive(P.Manager, ref managerList, ref IsCircular)); } }
private bool searchJobTitlePredicate(HCCEmployee emp, string[] searchParams) { bool searchPredicate = true; for (int i = 0; i < searchParams.Count(); i++) { searchPredicate = searchPredicate && (emp.JobTitle.ToLower().Contains(searchParams[i].ToLower())); } return(searchPredicate); }
private bool searchNamePredicate(HCCEmployee emp, string[] searchParams) { bool searchPredicate = true; for (int i = 0; i < searchParams.Count(); i++) { searchPredicate = searchPredicate && ((emp.FirstName.ToLower().StartsWith(searchParams[i].ToLower())) || (emp.LastName.ToLower().StartsWith(searchParams[i].ToLower()))); } return(searchPredicate); }