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);
        }
Exemple #2
0
 private void LoadDeletedStudies()
 {
     using (IReadContext context = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
     {
         IStudyDeleteRecordEntityBroker broker = context.GetBroker <IStudyDeleteRecordEntityBroker>();
         _deletedStudies = broker.Find(new StudyDeleteRecordSelectCriteria());
     }
 }