internal static HealthRecordView CreateFromXml(XPathNavigator nav) { HealthRecordView view = new HealthRecordView(); XPathNodeIterator sectionsIterator = nav.Select("section"); foreach (XPathNavigator sectionNav in sectionsIterator) { switch (sectionNav.Value) { case "core": view.Sections |= HealthRecordItemSections.Core; break; case "audits": view.Sections |= HealthRecordItemSections.Audits; break; case "blobpayload": view.Sections |= HealthRecordItemSections.BlobPayload; break; case "effectivepermissions": view.Sections |= HealthRecordItemSections.EffectivePermissions; break; case "tags": view.Sections |= HealthRecordItemSections.Tags; break; case "digitalsignatures": view.Sections |= HealthRecordItemSections.Signature; break; } } XPathNodeIterator xmlTransformsIterator = nav.Select("xml"); foreach (XPathNavigator xmlTransformNav in xmlTransformsIterator) { string transformName = xmlTransformNav.Value; if (transformName.Length == 0) { view.Sections |= HealthRecordItemSections.Xml; } else { view.TransformsToApply.Add(transformName); } } XPathNodeIterator typeFormatIterator = nav.Select("type-version-format"); foreach (XPathNavigator typeFormatNav in typeFormatIterator) { Guid typeFormat = new Guid(typeFormatNav.Value); view.TypeVersionFormat.Add(typeFormat); } return view; }
/// <summary> /// Gets the health record items related to this record filtered on the /// specified type. /// </summary> /// /// <param name="typeId"> /// A unique identifier for the type of health record item to filter /// on. /// </param> /// /// <param name="view"> /// The view to use when retrieving the data. /// </param> /// /// <returns> /// A collection of the health record items related to this record /// that match the specified type identifier. /// </returns> /// /// <remarks> /// This method accesses the HealthVault service across the network. /// </remarks> /// /// <exception cref="HealthServiceException"> /// The HealthVault service returned an error. /// </exception> /// public HealthRecordItemCollection GetItemsByType( Guid typeId, HealthRecordView view) { HealthRecordSearcher searcher = CreateSearcher(typeId); searcher.Filters[0].View = view; ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems(); // Since we only applied a single filter we should // only have a single group return results[0]; }