Пример #1
0
        private IList <ArchiveQueue> InternalSelect(int startRowIndex, int maximumRows, out int resultCount)
        {
            resultCount = 0;

            if (maximumRows == 0)
            {
                return(new List <ArchiveQueue>());
            }

            if (SearchKeys != null)
            {
                IList <ArchiveQueue> archiveQueueList = new List <ArchiveQueue>();
                foreach (ServerEntityKey key in SearchKeys)
                {
                    archiveQueueList.Add(ArchiveQueue.Load(key));
                }

                resultCount = archiveQueueList.Count;

                return(archiveQueueList);
            }

            WebQueryArchiveQueueParameters parameters = new WebQueryArchiveQueueParameters();

            parameters.StartIndex  = startRowIndex;
            parameters.MaxRowCount = maximumRows;

            if (Partition != null)
            {
                parameters.ServerPartitionKey = Partition.Key;
            }

            if (!string.IsNullOrEmpty(PatientId))
            {
                string key = PatientId.Replace("*", "%");
                key = key.Replace("?", "_");
                parameters.PatientId = key;
            }
            if (!string.IsNullOrEmpty(PatientName))
            {
                string key = PatientName.Replace("*", "%");
                key = key.Replace("?", "_");
                parameters.PatientsName = key;
            }

            if (String.IsNullOrEmpty(ScheduledDate))
            {
                parameters.ScheduledTime = null;
            }
            else
            {
                parameters.ScheduledTime = DateTime.ParseExact(ScheduledDate, DateFormats, null);
            }

            if (StatusEnum != null)
            {
                parameters.ArchiveQueueStatusEnum = StatusEnum;
            }

            List <string>   groupOIDs = new List <string>();
            CustomPrincipal user      = Thread.CurrentPrincipal as CustomPrincipal;

            if (user != null)
            {
                if (!user.IsInRole(MatrixPACS.Enterprise.Common.AuthorityTokens.DataAccess.AllStudies))
                {
                    foreach (var oid in user.Credentials.DataAccessAuthorityGroups)
                    {
                        groupOIDs.Add(oid.ToString());
                    }

                    parameters.CheckDataAccess         = true;
                    parameters.UserAuthorityGroupGUIDs = StringUtilities.Combine(groupOIDs, ",");
                }
            }

            IList <ArchiveQueue> list = _searchController.FindArchiveQueue(parameters);

            resultCount = parameters.ResultCount;

            return(list);
        }