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; } }
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; } }
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); }
DeletePatientUserByPatientIdDataResponse IPatientDataManager.DeletePatientUserByPatientId(DeletePatientUserByPatientIdDataRequest request) { throw new NotImplementedException(); }