Beispiel #1
0
        public ProgramAttributeData GetProgramAttributes(string objectId, IDataDomainRequest request)
        {
            try
            {
                ProgramAttributeData pad  = null;
                IProgramRepository   repo = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);

                MEProgramAttribute pa = repo.FindByPlanElementID(objectId) as MEProgramAttribute;
                if (pa != null)
                {
                    pad = new ProgramAttributeData
                    {
                        //  AssignedBy = pa.AssignedBy.ToString(), Sprint 12
                        //  AssignedTo = pa.AssignedTo.ToString(), Sprint 12
                        // AssignedOn = pa.AssignedOn, Sprint 12
                        Completed          = (int)pa.Completed,
                        CompletedBy        = pa.CompletedBy,
                        DateCompleted      = pa.DateCompleted,
                        DidNotEnrollReason = pa.DidNotEnrollReason,
                        Eligibility        = (int)pa.Eligibility,
                        //  AttrEndDate = pa.EndDate, , Sprint 12
                        Enrollment       = (int)pa.Enrollment,
                        GraduatedFlag    = (int)pa.GraduatedFlag,
                        Id               = pa.Id.ToString(),
                        IneligibleReason = pa.IneligibleReason,
                        Locked           = (int)pa.Locked,
                        OptOut           = pa.OptOut,
                        OverrideReason   = pa.OverrideReason,
                        PlanElementId    = pa.PlanElementId.ToString(),
                        Population       = pa.Population,
                        RemovedReason    = pa.RemovedReason,
                        // AttrStartDate = pa.StartDate, Sprint 12
                        Status = (int)pa.Status
                    };
                }
                return(pad);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:DataProgramManager:GetProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
Beispiel #2
0
        private bool delete(MEPatientProgram mePP, DeletePatientProgramDataRequest request, IProgramRepository ppRepo, out DeletedPatientProgram deletedProgram)
        {
            DeletedPatientProgram deletedPatientProgram = null;
            List <string>         deletedResponsesIds   = null;
            bool success = false;

            try
            {
                if (mePP != null)
                {
                    IProgramRepository ppAttributesRepo = Factory.GetRepository(request, RepositoryType.PatientProgramAttribute);
                    IProgramRepository ppResponsesRepo  = Factory.GetRepository(request, RepositoryType.PatientProgramResponse);

                    #region PatientProgram
                    request.Id = mePP.Id.ToString();
                    ppRepo.Delete(request);
                    deletedPatientProgram = new DeletedPatientProgram {
                        Id = request.Id
                    };
                    success             = true;
                    deletedResponsesIds = new List <string>();
                    #endregion

                    #region PPAttributes
                    MEProgramAttribute pa = ppAttributesRepo.FindByPlanElementID(request.Id) as MEProgramAttribute;
                    if (pa != null)
                    {
                        DeletePatientProgramAttributesDataRequest deletePPAttrDataRequest = new DeletePatientProgramAttributesDataRequest
                        {
                            Context        = request.Context,
                            ContractNumber = request.ContractNumber,
                            Id             = pa.Id.ToString(),
                            UserId         = request.UserId,
                            Version        = request.Version
                        };
                        ppAttributesRepo.Delete(deletePPAttrDataRequest);
                        deletedPatientProgram.PatientProgramAttributeId = deletePPAttrDataRequest.Id;
                        success = true;
                    }
                    #endregion

                    #region PPResponses
                    List <Module> modules = mePP.Modules;
                    if (modules != null && modules.Count > 0)
                    {
                        modules.ForEach(m =>
                        {
                            List <MongoDB.DTO.Action> actions = m.Actions;
                            if (actions != null && actions.Count > 0)
                            {
                                actions.ForEach(a =>
                                {
                                    List <Step> steps = a.Steps;
                                    if (steps != null && steps.Count > 0)
                                    {
                                        steps.ForEach(s =>
                                        {
                                            List <MEPatientProgramResponse> meResponses = ppResponsesRepo.FindByStepId(s.Id.ToString()) as List <MEPatientProgramResponse>;
                                            if (meResponses != null && meResponses.Count > 0)
                                            {
                                                meResponses.ForEach(r =>
                                                {
                                                    DeletePatientProgramResponsesDataRequest deletePPResponsesRequest = new DeletePatientProgramResponsesDataRequest
                                                    {
                                                        Context        = request.Context,
                                                        ContractNumber = request.ContractNumber,
                                                        Id             = r.Id.ToString(),
                                                        UserId         = request.UserId,
                                                        Version        = request.Version
                                                    };
                                                    ppResponsesRepo.Delete(deletePPResponsesRequest);
                                                    deletedResponsesIds.Add(deletePPResponsesRequest.Id);
                                                    success = true;
                                                    deletedPatientProgram.PatientProgramResponsesIds = deletedResponsesIds;
                                                });
                                            }
                                        });
                                    }
                                });
                            }
                        });
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                success = false;
                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            deletedProgram = deletedPatientProgram;
            return(success);
        }