/// <summary> /// Creates a new instance of the <see cref="DurationValue"/> class with /// the specified starting and ending date. /// </summary> /// /// <param name="startDate"> /// The start date/time of the duration value. /// </param> /// /// <param name="endDate"> /// The end date/time of the duration value. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="startDate"/> or <paramref name="endDate"/> /// parameter is <b>null</b>. /// </exception> /// public DurationValue( ApproximateDateTime startDate, ApproximateDateTime endDate) { StartDate = startDate; EndDate = endDate; }
/// <summary> /// Populates this <see cref="BodyComposition"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the body composition data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a "body-composition" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("body-composition"); Validator.ThrowInvalidIfNull(itemNav, Resources.BodyCompositionUnexpectedNode); // when (approxi-date-time, mandatory) _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // measurement-name (codable-value, mandatory) _measurementName = new CodableValue(); _measurementName.ParseXml(itemNav.SelectSingleNode("measurement-name")); // value (BodyCompositionValue, mandatory) _value = new BodyCompositionValue(); _value.ParseXml(itemNav.SelectSingleNode("value")); // measurement-method (codable value ) _measurementMethod = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "measurement-method"); // site _site = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "site"); }
/// <summary> /// Creates a new instance of the <see cref="HealthJournalEntry"/> class /// specifying mandatory values. /// </summary> /// /// <remarks> /// This item is not added to the health record until the <see cref="IThingClient.CreateNewThingsAsync{ThingBase}(Guid, ICollection{ThingBase})"/> method is called. /// </remarks> /// /// <param name="when"> /// The date and time associated with the journal entry. /// </param> /// <param name="content"> /// The text content of this health journal entry. /// </param> /// /// <exception cref="ArgumentException"> /// If <paramref name="content"/> is <b>null</b>, empty or contains only whitespace. /// </exception> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> is <b>null</b>. /// </exception> /// public HealthJournalEntry( ApproximateDateTime when, string content) : base(TypeId) { When = when; Content = content; }
/// <summary> /// Creates a new instance of the <see cref="Comment"/> class /// specifying mandatory values. /// </summary> /// /// <remarks> /// This item is not added to the health record until the <see cref="IThingClient.CreateNewThingsAsync{ThingBase}(Guid, ICollection{ThingBase})"/> method is called. /// </remarks> /// /// <param name="when"> /// The date and time associated with the comment. /// </param> /// <param name="content"> /// The text content of this health comment. /// </param> /// /// <exception cref="ArgumentException"> /// If <paramref name="content"/> is <b>null</b>, empty or contains only whitespace. /// </exception> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> is <b>null</b>. /// </exception> /// public Comment( ApproximateDateTime when, string content) : base(TypeId) { When = when; Content = content; }
/// <summary> /// Creates a new instance of the <see cref="Directive"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="startDate"> /// The date the directive takes effect. /// </param> /// /// <param name="stopDate"> /// The date the directive stops being effective. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="startDate"/> parameter or <paramref name="stopDate"/> /// is <b>null</b> or empty. /// </exception> /// public Directive( ApproximateDateTime startDate, ApproximateDateTime stopDate) : base(TypeId) { StartDate = startDate; StopDate = stopDate; }
/// <summary> /// Creates a new instance of the <see cref="HealthEvent"/> class /// specifying mandatory values. /// </summary> /// /// <remarks> /// This item is not added to the health record until the <see cref="IThingClient.CreateNewThingsAsync{ThingBase}(Guid, ICollection{ThingBase})"/> method is called. /// </remarks> /// /// <param name="when"> /// The date and time the event occurred. /// </param> /// <param name="eventValue"> /// The name of the health event. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> is <b>null</b>. /// If <paramref name="eventValue"/> is <b>null</b>. /// </exception> /// public HealthEvent( ApproximateDateTime when, CodableValue eventValue) : base(TypeId) { When = when; Event = eventValue; }
/// <summary> /// Creates an instance of <see cref="ExerciseSamples"/> with specified parameters. /// </summary> /// /// <param name="when">The date and time the samples were recorded.</param> /// <param name="name">The kind of information that is stored in this set of samples.</param> /// <param name="unit">The unit of measure for the samples.</param> /// <param name="samplingInterval">The time interval between samples in seconds.</param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> is <b>null</b>. /// </exception> /// public ExerciseSamples(ApproximateDateTime when, CodableValue name, CodableValue unit, double samplingInterval) : base(TypeId) { When = when; Name = name; Unit = unit; SamplingInterval = samplingInterval; Sections |= ThingSections.BlobPayload; }
/// <summary> /// Creates an instance of information about the body composition of the record owner /// with specified time, measurement name, and value. /// </summary> /// /// <remarks> /// Examples: % body fat, lean muscle mass. /// </remarks> /// /// <param name="when"> /// The date and time of the measurement. /// </param> /// /// <param name="measurementName"> /// The name of the measurement. /// </param> /// /// <param name="compositionValue"> /// The value of the measurement. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/>, <paramref name="measurementName"/> or /// <paramref name="compositionValue"/> is <b>null</b>. /// </exception> /// public BodyComposition( ApproximateDateTime when, CodableValue measurementName, BodyCompositionValue compositionValue) : base(TypeId) { When = when; MeasurementName = measurementName; Value = compositionValue; }
/// <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; }
/// <summary> /// Stores a body dimension. /// </summary> /// /// <remarks> /// Examples: Waist size, head circumference, length (pediatric). /// </remarks> /// /// <param name="when"> /// The date and time of the body dimension measurement. /// </param> /// /// <param name="measurementName"> /// The name of the body dimension measurement. /// </param> /// /// <param name="value"> /// The value of the body dimension measurement. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/>, <paramref name="measurementName"/> or /// <paramref name="value"/> is <b>null</b>. /// </exception> /// public BodyDimension( ApproximateDateTime when, CodableValue measurementName, Length value) : base(TypeId) { When = when; MeasurementName = measurementName; Value = value; }
/// <summary> /// Populates this <see cref="GeneticSnpResults"/> instance from the data /// in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the genetic snp result data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// an "genetic-snp-results" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("genetic-snp-results"); Validator.ThrowInvalidIfNull(itemNav, Resources.GeneticSnpResultsUnexpectedNode); // <when> mandatory _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // <genome-build> mandatory _genomeBuild = itemNav.SelectSingleNode("genome-build").Value; // <chromosome> mandatory _chromosome = itemNav.SelectSingleNode("chromosome").Value; // <numbering-scheme> mandatory int numberingScheme = itemNav.SelectSingleNode("numbering-scheme").ValueAsInt; if ((numberingScheme == 0) || (numberingScheme == 1)) { _numberingScheme = (GenomeNumberingScheme)numberingScheme; } else { _numberingScheme = GenomeNumberingScheme.Unknown; } // ordered-by _orderedBy = XPathHelper.GetOptNavValue <Organization>(itemNav, "ordered-by"); // test-provider _testProvider = XPathHelper.GetOptNavValue <Organization>(itemNav, "test-provider"); // laboratory-name _laboratoryName = XPathHelper.GetOptNavValue <Organization>(itemNav, "laboratory-name"); // annotation-version _annotationVersion = XPathHelper.GetOptNavValue(itemNav, "annotation-version"); // dbSNP-build _dbSnpBuild = XPathHelper.GetOptNavValue(itemNav, "dbSNP-build"); // platform _platform = XPathHelper.GetOptNavValue(itemNav, "platform"); }
/// <summary> /// Creates an instance of <see cref="GeneticSnpResults"/> with specified /// parameters. /// </summary> /// /// <param name="when">The date and time of the SNP test.</param> /// /// <param name="genomeBuild">The genome build that defines the SNPs.</param> /// /// <param name="chromosome">The chromosome on which the SNPs are located.</param> /// /// <param name="numberingScheme">The numbering scheme used for positions.</param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/> is <b> null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// If <paramref name="genomeBuild"/> or <paramref name="chromosome" /> /// is <b>null</b> or empty, or <paramref name="numberingScheme"/> is not 0 or 1. /// </exception> /// /// <exception cref="ArgumentOutOfRangeException" > /// The <paramref name="numberingScheme" /> is neither zero based scheme nor one /// based scheme. /// </exception> /// public GeneticSnpResults( ApproximateDateTime when, string genomeBuild, string chromosome, GenomeNumberingScheme numberingScheme) : base(TypeId) { When = when; GenomeBuild = genomeBuild; Chromosome = chromosome; NumberingScheme = numberingScheme; Sections |= ThingSections.BlobPayload; }
/// <summary> /// Populates this <see cref="HealthJournalEntry"/> instance from the data in the specified XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the HealthJournalEntry data from. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a HealthJournalEntry node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { Validator.ThrowIfArgumentNull(typeSpecificXml, nameof(typeSpecificXml), Resources.ParseXmlNavNull); XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("health-journal-entry"); Validator.ThrowInvalidIfNull(itemNav, Resources.HealthJournalEntryUnexpectedNode); _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); _content = itemNav.SelectSingleNode("content").Value; _category = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "category"); }
/// <summary> /// Populates this Person instance from the data in the XML. /// </summary> /// /// <param name="navigator"> /// The XML containing the duration information. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="navigator"/> is not /// a person node. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); // <start-date> _startDate = new ApproximateDateTime(); _startDate.ParseXml(navigator.SelectSingleNode("start-date")); // <end-date> _endDate = XPathHelper.GetOptNavValue <ApproximateDateTime>( navigator, "end-date"); }
/// <summary> /// Populates this <see cref="Exercise"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the exercise data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// an "exercise" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("exercise"); Validator.ThrowInvalidIfNull(itemNav, Resources.ExerciseUnexpectedNode); // when _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // activity _activity = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "activity"); // title _title = XPathHelper.GetOptNavValue(itemNav, "title"); _distance = XPathHelper.GetOptNavValue <Length>(itemNav, "distance"); // duration _duration = XPathHelper.GetOptNavValueAsDouble(itemNav, "duration"); // detail XPathNodeIterator detailsIterator = itemNav.Select("detail"); _details.Clear(); foreach (XPathNavigator detailsNavigator in detailsIterator) { ExerciseDetail exerciseDetail = new ExerciseDetail(); exerciseDetail.ParseXml(detailsNavigator); _details[exerciseDetail.Name.Value] = exerciseDetail; } // segment XPathNodeIterator segmentsIterator = itemNav.Select("segment"); _segments.Clear(); foreach (XPathNavigator segmentsNavigator in segmentsIterator) { ExerciseSegment exerciseSegment = new ExerciseSegment(); exerciseSegment.ParseXml(segmentsNavigator); _segments.Add(exerciseSegment); } }
private static void ValidateDates( ApproximateDateTime startDate, ApproximateDateTime endDate) { if (startDate != null && endDate != null) { if (startDate.ApproximateDate != null && endDate.ApproximateDate != null) { if (startDate.CompareTo(endDate) > 0) { throw new ArgumentException(Resources.CarePlanTaskDateInvalid, nameof(startDate)); } } } }
/// <summary> /// Populates this <see cref="Condition"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the condition data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a condition node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { _name.Clear(); XPathNavigator conditionNav = typeSpecificXml.CreateNavigator().SelectSingleNode("condition"); Validator.ThrowInvalidIfNull(conditionNav, Resources.ConditionUnexpectedNode); _name.ParseXml(conditionNav.SelectSingleNode("name")); XPathNavigator onsetNav = conditionNav.SelectSingleNode("onset-date"); if (onsetNav != null) { _onsetDate = new ApproximateDateTime(); _onsetDate.ParseXml(onsetNav); } XPathNavigator statusNav = conditionNav.SelectSingleNode("status"); if (statusNav != null) { _status = new CodableValue(); _status.ParseXml(statusNav); } XPathNavigator stopDateNav = conditionNav.SelectSingleNode("stop-date"); if (stopDateNav != null) { _stopDate = new ApproximateDateTime(); _stopDate.ParseXml(stopDateNav); } XPathNavigator stopReasonNav = conditionNav.SelectSingleNode("stop-reason"); if (stopReasonNav != null) { _stopReason = stopReasonNav.Value; } }
/// <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")); }
/// <summary> /// Populates this <see cref="BodyDimension"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the body dimension data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a "body-dimension" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("body-dimension"); Validator.ThrowInvalidIfNull(itemNav, Resources.BodyDimensionUnexpectedNode); // when (approxi-date-time, mandatory) _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // measurement-name (codable-value, mandatory) _measurementName = new CodableValue(); _measurementName.ParseXml(itemNav.SelectSingleNode("measurement-name")); // value (Length, mandatory) _value = new Length(); _value.ParseXml(itemNav.SelectSingleNode("value")); }
/// <summary> /// Populates this <see cref="ExerciseSamples"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the exercise samples data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// an "exercise-samples" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("exercise-samples"); Validator.ThrowInvalidIfNull(itemNav, Resources.ExerciseSamplesUnexpectedNode); // when _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // name _name = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "name"); // unit _unit = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "unit"); // sampling interval _samplingInterval = itemNav.SelectSingleNode("sampling-interval").ValueAsDouble; }
/// <summary> /// Populates the data from the specified XML. /// </summary> /// /// <param name="navigator"> /// The XML containing the goal information. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="navigator"/> parameter is <b>null</b>. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); XPathNavigator targetNav = navigator.SelectSingleNode("target-date"); if (targetNav != null) { _targetDate = new ApproximateDateTime(); _targetDate.ParseXml(targetNav); } XPathNavigator completionNav = navigator.SelectSingleNode("completion-date"); if (completionNav != null) { _completionDate = new ApproximateDateTime(); _completionDate.ParseXml(completionNav); } XPathNavigator statusNav = navigator.SelectSingleNode("status"); if (statusNav != null) { try { _status = (GoalStatus)Enum.Parse(typeof(GoalStatus), statusNav.Value, true); } catch (ArgumentException) { _status = GoalStatus.Unknown; _statusString = statusNav.Value; } } }
/// <summary> /// Populates this <see cref="PeakFlow"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the peack flow data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in the <paramref name="typeSpecificXml"/> parameter /// is not a peak-flow node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "peak-flow"); Validator.ThrowInvalidIfNull(itemNav, Resources.PeakFlowUnexpectedNode); _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); _peakExpiratoryFlow = XPathHelper.GetOptNavValue <FlowMeasurement>( itemNav, "pef"); _fev1 = XPathHelper.GetOptNavValue <VolumeMeasurement>( itemNav, "fev1"); _fev6 = XPathHelper.GetOptNavValue <VolumeMeasurement>( itemNav, "fev6"); _measurementFlags.Clear(); XPathNodeIterator measurementFlagsIterator = itemNav.Select("measurement-flags"); foreach (XPathNavigator flagNav in measurementFlagsIterator) { CodableValue flag = new CodableValue(); flag.ParseXml(flagNav); _measurementFlags.Add(flag); } }
/// <summary> /// Creates a new instance of the <see cref="AsthmaInhaler"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="startDate"> /// The approximate date and time when the inhaler use began. /// </param> /// /// <param name="drug"> /// The name of the drug being used in the inhaler. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="startDate"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="drug"/> parameter is <b>null</b>. /// </exception> /// public AsthmaInhaler(ApproximateDateTime startDate, CodableValue drug) : base(TypeId) { StartDate = startDate; Drug = drug; }
/// <summary> /// Creates a new instance of the <see cref="Immunization"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="name"> /// The name of the immunization. /// </param> /// /// <param name="dateAdministrated"> /// The approximate date that the immunization was adminstrated. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="name"/> parameter is <b>null</b>. /// </exception> /// public Immunization(CodableValue name, ApproximateDateTime dateAdministrated) : base(TypeId) { Name = name; DateAdministrated = dateAdministrated; }
/// <summary> /// Populates this <see cref="Directive"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the directive data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node of the <paramref name="typeSpecificXml"/> /// parameter is not a directive node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("directive"); Validator.ThrowInvalidIfNull(itemNav, Resources.DirectiveUnexpectedNode); // <start-date> _startDate = new ApproximateDateTime(); _startDate.ParseXml(itemNav.SelectSingleNode("start-date")); // <stop-date> _stopDate = new ApproximateDateTime(); _stopDate.ParseXml(itemNav.SelectSingleNode("stop-date")); // <description> _description = XPathHelper.GetOptNavValue(itemNav, "description"); // <full-resuscitation> _fullResuscitation = XPathHelper.GetOptNavValueAsBool(itemNav, "full-resuscitation"); // <prohibited-interventions> _prohibitedInterventions = XPathHelper.GetOptNavValue <CodableValue>( itemNav, "prohibited-interventions"); // <additional-instructions> _additionalInstructions = XPathHelper.GetOptNavValue(itemNav, "additional-instructions"); // <attending-physician> _attendingPhysician = XPathHelper.GetOptNavValue <PersonItem>( itemNav, "attending-physician"); // <attending-physician-endorsement> _attendingPhysicianEndorsement = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "attending-physician-endorsement"); // <attending-nurse> _attendingNurse = XPathHelper.GetOptNavValue <PersonItem>( itemNav, "attending-nurse"); // <attending-nurse-endorsement" type="d:date-time"> _attendingNurseEndorsement = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "attending-nurse-endorsement"); // <expiration-date> _expirationDate = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "expiration-date"); // <discontinuation-date> _discontinuationDate = XPathHelper.GetOptNavValue <ApproximateDateTime>( itemNav, "discontinuation-date"); // <discontinuation-physician> _discontinuationPhysician = XPathHelper.GetOptNavValue <PersonItem>( itemNav, "discontinuation-physician"); // <discontinuation-physician-endorsement> _discontinuationPhysicianEndorsement = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "discontinuation-physician-endorsement"); // <discontinuation-nurse> _discontinuationNurse = XPathHelper.GetOptNavValue <PersonItem>( itemNav, "discontinuation-nurse"); // <discontinuation-nurse-endorsement> _discontinuationNurseEndorsement = XPathHelper.GetOptNavValue <HealthServiceDateTime>( itemNav, "discontinuation-nurse-endorsement"); }
/// <summary> /// Populates this <see cref="AsthmaInhaler"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the asthma inhaler data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in the <paramref name="typeSpecificXml"/> /// parameter is not an asthma-inhaler node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator inhalerNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "asthma-inhaler"); Validator.ThrowInvalidIfNull(inhalerNav, Resources.AsthmaInhalerUnexpectedNode); _drug = new CodableValue(); _drug.ParseXml(inhalerNav.SelectSingleNode("drug")); XPathNavigator strengthNav = inhalerNav.SelectSingleNode("strength"); if (strengthNav != null) { _strength = new CodableValue(); _strength.ParseXml(strengthNav); } XPathNavigator purposeNav = inhalerNav.SelectSingleNode("purpose"); if (purposeNav != null) { try { _purpose = (InhalerPurpose)Enum.Parse( typeof(InhalerPurpose), purposeNav.Value, true); } catch (ArgumentException) { _purpose = InhalerPurpose.None; _purposeString = purposeNav.Value; } } _startDate = new ApproximateDateTime(); _startDate.ParseXml(inhalerNav.SelectSingleNode("start-date")); XPathNavigator stopDateNav = inhalerNav.SelectSingleNode("stop-date"); if (stopDateNav != null) { _stopDate = new ApproximateDateTime(); _stopDate.ParseXml(stopDateNav); } XPathNavigator expirationDateNav = inhalerNav.SelectSingleNode("expiration-date"); if (expirationDateNav != null) { _expirationDate = new ApproximateDateTime(); _expirationDate.ParseXml(expirationDateNav); } XPathNavigator deviceIdNav = inhalerNav.SelectSingleNode("device-id"); if (deviceIdNav != null) { _deviceId = deviceIdNav.Value; } XPathNavigator initialDosesNav = inhalerNav.SelectSingleNode("initial-doses"); if (initialDosesNav != null) { _initialDoses = initialDosesNav.ValueAsInt; } XPathNavigator minDosesNav = inhalerNav.SelectSingleNode("min-daily-doses"); if (minDosesNav != null) { _minDailyDoses = minDosesNav.ValueAsInt; } XPathNavigator maxDosesNav = inhalerNav.SelectSingleNode("max-daily-doses"); if (maxDosesNav != null) { _maxDailyDoses = maxDosesNav.ValueAsInt; } XPathNavigator canAlertNav = inhalerNav.SelectSingleNode("can-alert"); if (canAlertNav != null) { _canAlert = canAlertNav.ValueAsBoolean; } XPathNodeIterator alertIterator = inhalerNav.Select("alert"); foreach (XPathNavigator alertNav in alertIterator) { Alert alert = new Alert(); alert.ParseXml(alertNav); _alerts.Add(alert); } }
/// <summary> /// Creates a new instance of the <see cref="Exercise"/> class with /// the specified date/time and activity. /// </summary> /// /// <param name="when"> /// The date/time when the exercise occurred. /// </param> /// <param name="activity"> /// The type of activity. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// <exception cref="ArgumentNullException"> /// The <paramref name="activity"/> parameter is <b>null</b>. /// </exception> /// public Exercise(ApproximateDateTime when, CodableValue activity) : base(TypeId) { When = when; Activity = activity; }
/// <summary> /// Creates a new instance of the <see cref="PeakFlow"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="when"> /// The date and time when the peak flow reading occurred. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public PeakFlow(ApproximateDateTime when) : base(TypeId) { When = when; }
/// <summary> /// Creates a new instance of the <see cref="Goal"/> class with the specified /// target date. /// </summary> /// /// <param name="targetDate"> /// The approximate date which is the target completion date /// for the goal. /// </param> /// public Goal(ApproximateDateTime targetDate) { TargetDate = targetDate; }