/// <summary> /// Validates this MeasurementInformation /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages to date, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (HeadCircumference == null && BodyHeight == null && BodyMassIndex == null && BodyWeight == null) { vb.AddValidationMessage("MeasurementInformation", null, "Please provide an entry for MeasurementInformation"); } if (HeadCircumference != null) { HeadCircumference.Validate(path, messages); } if (BodyHeight != null) { BodyHeight.Validate(path, messages); } if (BodyMassIndex != null) { BodyMassIndex.Validate(path, messages); } if (BodyWeight != null) { BodyWeight.Validate(path, messages); } }
/// <summary> /// Validates this PhysicalMeasurementBodyMassIndex item /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages to date, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (vb.ArgumentRequiredCheck("BodyMassIndex", BodyMassIndex)) { BodyMassIndex.Validate(vb.Path + "BodyMassIndex", vb.Messages); } if (BodyMassIndexReferenceRangeDetails != null) { for (var x = 0; x < BodyMassIndexReferenceRangeDetails.Count; x++) { BodyMassIndexReferenceRangeDetails[x].Validate(vb.Path + string.Format("BodyMassIndexReferenceRangeDetails[{0}]", x), vb.Messages); } } if (Method != null) { Method.Validate(vb.Path + "Method", vb.Messages); } if (InformationProvider != null) { if (InformationProvider is Device) { var device = InformationProvider as Device; device.Validate(vb.Path + "Device", vb.Messages); } // Both types are of type Participation so use the Participant to determin the type if (InformationProvider is Participation) { var informationProviderHealthcareProvider = InformationProvider as IParticipationInformationProviderHealthcareProvider; if (informationProviderHealthcareProvider.Participant != null) { informationProviderHealthcareProvider.Validate(vb.Path + "IParticipationInformationProviderHealthcareProvider", vb.Messages); } var informationProviderNonHealthcareProvider = InformationProvider as IParticipationInformationProviderNonHealthcareProvider; if (informationProviderNonHealthcareProvider.Participant != null) { informationProviderNonHealthcareProvider.Validate(vb.Path + "IParticipationInformationProviderNonHealthcareProvider", vb.Messages); } } } vb.ArgumentRequiredCheck("BodyMassIndexDateTime", BodyMassIndexDateTime); if (vb.ArgumentRequiredCheck("BodyMassIndexInstanceIdentifier", BodyMassIndexInstanceIdentifier)) { BodyMassIndexInstanceIdentifier.Validate(vb.Path + "BodyMassIndexInstanceIdentifier", vb.Messages); } }
/// <summary> /// Validates this MeasurementEntry /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages to date, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (DocumentLink != null) { if (DocumentLink != null) { DocumentLink.Validate(path, messages); } } if (BodyHeightMeasure != null) { BodyHeightMeasure.Validate(path, messages); } if (BodyWeightMeasure != null) { BodyWeightMeasure.Validate(path, messages); } if (HeadCircumferenceMeasure != null) { HeadCircumferenceMeasure.Validate(path, messages); } if (BodyMassIndex != null) { BodyMassIndex.Validate(path, messages); } //if (BodyHeightMeasure == null && BodyWeightMeasure == null && HeadCircumferenceMeasure == null && BodyMassIndex == null) //{ // vb.AddValidationMessage("Measurement component", null, "Please provide one of the following BodyHeightMeasure or BodyWeightMeasure or HeadCircumferenceMeasure or BodyMassIndex"); //} if (BodyMassIndex != null) { BodyMassIndex.Validate(path, messages); } vb.ArgumentRequiredCheck("ObservationDate", ObservationDate); }