/// <summary> /// Constructs a <see cref="HealthRecordItemRelationship" /> instance for a relationship /// to the item with the specified ID. /// </summary> /// /// <param name="itemId"> /// The unique identifier of the health record item to related to. /// </param> /// /// <exception cref="ArgumentException"> /// If <paramref name="itemId"/> is <see cref="System.Guid.Empty"/>. /// </exception> /// public HealthRecordItemRelationship(Guid itemId) { Validator.ThrowArgumentExceptionIf( itemId == Guid.Empty, "itemId", "RelationshipItemIDNotSpecified"); _itemKey = new HealthRecordItemKey(itemId); }
/// <summary> /// Constructs a <see cref="HealthRecordItemRelationship" /> instance for a relationship /// to the item with the specified key. /// </summary> /// /// <param name="itemKey"> /// The unique key of the health record item to related to, including the item ID and /// optionally the item version stamp. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="itemKey"/> is <b>null</b>. /// </exception> /// public HealthRecordItemRelationship(HealthRecordItemKey itemKey) { Validator.ThrowIfArgumentNull(itemKey, "itemKey", "RelationshipItemKeyNotSpecified"); _itemKey = itemKey; }
internal void ParseXml(XPathNavigator relationshipNav) { XPathNavigator thingIdNav = relationshipNav.SelectSingleNode("thing-id"); if (thingIdNav != null) { Guid itemId = new Guid(thingIdNav.Value); XPathNavigator versionStampNav = relationshipNav.SelectSingleNode("version-stamp"); if (versionStampNav != null) { Guid versionStamp = new Guid(versionStampNav.Value); _itemKey = new HealthRecordItemKey(itemId, versionStamp); } else { _itemKey = new HealthRecordItemKey(itemId); } } else { XPathNavigator clientIdNav = relationshipNav.SelectSingleNode("client-thing-id"); if (clientIdNav != null) { _clientId = clientIdNav.Value; } } _relationshipType = XPathHelper.GetOptNavValue(relationshipNav, "relationship-type"); }
/// <summary> /// Constructs a <see cref="HealthRecordItemRelationship" /> instance for a relationship /// to the item with the specified key and relationship type. /// </summary> /// /// <param name="itemKey"> /// The unique key of the health record item to related to, including the item ID and /// optionally the item version stamp. /// </param> /// /// <param name="relationshipType"> /// The application defined type for the relationship. This is usually a descriptive tagging /// for the relationship. For example, a Annotation item may have a /// "annotation" relationship with a Problem item. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="itemKey"/> is <b>null</b>. /// </exception> /// public HealthRecordItemRelationship(HealthRecordItemKey itemKey, string relationshipType) : this(itemKey) { _relationshipType = relationshipType; }
/// /// <summary> /// Marks the specified health record item as deleted. /// </summary> /// /// <param name="itemId"> /// The unique item identifier to remove. /// </param> /// /// <remarks> /// This method accesses the HealthVault service across the network. /// <br/><br/> /// Health record items are never completely deleted. They are marked /// as deleted and are ignored for most normal operations. Items can /// be undeleted by contacting customer service. /// </remarks> /// /// <exception cref="ArgumentException"> /// The <paramref name="itemId"/> parameter is Guid.Empty. /// </exception> /// /// <exception cref="HealthServiceException"> /// Errors removed the health record items from the server. /// </exception> /// public void RemoveItem(HealthRecordItemKey itemId) { Validator.ThrowIfArgumentNull(itemId, "itemId", "RemoveItemNull"); RemoveItems(new HealthRecordItemKey[] { itemId }); }
private void AddPartialThingRow(HealthRecordItemKey key) { DataRow row = this.NewRow(); foreach (DataColumn column in this.Columns) { switch (column.ColumnName) { case "wc-id" : row[column.Ordinal] = key.Id.ToString(); break; case "wc-version" : row[column.Ordinal] = key.VersionStamp.ToString(); break; default : row[column.Ordinal] = ItemTypeDataColumn.GetNotPresentValue(column.DataType); break; } } this.Rows.Add(row); }
private static List<HealthRecordItemKey> GetPartialThingKeys( XPathNavigator nav) { List<HealthRecordItemKey> partialThingKeys = new List<HealthRecordItemKey>(); XPathNodeIterator partialThingIterator = nav.Select("//unprocessed-thing-key-info/thing-id"); foreach (XPathNavigator partialThingNav in partialThingIterator) { string versionStamp = partialThingNav.GetAttribute( "version-stamp", String.Empty); HealthRecordItemKey key = new HealthRecordItemKey( new Guid(partialThingNav.Value), new Guid(versionStamp)); partialThingKeys.Add(key); } return partialThingKeys; }
// // GET: /JournalEntry/Delete/5 public ActionResult Delete(string id) { // create the item key var t = id.Split(','); var key = new HealthRecordItemKey(Guid.Parse(t[0]), Guid.Parse(t[1])); // get the user var hvUser = (User as HVPrincipal); if (hvUser != null) { // get the auth token var authToken = hvUser.AuthToken; // create the appropriate objects for health vault var appId = HealthApplicationConfiguration.Current.ApplicationId; WebApplicationCredential cred = new WebApplicationCredential( appId, authToken, HealthApplicationConfiguration.Current.ApplicationCertificate); // setup the user WebApplicationConnection connection = new WebApplicationConnection(appId, cred); PersonInfo personInfo = null; personInfo = HealthVaultPlatform.GetPersonInfo(connection); // delete the record personInfo.SelectedRecord.RemoveItem(key); } // redirect return RedirectToAction("Index"); }