Ejemplo n.º 1
0
        public void SetPrimaryPatientSystemTest()
        {
            var psm = new PatientSystemManager {
                EndpointUtil = new StubPatientSystemEndpointUtil()
            };

            psm.SetPrimaryPatientSystem(_context, _patientId, (List <DTO.PatientSystem>)_context.Tag);
            Assert.IsTrue(true);
        }
Ejemplo n.º 2
0
        public GetPatientSystemsResponse Get(GetPatientSystemsRequest request)
        {
            GetPatientSystemsResponse response = new GetPatientSystemsResponse();
            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;
                    response.PatientSystems = PatientSystemManager.GetPatientSystems(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)
                {
                    List <string> patientIds = null;
                    if (response.PatientSystems != null)
                    {
                        patientIds = response.PatientSystems.Select(x => x.PatientId).ToList();
                    }
                    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);
        }
Ejemplo n.º 3
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);
        }