Exemplo n.º 1
0
        public DeletePatientMedSuppResponse Delete(DeletePatientMedSuppRequest request)
        {
            DeletePatientMedSuppResponse response = new DeletePatientMedSuppResponse();
            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;
                    MedicationManager.DeletePatientMedSupp(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    MedicationManager.LogException(ex);
                }
            }
            finally
            {
                List <string> patientIds = null;
                if (request.PatientId != null)
                {
                    patientIds = new List <string>();
                    patientIds.Add(request.PatientId);
                }
                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, patientIds, browser, hostAddress, request.GetType().Name);
                }
            }
            return(response);
        }
Exemplo n.º 2
0
        public void DeletePatientMedSupp_Test()
        {
            DeletePatientAllergyRequest request = new DeletePatientAllergyRequest
            {
                ContractNumber = contractNumber,
                Id             = "54ef51a984ac0711a867cd43",
                PatientId      = "5325db24d6a4850adcbba85a",
                UserId         = userId,
                Version        = version
            };

            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}/PatientMedSupp/{Id}", "DELETE")]
            DeletePatientMedSuppResponse response = client.Delete <DeletePatientMedSuppResponse>(
                string.Format("{0}/{1}/{2}/Patient/{3}/PatientMedSupp/{4}?UserId={5}", url, version, contractNumber, request.PatientId, request.Id, request.UserId));

            Assert.IsNotNull(response);
        }