public CareMember GetCareMember(GetCareMemberRequest request)
        {
            try
            {
                CareMember result = null;
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/CareMember/{Id}", "GET")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/CareMember/{5}",
                                                                          DDCareMemberUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId,
                                                                          request.Id), request.UserId);

                GetCareMemberDataResponse ddResponse = client.Get <GetCareMemberDataResponse>(url);

                if (ddResponse != null && ddResponse.CareMember != null)
                {
                    CareMemberData n          = ddResponse.CareMember;
                    List <string>  contactIds = new List <string>();
                    contactIds.Add(n.ContactId);
                    List <ContactData> contactsData = getContactDetails(contactIds, request.Version, request.ContractNumber, request.UserId);
                    string             pfName       = string.Empty;
                    string             gender       = string.Empty;
                    var contact = contactsData.Find(a => a.Id == n.ContactId);
                    if (contact != null)
                    {
                        pfName = contact.PreferredName;
                        gender = contact.Gender;
                    }
                    result = new CareMember
                    {
                        Id            = n.Id,
                        PatientId     = n.PatientId,
                        ContactId     = n.ContactId,
                        PreferredName = pfName,
                        Gender        = gender,
                        Primary       = n.Primary,
                        TypeId        = n.TypeId
                    };
                }
                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:GetCareMember()::" + ex.Message, ex.InnerException);
            }
        }
Exemple #2
0
        public void GetCareMember_Test()
        {
            GetCareMemberRequest request = new GetCareMemberRequest();

            request.ContractNumber = "InHealth001";
            request.UserId         = "AD_TestHarness";
            request.Version        = 1;
            request.Id             = "530d0fb7d433232bd830c520";
            request.PatientId      = "52f55899072ef709f84e7637";
            request.UserId         = "Snehal";

            CareMembersManager gManager = new CareMembersManager();
            CareMember         response = gManager.GetCareMember(request);

            Assert.IsNotNull(response);
        }