public GetPatientProgramsDataResponse GetPatientPrograms(GetPatientProgramsDataRequest request) { try { var response = new GetPatientProgramsDataResponse(); var repo = Factory.GetRepository(request, RepositoryType.PatientProgram); var patientPrograms = repo.FindByPatientId(request.PatientId).Cast <MEPatientProgram>().ToList(); if (patientPrograms != null) { var lpi = new List <ProgramInfo>(); patientPrograms.ForEach(pd => lpi.Add(new ProgramInfo { Id = Convert.ToString(pd.Id), Name = pd.Name, PatientId = Convert.ToString(pd.PatientId), ProgramSourceId = (pd.SourceId == null) ? null : pd.SourceId.ToString(), ShortName = pd.ShortName, Status = (int)pd.Status, ElementState = (int)pd.State, AttrEndDate = pd.AttributeEndDate, StateUpdatedOnDate = pd.StateUpdatedOn, AssignedOnDate = pd.AssignedOn }) ); response.programs = lpi; } return(response); } catch (Exception ex) { throw new Exception("DD:DataProgramManager:GetPatientPrograms()::" + ex.Message, ex.InnerException); } }
public void Get_ContractProgram() { MongoContractProgramRepository cRepo = new MongoContractProgramRepository("InHealth001"); ProgramRepositoryFactory factory = new ProgramRepositoryFactory(); GetPatientProgramsDataRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "NGUser" }; IProgramRepository repo = factory.GetRepository(request, RepositoryType.ContractProgram); Assert.AreEqual(cRepo.GetType(), repo.GetType()); }
public void Processing_Time_Test() { Stopwatch st = new Stopwatch(); st.Start(); ProgramDataManager dm = new ProgramDataManager { Factory = new ProgramRepositoryFactory() }; IDataDomainRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "user" }; //MEProgram p = dm.getLimitedProgramDetails("5330920da38116ac180009d2", request); st.Stop(); int seconds = st.Elapsed.Milliseconds; }
public void Processing_Time_Test() { Stopwatch st = new Stopwatch(); st.Start(); ProgramDataManager dm = new ProgramDataManager { Factory = new ProgramRepositoryFactory() }; IDataDomainRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "user" }; ProgramAttributeData pad = dm.GetProgramAttributes("535808a7d6a485044cedecd6", request); st.Stop(); int seconds = st.Elapsed.Milliseconds; }
public void Get_With_Two_Objectives_Test() { StubProgramRepositoryFactory factory = new StubProgramRepositoryFactory(); GetPatientProgramsDataRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "000000000000000000000000" }; IProgramRepository repo = factory.GetRepository(request, RepositoryType.Program); MEProgram mep = repo.GetLimitedProgramFields("000000000000000000000000") as MEProgram; Assert.AreEqual(2, mep.Objectives.Count); }
public void Get_With_Objectives_Test() { string ctrl = "123456789011111111112223"; StubProgramRepositoryFactory factory = new StubProgramRepositoryFactory(); GetPatientProgramsDataRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "000000000000000000000000" }; IProgramRepository repo = factory.GetRepository(request, RepositoryType.Program); MEProgram mep = repo.GetLimitedProgramFields("000000000000000000000000") as MEProgram; Assert.IsNotNull(mep.Objectives); }
public void DD_FindByID_AttrEndDate() { DateTime?time = Convert.ToDateTime("1/1/1901"); StubProgramRepositoryFactory factory = new StubProgramRepositoryFactory(); GetPatientProgramsDataRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "000000000000000000000000" }; IProgramRepository repo = factory.GetRepository(request, RepositoryType.PatientProgram); MEPatientProgram mep = repo.FindByID("000000000000000000000000") as MEPatientProgram; DateTime? tDate = mep.Modules[0].AttributeEndDate; Assert.AreEqual(time, tDate); }
public void DD_FindByID_AssignedBy() { string ctrl = "123456789011111111112223"; StubProgramRepositoryFactory factory = new StubProgramRepositoryFactory(); GetPatientProgramsDataRequest request = new GetPatientProgramsDataRequest { ContractNumber = "InHealth001", Context = "NG", UserId = "000000000000000000000000" }; IProgramRepository repo = factory.GetRepository(request, RepositoryType.PatientProgram); MEPatientProgram mep = repo.FindByID("000000000000000000000000") as MEPatientProgram; string sample = mep.Modules[0].AssignedBy.ToString(); Assert.AreEqual(ctrl, sample); }
public GetPatientProgramsDataResponse Get(GetPatientProgramsDataRequest request) { GetPatientProgramsDataResponse response = new GetPatientProgramsDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ProgramDD:Get()::Unauthorized Access"); } response = ProgramDataManager.GetPatientPrograms(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); }