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

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

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

                resultCount = archiveQueueList.Count;

                return(archiveQueueList);
            }

            WebQueryRestoreQueueParameters parameters = new WebQueryRestoreQueueParameters();

            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.RestoreQueueStatusEnum = 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 <RestoreQueue> list = _searchController.FindRestoreQueue(parameters);

            resultCount = parameters.ResultCount;

            return(list);
        }
Пример #2
0
        private IList <WorkQueue> InternalSelect(int startRowIndex, int maximumRows, out int resultCount)
        {
            resultCount = 0;

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

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

                resultCount = workQueueList.Count;

                return(workQueueList);
            }

            WebWorkQueueQueryParameters parameters = new WebWorkQueueQueryParameters
            {
                StartIndex  = startRowIndex,
                MaxRowCount = maximumRows
            };

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

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

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

            if (TypeEnums != null && TypeEnums.Length > 0)
            {
                string types = "(";
                if (TypeEnums.Length == 1)
                {
                    types += TypeEnums[0].Enum;
                }
                else
                {
                    string separator = "";
                    foreach (WorkQueueTypeEnum typeEnum in TypeEnums)
                    {
                        types    += separator + typeEnum.Enum;
                        separator = ",";
                    }
                }

                parameters.Type = types + ")";
            }

            if (StatusEnums != null && StatusEnums.Length > 0)
            {
                string statuses = "(";
                if (StatusEnums.Length == 1)
                {
                    statuses += StatusEnums[0].Enum;
                }
                else
                {
                    string separator = "";
                    foreach (WorkQueueStatusEnum statusEnum in StatusEnums)
                    {
                        statuses += separator + statusEnum.Enum;
                        separator = ",";
                    }
                }

                parameters.Status = statuses + ")";
            }

            if (PriorityEnum != null)
            {
                parameters.Priority = PriorityEnum;
            }

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

            if (user != null)
            {
                if (!user.IsInRole(ClearCanvas.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 <WorkQueue> list = _searchController.FindWorkQueue(parameters);

            resultCount = parameters.ResultCount;

            return(list);
        }