Esempio n. 1
0
        protected void lnkSwitchRecord_Click(object sender, EventArgs e)
        {
            ShellRedirectParameters a = new ShellRedirectParameters();

            a.TargetLocation = "AUTH";
            a.TargetParameters.Add("forceappauth", "true");
            a.TargetParameters.Add("appid", HealthApplicationConfiguration.Current.ApplicationId.ToString());
            WebApplicationUtilities.RedirectToShellUrl(HttpContext.Current, a);
        }
Esempio n. 2
0
 protected void lnkLogin_Click(object sender, EventArgs e)
 {
     if (string.Equals(lnkLogin.Text, "Log-in", StringComparison.OrdinalIgnoreCase))
     {
         WebApplicationUtilities.RedirectToLogOn(HttpContext.Current);
     }
     else
     {
         WebApplicationUtilities.SignOut(HttpContext.Current);
     }
 }
Esempio n. 3
0
        public HttpResponseMessage AddUserHeight([FromBody] HeightModel heightObj)
        {
            Guid app_id = new Guid("d13d9244-8f0c-44e7-8498-682dc9befc23");

            string wctoken = ((string[])(Request.Headers.GetValues("CHbaseToken")))[0];

            PersonInfo personInfo = WebApplicationUtilities.GetPersonInfo(wctoken, app_id);

            HeightHelper.AddRandomHeightEntry(personInfo);

            var message = Request.CreateResponse(HttpStatusCode.OK);

            return(message);
        }
Esempio n. 4
0
        public HttpResponseMessage GetUserHeights()
        {
            string wctoken = ((string[])(Request.Headers.GetValues("CHbaseToken")))[0];

            Guid app_id = new Guid("d13d9244-8f0c-44e7-8498-682dc9befc23");

            PersonInfo personInfo = WebApplicationUtilities.GetPersonInfo(wctoken, app_id);

            List <HeightModel> heightMeasurements = HeightHelper.GetValues <HeightModel>(Height.TypeId, personInfo);

            var message = Request.CreateResponse(HttpStatusCode.OK, heightMeasurements);

            return(message);
        }
Esempio n. 5
0
        private void ContributeCCDAViaRecordAuthorization()
        {
            // Note: Applications can store the HealthVault personID and recordID and use this to make offline requests to store new information
            // in the patient's record whenever new data is available. In this sample, since we don't maintain offline storage (i.e. a DB) to associate
            // the data source organization's patient identifier with the HealthVault person and record ID, we instead sign-in the user to determine the
            // person and record ID everytime a request to send a new CCDA to HealthVault happens (i.e. clicking the "Send CCDA to HealthVault" button);

            PersonInfo pi = WebApplicationUtilities.LoadPersonInfoFromCookie(HttpContext.Current);

            if (pi == null)
            {
                OutputMessage(lblErrorOutput, "Must login first");
                return;
            }

            // Make the offline call to stor the CCDA in the patient's HealthVault record.
            OfflineWebApplicationConnection connection      = new OfflineWebApplicationConnection(pi.PersonId);
            HealthRecordAccessor            receordAccessor = new HealthRecordAccessor(connection, pi.SelectedRecord.Id);

            receordAccessor.NewItem(_newCcdaItem);

            OutputMessage(lblSuccessOutput, "Successfully sent CCDA document to HealthVault via Record Authorization.");
        }
Esempio n. 6
0
 private PersonInfo GetLoggedInPerson()
 {
     return(WebApplicationUtilities.LoadPersonInfoFromCookie(HttpContext.Current));
 }
        public HttpResponseMessage GetUserFormDatasApi(string formName)
        {
            string        accessToken = Request.Headers.Authorization.Parameter;
            FormTypeModel formFields  = FormTypeHelper.GetFormFields(formName);

            if (formFields.FormType.ToLower() == "height")
            {
                string wctoken = ((string[])(Request.Headers.GetValues("CHbaseToken")))[0];

                Guid app_id = new Guid("d13d9244-8f0c-44e7-8498-682dc9befc23");

                PersonInfo personInfo = WebApplicationUtilities.GetPersonInfo(wctoken, app_id);

                List <HeightModel> heightMeasurements = HeightHelper.GetValues <HeightModel>(Height.TypeId, personInfo);

                List <FormDataModel> formDatas = new List <FormDataModel>();



                int i = 1000;

                foreach (HeightModel heightMeasurement in heightMeasurements)
                {
                    FormDataModel         formdata = new FormDataModel();
                    List <DataValueModel> datas    = new List <DataValueModel>();
                    DataValueModel        data1    = new DataValueModel();
                    DataValueModel        data2    = new DataValueModel();
                    data1.Name  = "Meters";
                    data1.Value = heightMeasurement.Meters.ToString();
                    datas.Add(data1);
                    data2.Name  = "When";
                    data2.Value = heightMeasurement.When.ToString();
                    datas.Add(data2);
                    formdata.FormId   = i;
                    formdata.FormName = formFields.FormName;
                    formdata.FormType = formFields.FormType;
                    formdata.FormData = datas;

                    formDatas.Add(formdata);
                    i += 1;
                }

                var message = Request.CreateResponse(HttpStatusCode.OK, formDatas);

                return(message);
            }

            else
            {
                UserObjectModel userObj = TokenHelper.getUserByAccessToken(accessToken);
                if (userObj != null)
                {
                    List <FormDataModel> dataList = UserSpecificFormsHelper.GetUserFormDataList(userObj.UserId, formName);
                    var message = Request.CreateResponse(HttpStatusCode.OK, dataList);
                    return(message);
                }
                else
                {
                    throw new Exception("Invalid User");
                }
            }
        }