/// <summary>
        /// Gets a list of <see cref="RestoreQueue"/> items with specified criteria
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public IList <RestoreQueue> FindRestoreQueue(WebQueryRestoreQueueParameters parameters)
        {
            try
            {
                IWebQueryRestoreQueue broker = HttpContextData.Current.ReadContext.GetBroker <IWebQueryRestoreQueue>();
                IList <RestoreQueue>  list   = broker.Find(parameters);

                return(list);
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Error, "FindRestoreQueue failed", e);
                return(new List <RestoreQueue>());
            }
        }
Beispiel #2
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);
        }