Beispiel #1
0
        public void GetInterventions_Test()
        {
            GetInterventionsRequest request = new GetInterventionsRequest();

            request.ContractNumber = "InHealth001";
            request.Version        = 1;
            // request.AssignedToId = "5325c821072ef705080d3488";
            // request.CreatedById = "5325c821072ef705080d3488";
            request.StatusIds = new List <int> {
                1, 2, 3
            };
            request.PatientId = "5481dbbd231e250160a0e9d1";
            request.UserId    = "531f2df5072ef727c4d2a3bc";

            GoalsManager             gManager = new GoalsManager();
            GetInterventionsResponse response = gManager.GetInterventions(request);

            Assert.IsNotNull(response);
        }
Beispiel #2
0
        public GetInterventionsResponse Post(GetInterventionsRequest request)
        {
            GetInterventionsResponse response = new GetInterventionsResponse();
            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.GetInterventions(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    gm.LogException(ex);
                }
            }
            finally
            {
                if (result != null)
                {
                    AuditHelper.LogAuditData(request, result.SQLUserId, null, System.Web.HttpContext.Current.Request, request.GetType().Name);
                }
            }
            return(response);
        }