public void GetPatientActionDetailsTest() { string url = "http://localhost:8888/Program"; string contractNumber = "InHealth001"; string context = "NG"; double version = 1.0; string userId = "000000000000000000000000"; IRestClient client = new JsonServiceClient(); GetPatientActionDetailsDataRequest request = new GetPatientActionDetailsDataRequest { PatientId = "5325d9f2d6a4850adcbba4ca", PatientProgramId = "534c4fb2d6a48504b053346f", PatientModuleId = "534c4fb2d6a48504b05335c2", PatientActionId = "534c4fb2d6a48504b05335c3", UserId = userId }; // [Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Program/{PatientProgramId}/Module/{PatientModuleId}/Action/{PatientActionId}", "GET")] GetPatientActionDetailsDataResponse response = client.Get <GetPatientActionDetailsDataResponse>( string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Program/{5}/Module/{6}/Action/{7}?UserId={8}", url, context, version, contractNumber, request.PatientId, request.PatientProgramId, request.PatientModuleId, request.PatientActionId, request.UserId)); Assert.IsNotNull(response); }
public void GetPatientActionDetailsTest() { string userId = "000000000000000000000000"; GetPatientActionDetailsDataRequest request = new GetPatientActionDetailsDataRequest { PatientId = "5325da17d6a4850adcbba532", PatientProgramId = "535a90dbd6a485044cb7d90e", PatientModuleId = "535a90dbd6a485044cb7dac7", PatientActionId = "535a90dbd6a485044cb7dc24", UserId = userId }; ProgramDataManager pm = new ProgramDataManager(); GetPatientActionDetailsDataResponse response = pm.GetActionDetails(request); Assert.IsNotNull(response); }
public GetPatientActionDetailsDataResponse GetActionDetails(GetPatientActionDetailsDataRequest request) { try { GetPatientActionDetailsDataResponse response = new GetPatientActionDetailsDataResponse(); IProgramRepository repo = Factory.GetRepository(request, RepositoryType.PatientProgram);//.GetPatientProgramRepository(request); MEPatientProgram mepp = repo.FindByID(request.PatientProgramId) as MEPatientProgram; IProgramRepository respRepo = Factory.GetRepository(request, RepositoryType.PatientProgramResponse); var stepIds = mepp.Modules.SelectMany(m => m.Actions.SelectMany(a => a.Steps.Select(s => s.Id))).ToList(); DTOUtility.ResponsesBag = respRepo.Find(stepIds).Cast <MEPatientProgramResponse>().ToList(); Module meModule = mepp.Modules.Where(m => m.Id == ObjectId.Parse(request.PatientModuleId)).FirstOrDefault(); if (meModule != null) { MongoDB.DTO.Action meAction = meModule.Actions.Where(a => a.Id == ObjectId.Parse(request.PatientActionId)).FirstOrDefault(); if (meAction != null) { List <Module> tMods = DTOUtility.GetTemplateModulesList(mepp.SourceId.ToString(), request.ContractNumber, request.UserId); Module tmodule = tMods.Find(tm => tm.SourceId == meModule.SourceId); if (tmodule != null) { meAction.Objectives = DTOUtility.GetTemplateObjectives(meAction.SourceId, tmodule); } response.ActionData = DTOUtility.GetAction(request.ContractNumber, request.UserId, meAction); } } return(response); } catch (Exception ex) { DTOUtility.ResponsesBag = null; throw new Exception("DD:DataProgramManager:GetActionDetails()::" + ex.Message, ex.InnerException); } finally { DTOUtility.ResponsesBag = null; } }
public GetPatientActionDetailsDataResponse Get(GetPatientActionDetailsDataRequest request) { GetPatientActionDetailsDataResponse response = new GetPatientActionDetailsDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ProgramDD:Get()::Unauthorized Access"); } response = ProgramDataManager.GetActionDetails(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); }