Ejemplo n.º 1
0
        public void UpdatePatientSystems_Test()
        {
            List <DTO.PatientSystem> list = new List <DTO.PatientSystem>();

            list.Add(new DTO.PatientSystem {
                Id = "55a82b5ad433263860362072", PatientId = "5325dacad6a4850adcbba756", Value = " aaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccdddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffgggggggggggggggggghhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkllllllllllllllllllllllllllnnnnnnnnnnnnnnnnnnnmmmmmmmmmmmmmmmmmmmmmmm ", StatusId = 2, Primary = false, SystemId = "559e8c70d4332320bc076f4e", DataSource = "Engage_Up"
            });
            list.Add(new DTO.PatientSystem {
                Id = "55a82b6ad43326386036207a", PatientId = "5325dacad6a4850adcbba756", Value = " zGHGEGGH  ", StatusId = 2, Primary = false, DataSource = "Import_Up", SystemId = "559e8c70d4332320bc076f4d"
            });

            UpdatePatientSystemsRequest request = new UpdatePatientSystemsRequest
            {
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                Token          = token,
                PatientId      = "5325dacad6a4850adcbba756",
                PatientSystems = list
            };

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "Token", token));

            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}PatientSystems", "PUT")]
            UpdatePatientSystemsResponse response = client.Put <UpdatePatientSystemsResponse>(string.Format("{0}/{1}/{2}/Patient/{3}/PatientSystems", url, version, contractNumber, request.PatientId), request  as object);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 2
0
        public void PutTest()
        {
            UpdatePatientSystemsRequest request = new UpdatePatientSystemsRequest
            {
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                Token          = token,
                PatientId      = patientId,
                PatientSystems =
                    new List <DTO.PatientSystem>()
                {
                    new DTO.PatientSystem
                    {
                        Id        = ObjectId.GenerateNewId().ToString(),
                        PatientId = patientId,
                        Primary   = true
                    },
                    new DTO.PatientSystem
                    {
                        Id        = ObjectId.GenerateNewId().ToString(),
                        PatientId = patientId,
                        Primary   = true
                    },
                    new DTO.PatientSystem
                    {
                        Id        = ObjectId.GenerateNewId().ToString(),
                        PatientId = patientId,
                        Primary   = false
                    }
                }
            };

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "Token", token));

            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}/PatientSystems", "PUT")]
            UpdatePatientSystemsResponse response =
                client.Put <UpdatePatientSystemsResponse>(
                    string.Format("{0}/{1}/{2}/Patient/{3}/PatientSystems", url, version, contractNumber, patientId),
                    request);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 3
0
        public UpdatePatientSystemsResponse Put(UpdatePatientSystemsRequest request)
        {
            UpdatePatientSystemsResponse response = new UpdatePatientSystemsResponse();
            ValidateTokenResponse        result   = null;

            try
            {
                if (base.Request != null)
                {
                    request.Token = base.Request.Headers["Token"] as string;
                }
                result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber);
                if (result.UserId.Trim() != string.Empty)
                {
                    ServiceContext.UserId   = result.UserId;
                    ServiceContext.Tag      = request.PatientSystems;
                    response.PatientSystems = PatientSystemManager.UpdatePatientSystems(ServiceContext, request.PatientId);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    PatientSystemManager.LogException(ex);
                }
            }
            finally
            {
                if (result != null)
                {
                    string browser     = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType;
                    string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress;
                    AuditUtil.LogAuditData(request, result.SQLUserId, null, browser, hostAddress, request.GetType().Name);
                }
            }
            return(response);
        }