public IEnumerable Select(int startRowIndex, int maxRows) { IStudyDeleteRecordEntityBroker broker = HttpContext.Current.GetSharedPersistentContext().GetBroker <IStudyDeleteRecordEntityBroker>(); StudyDeleteRecordSelectCriteria criteria = GetSelectCriteria(); criteria.Timestamp.SortDesc(0); IList <StudyDeleteRecord> list = broker.Find(criteria, startRowIndex, maxRows); _studies = CollectionUtils.Map( list, (StudyDeleteRecord record) => DeletedStudyInfoAssembler.CreateDeletedStudyInfo(record)); // Additional filter: DeletedBy if (String.IsNullOrEmpty(DeletedBy) == false) { _studies = CollectionUtils.Select(_studies, delegate(DeletedStudyInfo record) { if (String.IsNullOrEmpty(record.UserId) || String.IsNullOrEmpty(record.UserName)) { return(false); } // either the id or user matches return(record.UserId.ToUpper().IndexOf(DeletedBy.ToUpper()) >= 0 || record.UserName.ToUpper().IndexOf(DeletedBy.ToUpper()) >= 0); }); } return(_studies); }
public int SelectCount() { StudyDeleteRecordSelectCriteria criteria = GetSelectCriteria(); IStudyDeleteRecordEntityBroker broker = HttpContextData.Current.ReadContext.GetBroker <IStudyDeleteRecordEntityBroker>(); return(broker.Count(criteria)); }
public int SelectCount() { StudyDeleteRecordSelectCriteria criteria = GetSelectCriteria(); IStudyDeleteRecordEntityBroker broker = HttpContext.Current.GetSharedPersistentContext().GetBroker <IStudyDeleteRecordEntityBroker>(); return(broker.Count(criteria)); }
private void LoadDeletedStudies() { using (IReadContext context = PersistentStoreRegistry.GetDefaultStore().OpenReadContext()) { IStudyDeleteRecordEntityBroker broker = context.GetBroker <IStudyDeleteRecordEntityBroker>(); _deletedStudies = broker.Find(new StudyDeleteRecordSelectCriteria()); } }
public void OnStudyDeleted() { if (!Enabled) { return; } if (_context.WorkQueueItem.WorkQueueTypeEnum == WorkQueueTypeEnum.WebDeleteStudy) { Study study = _context.Study; if (study == null) { Platform.Log(LogLevel.Info, "Not logging Study Delete information due to missing Study record for study: {0} on partition {1}", _context.StorageLocation.StudyInstanceUid, _context.ServerPartition.AeTitle); return; } StudyStorageLocation storage = _context.StorageLocation; using (IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { // Setup the parameters IStudyDeleteRecordEntityBroker broker = updateContext.GetBroker <IStudyDeleteRecordEntityBroker>(); StudyDeleteRecordUpdateColumns parms = new StudyDeleteRecordUpdateColumns(); parms.Timestamp = Platform.Time; WebDeleteStudyLevelQueueData extendedInfo = XmlUtils.Deserialize <WebDeleteStudyLevelQueueData>(_context.WorkQueueItem.Data); parms.Reason = extendedInfo != null? extendedInfo.Reason:_context.WorkQueueItem.WorkQueueTypeEnum.LongDescription; parms.ServerPartitionAE = _context.ServerPartition.AeTitle; parms.FilesystemKey = storage.FilesystemKey; parms.AccessionNumber = study.AccessionNumber; parms.PatientId = study.PatientId; parms.PatientsName = study.PatientsName; parms.StudyInstanceUid = study.StudyInstanceUid; parms.StudyDate = study.StudyDate; parms.StudyDescription = study.StudyDescription; parms.StudyTime = study.StudyTime; parms.BackupPath = BackupZipFileRelativePath; if (_archives != null && _archives.Count > 0) { parms.ArchiveInfo = XmlUtils.SerializeAsXmlDoc(_archives); } StudyDeleteExtendedInfo extInfo = new StudyDeleteExtendedInfo(); extInfo.ServerInstanceId = ServerPlatform.ServerInstanceId; extInfo.UserId = _context.UserId; extInfo.UserName = _context.UserName; parms.ExtendedInfo = XmlUtils.SerializeAsString(extInfo); StudyDeleteRecord deleteRecord = broker.Insert(parms); if (deleteRecord == null) { Platform.Log(LogLevel.Error, "Unexpected error when trying to create study delete record: {0} on partition {1}", study.StudyInstanceUid, _context.ServerPartition.Description); } else { updateContext.Commit(); } } } }