/// <summary>
		/// Gets a list of <see cref="ArchiveQueue"/> items with specified criteria
		/// </summary>
		/// <param name="parameters"></param>
		/// <returns></returns>
		public IList<ArchiveQueue> FindArchiveQueue(WebQueryArchiveQueueParameters parameters)
		{
			try
			{
				IList<ArchiveQueue> list;

				IWebQueryArchiveQueue broker = HttpContext.Current.GetSharedPersistentContext().GetBroker<IWebQueryArchiveQueue>();
				list = broker.Find(parameters);

				return list;
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Error, "FindArchiveQueue failed", e);
				return new List<ArchiveQueue>();
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Gets a list of <see cref="ArchiveQueue"/> items with specified criteria
		/// </summary>
		/// <param name="parameters"></param>
		/// <returns></returns>
		public IList<ArchiveQueue> FindArchiveQueue(WebQueryArchiveQueueParameters parameters)
		{
			try
			{
				IList<ArchiveQueue> list;

				IPersistentStore _store = PersistentStoreRegistry.GetDefaultStore();

                IWebQueryArchiveQueue broker = HttpContextData.Current.ReadContext.GetBroker<IWebQueryArchiveQueue>();
				list = broker.Find(parameters);

				return list;
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Error, "FindArchiveQueue failed", e);
				return new List<ArchiveQueue>();
			}
		}
Ejemplo n.º 3
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(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<ArchiveQueue> list = _searchController.FindArchiveQueue(parameters);

			resultCount = parameters.ResultCount;

			return list;
		}