Exemplo n.º 1
0
        public static List <RepositoryItemMetadata> GetAllRepositoryQuestions(string agency, Guid id, RepositoryClientBase client)
        {
            // Retrieves data for the selected study from the repository to be used in determining equivalences

            List <RepositoryItemMetadata> infoList = new List <RepositoryItemMetadata>();

            MultilingualString.CurrentCulture = "en-GB";

            //IVersionable item = client.GetLatestItem(id, agency,
            //     ChildReferenceProcessing.Populate);

            IVersionable item = client.GetLatestItem(id, agency);

            var studyUnit = item as StudyUnit;

            SetSearchFacet setFacet = new SetSearchFacet();

            setFacet.ItemTypes.Add(DdiItemType.QuestionItem);

            if (studyUnit == null)
            {
                return(infoList);
            }
            var matches = client.SearchTypedSet(studyUnit.CompositeId,
                                                setFacet);

            infoList = client.GetRepositoryItemDescriptions(matches.ToIdentifierCollection()).ToList();
            return(infoList);
        }
Exemplo n.º 2
0
        public void SetSearch()
        {
            var dataRelationshipIdentifier = new IdentifierTriple(new Guid(), 1, "int.example");

            // Search for all Categories in the DataRelationship's set.
            var facet = new SetSearchFacet();

            facet.ItemTypes.Add(DdiItemType.Category);

            var resultIdentifiers = client.SearchTypedSet(
                dataRelationshipIdentifier,
                facet);

            // The set search only returns the identifiers of items.
            // Request the description of each result here.
            var results = client.GetRepositoryItemDescriptions(
                resultIdentifiers.ToIdentifierCollection());

            // Write a line for each result.
            foreach (var result in results)
            {
                Console.WriteLine(result.Label["en-US"]);
            }
        }