/// <summary>Loads the people, assigns them, and notifies them.</summary> public int Assign() { try { int exit = 0; // loading the participants _status.Info("Loading people.."); var people = _loadSvc.GetPeople(); exit = this.ValidatePeople(people); if (exit != 0) { return(exit); } // assign the people _status.Info($"Assigning {people.Count:N0} people.."); List <Assignment> result = null; for (int i = 0; i < _loadSvc.MaxIterations; i++) { result = _assignSvc.AssignPeople(people); if (result != null) { break; } _status.Debug("retrying assignment"); } if (result == null) { return(_status.Fail(508, "Unable to assign people.")); } // save the results.. _status.Info("Saving results to file.."); _storageSvc.SaveResults(result); // send messages _status.Info("Sending Messages to everyone.."); _msgSvc.SendMessages(result); return(0); } catch (Exception ex) { return(_status.Fail(500, ex.Message)); } }