Esempio n. 1
0
        public void Delete(object entity)
        {
            DeletePatientUserByPatientIdDataRequest request = (DeletePatientUserByPatientIdDataRequest)entity;

            try
            {
                using (PatientMongoContext ctx = new PatientMongoContext(_dbName))
                {
                    var patientUserQuery = MB.Query <MEPatientUser> .EQ(b => b.Id, ObjectId.Parse(request.Id));

                    var patientUserBuilder = new List <MB.UpdateBuilder>();
                    patientUserBuilder.Add(MB.Update.Set(MEPatientUser.TTLDateProperty, DateTime.UtcNow.AddDays(_expireDays)));
                    patientUserBuilder.Add(MB.Update.Set(MEPatientUser.DeleteFlagProperty, true));
                    patientUserBuilder.Add(MB.Update.Set(MEPatientUser.LastUpdatedOnProperty, DateTime.UtcNow));
                    patientUserBuilder.Add(MB.Update.Set(MEPatientUser.UpdatedByProperty, ObjectId.Parse(this.UserId)));

                    IMongoUpdate patientUserUpdate = MB.Update.Combine(patientUserBuilder);
                    ctx.PatientUsers.Collection.Update(patientUserQuery, patientUserUpdate);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientUser.ToString(),
                                             request.Id.ToString(),
                                             Common.DataAuditType.Delete,
                                             request.ContractNumber);
                }
            }
            catch (Exception) { throw; }
        }
Esempio n. 2
0
        public DeletePatientUserByPatientIdDataResponse DeletePatientUserByPatientId(DeletePatientUserByPatientIdDataRequest request)
        {
            DeletePatientUserByPatientIdDataResponse response = null;

            try
            {
                response = new DeletePatientUserByPatientIdDataResponse();

                IPatientRepository patientUserRepo = Factory.GetRepository(request, RepositoryType.PatientUser);

                List <PatientUserData> puData     = patientUserRepo.FindPatientUsersByPatientId(request.PatientId);
                List <string>          deletedIds = null;
                if (puData != null)
                {
                    deletedIds = new List <string>();
                    puData.ForEach(u =>
                    {
                        request.Id = u.Id;
                        patientUserRepo.Delete(request);
                        deletedIds.Add(request.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 3
0
        public DeletePatientUserByPatientIdDataResponse Delete(DeletePatientUserByPatientIdDataRequest request)
        {
            DeletePatientUserByPatientIdDataResponse response = new DeletePatientUserByPatientIdDataResponse();

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

                response         = PatientManager.DeletePatientUserByPatientId(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);
        }
Esempio n. 4
0
 DeletePatientUserByPatientIdDataResponse IPatientDataManager.DeletePatientUserByPatientId(DeletePatientUserByPatientIdDataRequest request)
 {
     throw new NotImplementedException();
 }