public object FindByPlanElementID(string entityID)
        {
            MEProgramAttribute pa = new MEProgramAttribute(userId)
            {
            };

            return(pa);
        }
示例#2
0
        public override void Implementation()
        {
            try
            {
                Results = new List <Result>();

                IProgramRepository repo = new ProgramRepositoryFactory().GetRepository(Request, RepositoryType.PatientProgram);

                List <MEPatientProgram> programs = (List <MEPatientProgram>)repo.SelectAll();

                programs.ForEach(p =>
                {
                    Request.UserId = p.UpdatedBy.ToString();
                    repo.UserId    = Constants.SystemContactId; // system

                    IProgramRepository arp  = new ProgramRepositoryFactory().GetRepository(Request, RepositoryType.PatientProgramAttribute);
                    MEProgramAttribute pAtt = (MEProgramAttribute)arp.FindByPlanElementID(p.Id.ToString());

                    if (p.AttributeStartDate == null && pAtt.StartDate != null)
                    {
                        p.AttributeStartDate = pAtt.StartDate;
                        ProgramDetail pd     = new ProgramDetail
                        {
                            AttrStartDate = p.AttributeStartDate,
                            Id            = p.Id.ToString(),
                            ProgramState  = (int)p.State,
                            Order         = p.Order,
                            Enabled       = p.Enabled,
                            Completed     = p.Completed
                        };
                        PutProgramActionProcessingRequest request = new PutProgramActionProcessingRequest {
                            Program = pd, ProgramId = p.Id.ToString()
                        };
                        repo.Update(request);
                        Results.Add(new Result {
                            Message = "PlanElement [" + p.Id.ToString() + "] in PatientProgramAttributes collection startdate moved"
                        });
                    }
                });
                Results.Add(new Result {
                    Message = "Total records updated: " + Results.Count
                });
            }
            catch (Exception ex)
            {
                Results.Add(new Result {
                    Message = ex.Message + " : " + ex.StackTrace
                });
                throw ex;
            }
        }
示例#3
0
 public object FindByPlanElementID(string entityID)
 {
     try
     {
         MEProgramAttribute cp = null;
         using (ProgramMongoContext ctx = new ProgramMongoContext(_dbName))
         {
             List <IMongoQuery> queries = new List <IMongoQuery>();
             queries.Add(Query.EQ(MEProgramAttribute.PlanElementIdProperty, ObjectId.Parse(entityID)));
             queries.Add(Query.EQ(MEProgramAttribute.DeleteFlagProperty, false));
             IMongoQuery mQuery = Query.And(queries);
             cp = ctx.ProgramAttributes.Collection.Find(mQuery).FirstOrDefault();
         }
         return(cp);
     }
     catch (Exception) { throw; }
 }
示例#4
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);
            }
        }
示例#5
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);
        }
示例#6
0
        public object Insert(object newEntity)
        {
            bool result               = false;
            ProgramAttributeData pa   = (ProgramAttributeData)newEntity;
            MEProgramAttribute   mepa = null;

            try
            {
                using (ProgramMongoContext ctx = new ProgramMongoContext(_dbName))
                {
                    mepa = new MEProgramAttribute(this.UserId)
                    {
                        Status         = (Status)pa.Status,
                        RemovedReason  = pa.OverrideReason,
                        Population     = pa.Population,
                        PlanElementId  = ObjectId.Parse(pa.PlanElementId),
                        OverrideReason = pa.OverrideReason,
                        //OptOutReason = pa.OptOutReason,
                        //OptOutDate = pa.OptOutDate,
                        OptOut           = pa.OptOut,
                        Locked           = (Locked)pa.Locked,
                        IneligibleReason = pa.IneligibleReason,
                        Completed        = (Completed)pa.Completed,
                        //AssignedOn = pa.AssignedOn, Sprint 12
                        CompletedBy        = pa.CompletedBy,
                        DateCompleted      = pa.DateCompleted,
                        DidNotEnrollReason = pa.DidNotEnrollReason,
                        //DisEnrollReason = pa.DisEnrollReason,
                        Eligibility = (EligibilityStatus)pa.Eligibility,
                        //EligibilityEndDate = pa.EligibilityEndDate,
                        //EligibilityOverride = (EligibilityOverride)pa.EligibilityOverride,
                        //EligibilityRequirements = pa.EligibilityRequirements,
                        //EligibilityStartDate = pa.EligibilityStartDate,
                        // EndDate = pa.AttrEndDate, , Sprint 12
                        Enrollment    = (EnrollmentStatus)pa.Enrollment,
                        GraduatedFlag = (Graduated)pa.GraduatedFlag,
                        //  StartDate = pa.AttrStartDate, Sprint 12
                        DeleteFlag = false
                                     //,LastUpdatedOn = DateTime.UtcNow,
                                     //UpdatedBy = ObjectId.Parse(this.UserId)
                    };

                    //if(pa.AssignedBy != null) Sprint 12
                    //{
                    //    mepa.AssignedBy = ObjectId.Parse(pa.AssignedBy);
                    //}

                    //if (pa.AssignedTo != null) Sprint 12
                    //{
                    //    mepa.AssignedTo = ObjectId.Parse(pa.AssignedTo);
                    //}

                    ctx.ProgramAttributes.Collection.Insert(mepa);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientProgramAttribute.ToString(),
                                             mepa.Id.ToString(),
                                             Common.DataAuditType.Insert,
                                             _dbName);

                    result = true;
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("DD:PatientProgramAttributeRepository:Insert()::" + ex.Message, ex.InnerException);
            }
        }