Esempio n. 1
0
        /// <summary>
        /// Populates this <see cref="LabTestResultValue"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the lab test result value type data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If the first node in <paramref name="navigator"/> is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // measurement
            _measurement = new GeneralMeasurement();
            _measurement.ParseXml(navigator.SelectSingleNode("measurement"));

            // ranges
            XPathNodeIterator rangesIterator = navigator.Select("ranges");

            _ranges = new Collection <TestResultRange>();
            foreach (XPathNavigator rangeNav in rangesIterator)
            {
                TestResultRange range = new TestResultRange();
                range.ParseXml(rangeNav);
                _ranges.Add(range);
            }

            // flag
            XPathNodeIterator flagsIterator = navigator.Select("flag");

            _flag = new Collection <CodableValue>();
            foreach (XPathNavigator flagNav in flagsIterator)
            {
                CodableValue singleflag = new CodableValue();
                singleflag.ParseXml(flagNav);
                _flag.Add(singleflag);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructs an instance of suggested calorie intake guideline with specified values.
 /// </summary>
 ///
 /// <remarks>
 /// Examples: Daily calories suggested for weight loss, calories needed for weight
 /// maintenance, BMR.
 /// </remarks>
 ///
 /// <param name="when">
 /// The date and time the guidelines were created.
 /// </param>
 ///
 /// <param name="name">
 /// The name defines the guideline.
 /// </param>
 ///
 /// <param name="calories">
 /// The number of calories to support the guideline.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="when"/>, <paramref name="name"/> or <paramref name="calories"/>
 /// is <b>null</b>.
 /// </exception>
 ///
 public CalorieGuideline(
     ApproximateDateTime when,
     CodableValue name,
     GeneralMeasurement calories)
     : base(TypeId)
 {
     When     = when;
     Name     = name;
     Calories = calories;
 }
Esempio n. 3
0
        /// <summary>
        /// Populates this <see cref="CalorieGuideline"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the calorie guideline data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a "calorie-guideline" node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("calorie-guideline");

            Validator.ThrowInvalidIfNull(itemNav, Resources.CalorieGuidelineUnexpectedNode);

            // when (approxi-date-time, mandatory)
            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // measurement-name (codable-value, mandatory)
            _name = new CodableValue();
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            // calories (general-measurement, mandatory)
            _calories = new GeneralMeasurement();
            _calories.ParseXml(itemNav.SelectSingleNode("calories"));
        }
Esempio n. 4
0
 /// <summary>
 /// Initialize a new instance of the <see cref="LabTestResultValue"/>
 /// class with the specified measurement.
 /// </summary>
 ///
 /// <param name="measurement">
 /// The value of the lab results.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="measurement"/> is <b> null </b>.
 /// </exception>
 ///
 public LabTestResultValue(GeneralMeasurement measurement)
 {
     Measurement = measurement;
 }