Esempio n. 1
0
        public void GetCurrentPatientObservation_Test()
        {
            GetCurrentPatientObservationsRequest request = new GetCurrentPatientObservationsRequest {
                ContractNumber = contract, PatientId = "5323762f231e250d5c0c62a7", UserId = userId, Version = version
            };

            ObservationsManager oManager = new ObservationsManager();
            GetCurrentPatientObservationsResponse response = oManager.GetCurrentPatientObservations(request);

            Assert.IsNotNull(response);
        }
Esempio n. 2
0
        public GetCurrentPatientObservationsResponse Get(GetCurrentPatientObservationsRequest request)
        {
            GetCurrentPatientObservationsResponse response = new GetCurrentPatientObservationsResponse();
            ObservationsManager   om     = new ObservationsManager();
            ValidateTokenResponse result = null;

            try
            {
                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;
                    response       = om.GetCurrentPatientObservations(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    om.LogException(ex);
                }
            }
            finally
            {
                List <string> patientIds = new List <string>();
                patientIds.Add(request.PatientId);

                if (result != null)
                {
                    AuditHelper.LogAuditData(request, result.SQLUserId, patientIds, System.Web.HttpContext.Current.Request, request.GetType().Name);
                }
            }
            return(response);
        }