Пример #1
0
        public void UpdateCareMember_Test()
        {
            CareMember cm = new CareMember
            {
                Id        = "5310d3eed6a4850e046e10ed",
                PatientId = "52f55895072ef709f84e7551",
                ContactId = "530fcad1d4332320e0336a6a",
                Primary   = true,
                TypeId    = "530cd576d433231ed4ba969c"
            };

            PostUpdateCareMemberRequest request = new PostUpdateCareMemberRequest();

            request.ContractNumber = "InHealth001";
            request.UserId         = "AD_TestHarness";
            request.Version        = 1;
            request.PatientId      = "52f55895072ef709f84e7551";
            request.Token          = "5310a9bdd6a4850e0477cade";
            request.CareMember     = cm;

            CareMembersManager           nManager = new CareMembersManager();
            PostUpdateCareMemberResponse response = nManager.UpdateCareMember(request);

            Assert.IsNotNull(response);
        }
Пример #2
0
        public PostUpdateCareMemberResponse UpdateCareMember(PostUpdateCareMemberRequest request)
        {
            try
            {
                if (request.CareMember == null)
                {
                    throw new Exception("The CareMember property cannot be null in the request.");
                }

                PostUpdateCareMemberResponse response = new PostUpdateCareMemberResponse();
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/CareMember/Update", "PUT")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/CareMember/Update",
                                                                          DDCareMemberUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId), request.UserId);

                CareMemberData cmData = new CareMemberData
                {
                    Id        = request.CareMember.Id,
                    PatientId = request.CareMember.PatientId,
                    ContactId = request.CareMember.ContactId,
                    TypeId    = request.CareMember.TypeId,
                    Primary   = request.CareMember.Primary
                };
                PutUpdateCareMemberDataResponse dataDomainResponse =
                    client.Put <PutUpdateCareMemberDataResponse>(url, new PutUpdateCareMemberDataRequest
                {
                    CareMember     = cmData,
                    Context        = "NG",
                    ContractNumber = request.ContractNumber,
                    Version        = request.Version,
                    UserId         = request.UserId,
                    PatientId      = request.PatientId
                } as object);
                if (dataDomainResponse != null && dataDomainResponse.Updated)
                {
                    response.Version = dataDomainResponse.Version;

                    if (request.CareMember.Primary)
                    {
                        //Upsert the PrimaryCare Manager's ContactId in the CohortPatientView collection.
                        upsertCohortPatientView(request.PatientId, request.CareMember.ContactId, response.Version, request.ContractNumber, request.UserId);
                    }
                }
                return(response);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:UpdateCareMember()::" + ex.Message, ex.InnerException);
            }
        }