Ejemplo n.º 1
0
        public AddPCMToCohortPatientViewDataResponse Put(AddPCMToCohortPatientViewDataRequest request)
        {
            var response = new AddPCMToCohortPatientViewDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientDD:AddPCMToCohortPatientViewDataResponse()::Unauthorized Access");
                }

                var managerResponse = PatientManager.AddPcmToCohortPatientView(request);
                response.IsSuccessful = managerResponse.IsSuccessful;
                response.Version      = request.Version;
            }
            catch (Exception ex)
            {
                response.IsSuccessful = false;
                CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex);

                var aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Helpers.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
        public bool AddPCMToPatientCohortView(AddPCMToCohortPatientViewDataRequest request)
        {
            try
            {
                using (PatientMongoContext ctx = new PatientMongoContext(_dbName))
                {
                    var q = MB.Query <MECohortPatientView> .EQ(b => b.PatientID, ObjectId.Parse(request.Id));

                    var cohort = ctx.CohortPatientViews.Collection.FindOne(q);

                    if (cohort != null)
                    {
                        var fields   = cohort.SearchFields;
                        var PcmField = fields.FirstOrDefault(f => f.FieldName == Constants.PCM);

                        if (PcmField == null)
                        {
                            var searchField = new SearchField
                            {
                                FieldName = Constants.PCM,
                                Value     = request.ContactIdToAdd,
                                Active    = true
                            };
                            if (!request.ActiveCorePcmIsUser)
                            {
                                searchField.Value  = string.Empty;
                                searchField.Active = false;
                            }
                            fields.Add(searchField);
                        }
                        else
                        {
                            PcmField.Value  = request.ContactIdToAdd;
                            PcmField.Active = true;
                            if (!request.ActiveCorePcmIsUser)
                            {
                                PcmField.Value  = string.Empty;
                                PcmField.Active = false;
                            }
                        }

                        ctx.CohortPatientViews.Collection.Save(cohort);

                        cohort.LastUpdatedOn = DateTime.UtcNow;
                        cohort.UpdatedBy     = ObjectId.Parse(request.UserId);
                    }

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.CohortPatientView.ToString(),
                                             request.Id.ToString(),
                                             Common.DataAuditType.Update,
                                             request.ContractNumber);

                    return(true);
                }
            }
            catch (Exception) { throw; }
        }
Ejemplo n.º 3
0
        public AddPCMToCohortPatientViewDataResponse AddPcmToCohortPatientView(AddPCMToCohortPatientViewDataRequest request)
        {
            var response = new AddPCMToCohortPatientViewDataResponse();

            try
            {
                var repo         = Factory.GetRepository(request, RepositoryType.CohortPatientView);
                var isSuccessful = repo.AddPCMToPatientCohortView(request);

                response.IsSuccessful = isSuccessful;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 4
0
 public AddPCMToCohortPatientViewDataResponse AddPcmToCohortPatientView(AddPCMToCohortPatientViewDataRequest request)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
 public bool AddPCMToPatientCohortView(AddPCMToCohortPatientViewDataRequest request)
 {
     throw new NotImplementedException();
 }