public override SyntaxNode VisitIdentifierName(IdentifierNameSyntax node)
        {
            if (IdentifierNames.Contains(node))
            {
                return(node
                       .WithIdentifier(NewIdentifier)
                       .WithTriviaFrom(node));
            }

            return(base.VisitIdentifierName(node));
        }
示例#2
0
        private ActionResult DoSearch()
        {
            IdentifierNames  = displayOptions.Default;
            IdentifierLabels = IdentifierNames.ToDictionary(_ => _, path => GetIdentifierDefinitionByPath(path).Name);

            var identifierSearches = SearchGroups
                                     .SelectMany(_ => _.Fields)
                                     .Where(_ => !string.IsNullOrWhiteSpace(_.Value))
                                     .Select(_ => new IdentifierSearch {
                IdentifierName = _.FieldName, Value = _.Value, Operator = GetOperator(_)
            })
                                     .ToArray();

            if (string.IsNullOrEmpty(SubjectIdentifier) && !identifierSearches.Any())
            {
                ModelState.AddModelError("", "Please enter a search criteria");
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var studyIdentity     = Study.Id;
            var consentedSubjects =
                IncludeWithdrawnParticipants
                    ? Subjects.GetSubjectsWithLastWithdrawalDate(studyIdentity).Select(_ => _.studySubject)
                    : Subjects.GetConsentedSubjects(studyIdentity);

            Logger.LogDebug(
                "Found {count} consentedPeople - {consentedPeopleIds}",
                consentedSubjects.LongCount(),
                consentedSubjects);

            ShowPeople = true;
            var peopleDetails = identityRepository.GetPeopleWithIdentifiers(
                consentedSubjects.Select(_ => _.PersonId),
                IdentifierNames,
                user,
                identifierSearches,
                SubjectIdentifier);

            People =
                (from p in peopleDetails
                 join s in consentedSubjects on p.Key equals s.PersonId
                 select new PersonDetails {
                Subject = s, Identifiers = p.Value
            }
                ).ToImmutableList();

            return(Page());
        }