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 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); }