Example #1
0
        public void Find_Response_Test()
        {
            string url            = "http://localhost:8888/Program";
            string contractNumber = "InHealth001";
            string context        = "NG";
            double version        = 1.0;
            string stepId         = "52ed9eaffe7a5921b4880cd4";
            string userId         = "bb241c64-a0ff-4e01-ba5f-4246ef50780e";
            string responseId     = "52ede291fe7a590728e1a382";

            IRestClient client = new JsonServiceClient();

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "531f2df9072ef727c4d2a3df"));

            GetStepResponseResponse resp =
                client.Get <GetStepResponseResponse>(
                    string.Format("{0}/{1}/{2}/{3}/Program/Module/Action/Step/{4}/Response/?ResponseId={5}",
                                  url,
                                  context,
                                  version,
                                  contractNumber,
                                  stepId,
                                  responseId));
        }
Example #2
0
        public GetStepResponseResponse GetStepResponse(GetStepResponseRequest request)
        {
            try
            {
                GetStepResponseResponse response = new GetStepResponseResponse();

                IProgramRepository repo = Factory.GetRepository(request, RepositoryType.PatientProgramResponse); //.GetPatientProgramStepResponseRepository(request);

                MEPatientProgramResponse result = repo.FindByID(request.ResponseId) as MEPatientProgramResponse;

                if (result != null)
                {
                    response.StepResponse = new StepResponse
                    {
                        Id         = result.Id.ToString(),
                        NextStepId = result.NextStepId.ToString(),
                        Nominal    = result.Nominal,
                        Order      = result.Order,
                        Required   = result.Required,
                        Spawn      = DTOUtils.GetResponseSpawnElement(result.Spawn),
                        StepId     = result.StepId.ToString(),
                        Text       = result.Text,
                        Value      = result.Value
                    };
                }

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:GetStepResponse()::" + ex.Message, ex.InnerException);
            }
        }
Example #3
0
        public GetStepResponseResponse Get(GetStepResponseRequest request)
        {
            GetStepResponseResponse response = new GetStepResponseResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ProgramDD:Get()::Unauthorized Access");
                }

                response         = ProgramDataManager.GetStepResponse(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Helpers.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }