示例#1
0
        public void GetAllPatientGoal_Test()
        {
            GetAllPatientGoalsRequest request = new GetAllPatientGoalsRequest();

            request.ContractNumber = "InHealth001";
            request.UserId         = "531f2df5072ef727c4d2a3bc";
            request.Version        = 1;
            request.PatientId      = "543c2e6b84ac050980224c50";

            GoalsManager gManager = new GoalsManager();
            GetAllPatientGoalsResponse response = gManager.GetAllPatientGoals(request);

            Assert.IsNotNull(response);
        }
示例#2
0
        public GetAllPatientGoalsResponse Get(GetAllPatientGoalsRequest request)
        {
            GetAllPatientGoalsResponse response = new GetAllPatientGoalsResponse();
            GoalsManager          gm            = new GoalsManager();
            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       = gm.GetAllPatientGoals(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    gm.LogException(ex);
                }
            }
            finally
            {
                List <string> patientIds = null;

                if (response.Goals != null)
                {
                    patientIds = response.Goals.Select(x => x.PatientId).ToList();
                }

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