protected void btnSubmit_Click(object sender, EventArgs e) { OfflineWebApplicationConnection conn = HVConnectionManager.CreateConnection(selectedParticipant.HVPersonID); HealthRecordAccessor accessor = new HealthRecordAccessor(conn, selectedParticipant.HVRecordID); double weight = 300.0; Weight w = new Weight( new HealthServiceDateTime(DateTime.Now), new WeightValue(weight * 1.6, new DisplayValue(weight, "lbs", "lbs"))); accessor.NewItem(w); //CodableValue allergyCV = new CodableValue("Allergy"); //Allergy allergy = new Allergy(allergyCV); //allergy. //allergy.Name = "Cats"; //allergy.Reaction = "Itchy Eyes"; //accessor.NewItem(allergy); }
protected override void ProcessRecord() { HealthClientApplication clientApp = HvShellUtilities.GetClient(); List<PersonInfo> authorizedPeople = new List<PersonInfo> (clientApp.ApplicationConnection.GetAuthorizedPeople()); // Create an authorized connection for each person on the // list. HealthClientAuthorizedConnection authConnection = clientApp.CreateAuthorizedConnection( authorizedPeople[0].PersonId); // Use the authorized connection to read the user's default // health record. HealthRecordAccessor access = new HealthRecordAccessor( authConnection, authConnection.GetPersonInfo().GetSelfRecord().Id); Weight weight = new Weight(); weight.Value = new WeightValue(Value / 2.2, new DisplayValue(Value, "pounds")); access.NewItem(weight); }