コード例 #1
0
        /// <summary>
        /// Create a single Content Item instance without creating (possible) child Content Item instances.
        /// </summary>
        /// <remarks>
        /// The child Content Items will be created by the CreateContentItems methods.
        /// </remarks>
        /// <param name="attributeSet">The Attribute Set from which the Content Item is constructed.</param>
        /// <returns>A single Content Item instance.</returns>
        private static ContentItem CreateContentItem(AttributeSet attributeSet, ContentItem parentContentItem, uint position)
        {
            ContentItem contentItem = null;

            String valueType = Convert.FirstAttributeValueToString(attributeSet, "0x0040A040");

            valueType = valueType.TrimStart(' ');
            valueType = valueType.TrimEnd(' ');

            switch (valueType)
            {
            case "CODE":
                contentItem = new ContentItemWithValueTypeCode(attributeSet, parentContentItem, position);
                break;

            case "NUM":
                contentItem = new ContentItemWithValueTypeNum(attributeSet, parentContentItem, position);
                break;

            default:
                contentItem = new ContentItem(attributeSet, parentContentItem, position);
                break;
            }

            return(contentItem);
        }
コード例 #2
0
ファイル: ContentItem.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Create a single Content Item instance without creating (possible) child Content Item instances.
        /// </summary>
        /// <remarks>
        /// The child Content Items will be created by the CreateContentItems methods.
        /// </remarks>
        /// <param name="attributeSet">The Attribute Set from which the Content Item is constructed.</param>
        /// <returns>A single Content Item instance.</returns>
        private static ContentItem CreateContentItem(AttributeSet attributeSet, ContentItem parentContentItem, uint position)
        {
            ContentItem contentItem = null;

            String valueType = Convert.FirstAttributeValueToString(attributeSet, "0x0040A040");

            valueType = valueType.TrimStart(' ');
            valueType = valueType.TrimEnd(' ');

            switch (valueType)
            {
                case "CODE":
                    contentItem = new ContentItemWithValueTypeCode(attributeSet, parentContentItem, position);
                    break;

                case "NUM":
                    contentItem = new ContentItemWithValueTypeNum(attributeSet, parentContentItem, position);
                    break;

                default:
                    contentItem = new ContentItem(attributeSet, parentContentItem, position);
                    break;
            }

            return (contentItem);
        }
コード例 #3
0
        /// <summary>
        /// Validate the value for a Content Item with Value Type Num.
        /// </summary>
        /// <param name="contentItemWithValueTypeNum">The Content Item.</param>
        private void ValidateValue(ContentItemWithValueTypeNum contentItemWithValueTypeNum)
        {
            //
            // Validate the Measured Value.
            //

            MeasuredValue measuredValue = contentItemWithValueTypeNum.MeasuredValue;

            if (measuredValue != null)
            {
                ConceptCode measurementUnits = measuredValue.MeasurementUnits;

                if (measurementUnits == null)
                {
                    contentItemWithValueTypeNum.ValidationResults.Add(new ValidationResult("Sequence Item encoding the Measurement Units does not exist."));
                }
                else
                {
                    if (measurementUnits.CodingSchemeDesignator != "UCUM")
                    {
                        measurementUnits.ValidationResults.Add(new ValidationResult("Coding Scheme Designator is not equal to UCUM."));
                    }

                    if (!Dvtk.Ucum.Tools.IsValidTerm(measurementUnits.CodeValue, true, false))
                    {
                        measurementUnits.ValidationResults.Add(new ValidationResult("Code Value does not contain a valid Units of Measurement."));
                    }
                }
            }

            //
            // Validate the Numeric Value qualifier.
            //

            ConceptCode numericValueQualifier = contentItemWithValueTypeNum.NumericValueQualifier;

            if (numericValueQualifier != null)
            {
                this.conceptCodeValidationRule.ValidateUsingContextGroup("42", numericValueQualifier);
            }
        }