Esempio n. 1
0
        public void UpdatePatientObservation_Test()
        {
            List <PatientObservation> po = new List <PatientObservation>();

            po.Add(new PatientObservation {
                DeleteFlag    = true,
                DisplayId     = 1,
                EndDate       = null,
                GroupId       = null,
                Id            = "53e907dcd6a4850bc4f863ba",
                Name          = "GERD",
                ObservationId = "533ed16ed4332307bc592bb8",
                PatientId     = "5325db15d6a4850adcbba82a",
                Source        = "CM",
                Standard      = false,
                StartDate     = DateTime.Now,
                StateId       = 2,
                TypeId        = "533d8278d433231deccaa62d",
                Units         = null,
                Values        = null
            });

            PostUpdateObservationItemsRequest request = new PostUpdateObservationItemsRequest {
                ContractNumber = contract, PatientId = "5325db15d6a4850adcbba82a", UserId = userId, Version = version, Context = "NG", PatientObservations = po
            };

            ObservationsManager oManager = new ObservationsManager();
            PostUpdateObservationItemsResponse response = oManager.SavePatientObservations(request);

            Assert.IsNotNull(response);
        }
Esempio n. 2
0
        public PostUpdateObservationItemsResponse Post(PostUpdateObservationItemsRequest request)
        {
            PostUpdateObservationItemsResponse response = new PostUpdateObservationItemsResponse();
            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.SavePatientObservations(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);
        }