Exemplo n.º 1
0
        public void DeletePatientSystems_Test()
        {
            DeletePatientSystemsRequest request = new DeletePatientSystemsRequest
            {
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                Token          = token,
                PatientId      = "5325da9ed6a4850adcbba6ce",
                Ids            = "55a038f7d43325251c8fbdb8,55a038f8d43325251c8fbdbf"
            };

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

            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}PatientSystems/{Ids}", "DELETE")]
            DeletePatientSystemsResponse response = client.Delete <DeletePatientSystemsResponse>(string.Format("{0}/{1}/{2}/Patient/{3}/PatientSystems/{4}", url, version, contractNumber, request.PatientId, request.Ids));

            Assert.IsNotNull(response);
        }
Exemplo n.º 2
0
        public DeletePatientSystemsResponse Delete(DeletePatientSystemsRequest request)
        {
            DeletePatientSystemsResponse response = new DeletePatientSystemsResponse();
            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)
                {
                    request.UserId = result.UserId;
                    PatientSystemManager.DeletePatientSystems(request);
                }
                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);
        }