예제 #1
0
        public AssignContactsToCohortPatientViewDataResponse Put(AssignContactsToCohortPatientViewDataRequest request)
        {
            var response = new AssignContactsToCohortPatientViewDataResponse();

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

                var managerResponse = PatientManager.AssignContactsToCohortPatientView(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 AddContactsToCohortPatientView(AssignContactsToCohortPatientViewDataRequest request)
        {
            try
            {
                using (var 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 contactsToAssign = new List <string>();

                        if (request.ContactIdsToAssign != null)
                        {
                            contactsToAssign = request.ContactIdsToAssign;
                        }

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

                        //Update the Cohort.
                        ctx.CohortPatientViews.Collection.Save(cohort);

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



                    return(true);
                }
            }
            catch (Exception) { throw; }
        }
예제 #3
0
 public AssignContactsToCohortPatientViewDataResponse AssignContactsToCohortPatientView(AssignContactsToCohortPatientViewDataRequest request)
 {
     throw new NotImplementedException();
 }
예제 #4
0
        public AssignContactsToCohortPatientViewDataResponse AssignContactsToCohortPatientView(AssignContactsToCohortPatientViewDataRequest request)
        {
            var response = new AssignContactsToCohortPatientViewDataResponse();

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

                response.IsSuccessful = isSuccessful;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }