コード例 #1
0
        /// <summary>
        /// The method retrieve a value from the reader and cast it to <see cref="TertiaryBool"/> data type
        /// </summary>
        /// <param name="dataReader">
        /// The source for reading the data
        /// </param>
        /// <param name="index">
        /// The index of the column containing the value
        /// </param>
        /// <returns>
        /// The extracted value as <see cref="TertiaryBool"/>
        /// </returns>
        public static TertiaryBool GetTristate(IDataRecord dataReader, int index)
        {
            bool?ret = null;

            var value = dataReader.GetValue(index);

            if (!Convert.IsDBNull(value))
            {
                ret = Convert.ToBoolean(dataReader.GetValue(index), CultureInfo.InvariantCulture);
            }

            return(SdmxObjectUtil.CreateTertiary(ret));
        }
コード例 #2
0
        /// <summary>
        /// Handles the detail level.
        /// </summary>
        /// <param name="detail">The detail.</param>
        /// <param name="retrieveDetails">The retrieve details.</param>
        /// <param name="artefactPkPairs">The artefact - primary key pairs.</param>
        /// <returns>The artefacts.</returns>
        private ISet <T> HandleDetailLevel(ComplexStructureQueryDetailEnumType detail, Func <T, long, T> retrieveDetails, IEnumerable <KeyValuePair <T, long> > artefactPkPairs)
        {
            ISet <T> artefacts = new HashSet <T>();

            foreach (var artefactPkPair in artefactPkPairs)
            {
                var artefact = artefactPkPair.Key;
                var sysId    = artefactPkPair.Value;
                switch (detail)
                {
                case ComplexStructureQueryDetailEnumType.MatchedItems:
                    break;

                case ComplexStructureQueryDetailEnumType.CascadedMatchedItems:
                    break;

                case ComplexStructureQueryDetailEnumType.Null:
                case ComplexStructureQueryDetailEnumType.Full:
                    artefact = retrieveDetails(artefact, sysId);
                    break;

                case ComplexStructureQueryDetailEnumType.CompleteStub:
                case ComplexStructureQueryDetailEnumType.Stub:
                    artefact.ExternalReference = SdmxObjectUtil.CreateTertiary(true);
                    artefact.Stub         = true;
                    artefact.StructureURL = DefaultUri;
                    break;
                }

                if (!artefact.IsDefault())
                {
                    artefacts.Add(artefact);

                    if (detail != ComplexStructureQueryDetailEnumType.Stub)
                    {
                        this._maintainableAnnotationRetrieverEngine.RetrieveAnnotations(sysId, artefact);
                    }
                }
            }

            return(artefacts);
        }
コード例 #3
0
        /// <summary>
        /// Normalizes the detail level.
        /// </summary>
        /// <param name="detail">The detail.</param>
        /// <param name="categorisations">The categorisations.</param>
        private static void NormalizeDetailLevel(ComplexStructureQueryDetailEnumType detail, IEnumerable <ICategorisationMutableObject> categorisations)
        {
            foreach (var categorisation in categorisations)
            {
                switch (detail)
                {
                case ComplexStructureQueryDetailEnumType.CompleteStub:
                    categorisation.ExternalReference = SdmxObjectUtil.CreateTertiary(true);
                    categorisation.Stub               = true;
                    categorisation.StructureURL       = DefaultUri;
                    categorisation.CategoryReference  = null;
                    categorisation.StructureReference = null;
                    break;

                case ComplexStructureQueryDetailEnumType.Stub:
                    categorisation.Descriptions.Clear();
                    goto case ComplexStructureQueryDetailEnumType.CompleteStub;
                }
            }
        }