private IEnumerable <int> GetDonorIdsForDonor(MpContactDonor donor) { var donorIds = new HashSet <int>(); if (donor.ExistingDonor) { donorIds.Add(donor.DonorId); } if (donor.StatementTypeId != _statementTypeFamily || !donor.HasDetails) { return(donorIds); } var household = _contactRepository.GetHouseholdFamilyMembers(donor.Details.HouseholdId); if (household == null || !household.Any()) { return(donorIds); } foreach (var member in household) { if (member.StatementTypeId.HasValue && member.StatementTypeId == _statementTypeFamily && member.DonorId.HasValue) { donorIds.Add(member.DonorId.Value); } } return(donorIds); }
public Person GetPerson(int contactId) { var contact = _contactRepository.GetContactById(contactId); var person = Mapper.Map<Person>(contact); var family = _contactRepository.GetHouseholdFamilyMembers(person.HouseholdId); person.HouseholdMembers = family; // TODO: Should this move to _contactService or should update move it's call out to this service? var apiUser = _apiUserService.GetToken(); var configuration = MpObjectAttributeConfigurationFactory.Contact(); var attributesTypes = _objectAttributeService.GetObjectAttributes(apiUser, contactId, configuration); person.AttributeTypes = attributesTypes.MultiSelect; person.SingleAttributes = attributesTypes.SingleSelect; return person; }