public void Delete(object entity) { DeletePatientNoteDataRequest request = (DeletePatientNoteDataRequest)entity; try { using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName)) { var q = MB.Query <MEPatientNote> .EQ(b => b.Id, ObjectId.Parse(request.Id)); var uv = new List <MB.UpdateBuilder>(); // eng-1408 //uv.Add(MB.Update.Set(MEPatientNote.TTLDateProperty, DateTime.UtcNow.AddDays(_expireDays))); uv.Add(MB.Update.Set(MEPatientNote.LastUpdatedOnProperty, DateTime.UtcNow)); uv.Add(MB.Update.Set(MEPatientNote.DeleteFlagProperty, true)); uv.Add(MB.Update.Set(MEPatientNote.UpdatedByProperty, ObjectId.Parse(this.UserId))); IMongoUpdate update = MB.Update.Combine(uv); ctx.PatientNotes.Collection.Update(q, update); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.PatientNote.ToString(), request.Id.ToString(), Common.DataAuditType.Delete, request.ContractNumber); } } catch (Exception) { throw; } }
public void DeletePatientNote_Test() { DeletePatientNoteDataRequest request = new DeletePatientNoteDataRequest { UserId = "DD_Harness", Version = 1, Id = "5307c1f2d433232860709fef", }; bool isDeleted = m.DeletePatientNote(request); Assert.IsTrue(isDeleted); }
public bool DeletePatientNote(DeletePatientNoteDataRequest request) { try { IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); repo.Delete(request); return(true); } catch (Exception ex) { throw ex; } }
public DeletePatientNoteDataResponse Delete(DeletePatientNoteDataRequest request) { DeletePatientNoteDataResponse response = new DeletePatientNoteDataResponse(); try { RequireUserId(request); response.Deleted = Manager.DeletePatientNote(request); response.Version = request.Version; } catch (Exception ex) { RaiseException(response, ex); } return(response); }
public DeleteNoteByPatientIdDataResponse DeleteNoteByPatientId(DeleteNoteByPatientIdDataRequest request) { DeleteNoteByPatientIdDataResponse response = null; try { response = new DeleteNoteByPatientIdDataResponse(); IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); GetAllPatientNotesDataRequest getAllPatientNotesDataRequest = new GetAllPatientNotesDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; List <PatientNoteData> patientNotes = repo.FindByPatientId(getAllPatientNotesDataRequest) as List <PatientNoteData>; List <string> deletedIds = null; if (patientNotes != null) { deletedIds = new List <string>(); patientNotes.ForEach(u => { DeletePatientNoteDataRequest deletePatientNoteDataRequest = new DeletePatientNoteDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, Id = u.Id, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; repo.Delete(deletePatientNoteDataRequest); deletedIds.Add(deletePatientNoteDataRequest.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public bool DeletePatientNote(DeletePatientNoteDataRequest request) { throw new NotImplementedException(); }