コード例 #1
0
ファイル: StudyController.cs プロジェクト: nhannd/Xian
        public int GetStudyIntegrityQueueCount(ServerEntityKey studyStorageKey)
        {
            Platform.CheckForNullReference(studyStorageKey, "storageKey");


            IStudyIntegrityQueueEntityBroker integrityQueueBroker = HttpContextData.Current.ReadContext.GetBroker<IStudyIntegrityQueueEntityBroker>();
            StudyIntegrityQueueSelectCriteria parms = new StudyIntegrityQueueSelectCriteria();

            parms.StudyStorageKey.EqualTo(studyStorageKey);

            return integrityQueueBroker.Count(parms);
        }
コード例 #2
0
		public IList<StudyIntegrityQueue> GetStudyIntegrityQueueItems(ServerEntityKey studyStorageKey)
        {
			Platform.CheckForNullReference(studyStorageKey, "storageKey");


            IStudyIntegrityQueueEntityBroker integrityQueueBroker = HttpContext.Current.GetSharedPersistentContext().GetBroker<IStudyIntegrityQueueEntityBroker>();
            StudyIntegrityQueueSelectCriteria parms = new StudyIntegrityQueueSelectCriteria();

			parms.StudyStorageKey.EqualTo(studyStorageKey);

            return integrityQueueBroker.Find(parms);
        
        }
コード例 #3
0
        /// <summary>
        /// Finds all storage locations used for the study.
        /// </summary>
        protected void FindAllRelatedDirectories()
        {
            // Check the work queue for other entries
            IList<Model.WorkQueue> list;

            // NOTE: a local read context is used for lookup because we want to
            // release the lock on the rows asap.
            using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
            {
                IWorkQueueEntityBroker broker = ctx.GetBroker<IWorkQueueEntityBroker>();
                WorkQueueSelectCriteria criteria = new WorkQueueSelectCriteria();
                criteria.StudyStorageKey.EqualTo(WorkQueueItem.StudyStorageKey);
                list = broker.Find(criteria);
            }


            List<DirectoryInfo> dirs = new List<DirectoryInfo>();
            foreach(Model.WorkQueue item in list)
            {
                string path = GetWorkQueueSecondaryFolder(item);
                if (!string.IsNullOrEmpty(path))    
                    dirs.Add(new DirectoryInfo(path));
            }

            // NOTE: Under normal operation, the SIQ entries should be 
            // empty at this point because the Delete Study button is disabled otherwise.
            // This block of code is still needed just in case this DeleteStudy work queue entry
            // is inserted through different means.
            IList<StudyIntegrityQueue> siqList;
            using (IReadContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenReadContext())
            {
                IStudyIntegrityQueueEntityBroker broker = ctx.GetBroker<IStudyIntegrityQueueEntityBroker>();
                StudyIntegrityQueueSelectCriteria criteria = new StudyIntegrityQueueSelectCriteria();
                criteria.StudyStorageKey.EqualTo(WorkQueueItem.StudyStorageKey);
                siqList = broker.Find(criteria);
            }

            foreach (StudyIntegrityQueue item in siqList)
            {
                string path = GetSIQItemStorageFolder(item);
                if (!string.IsNullOrEmpty(path))
                    dirs.Add(new DirectoryInfo(path));
            }


            _relatedDirectories = dirs;
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StudyIntegrityQueueController controller = new StudyIntegrityQueueController();
            StudyIntegrityQueueSelectCriteria criteria = new StudyIntegrityQueueSelectCriteria();

            criteria.StudyIntegrityReasonEnum.EqualTo(StudyIntegrityReasonEnum.Duplicate);
            Duplicates = controller.GetReconcileQueueItemsCount(criteria);
            DuplicateLink.PostBackUrl = ImageServerConstants.PageURLs.StudyIntegrityQueuePage + "?Databind=true&Reason=" + StudyIntegrityReasonEnum.Duplicate.Lookup;

            criteria.StudyIntegrityReasonEnum.EqualTo(StudyIntegrityReasonEnum.InconsistentData);
            InconsistentData = controller.GetReconcileQueueItemsCount(criteria);
            InconsistentDataLink.PostBackUrl = ImageServerConstants.PageURLs.StudyIntegrityQueuePage + "?Databind=true&Reason=" + StudyIntegrityReasonEnum.InconsistentData.Lookup ;

            TotalLinkButton.PostBackUrl = ImageServerConstants.PageURLs.StudyIntegrityQueuePage + "?Databind=true";


        }
コード例 #5
0
		private Study GetStudyAndQueues(StudyStorageLocation location, out int integrityQueueCount, out int workQueueCount)
		{
			using (IReadContext context = _store.OpenReadContext())
			{
				IStudyIntegrityQueueEntityBroker integrityBroker = context.GetBroker<IStudyIntegrityQueueEntityBroker>();
				StudyIntegrityQueueSelectCriteria integrityCriteria = new StudyIntegrityQueueSelectCriteria();
				integrityCriteria.StudyStorageKey.EqualTo(location.Key);
				integrityQueueCount = integrityBroker.Count(integrityCriteria);

				IWorkQueueEntityBroker workBroker = context.GetBroker<IWorkQueueEntityBroker>();
				WorkQueueSelectCriteria workCriteria = new WorkQueueSelectCriteria();
				workCriteria.StudyStorageKey.EqualTo(location.Key);
				workQueueCount = workBroker.Count(workCriteria);

				IStudyEntityBroker procedure = context.GetBroker<IStudyEntityBroker>();
				StudySelectCriteria criteria = new StudySelectCriteria();
				criteria.StudyStorageKey.EqualTo(location.Key);
				return procedure.FindOne(criteria);
			}
		}
コード例 #6
0
 public StudyIntegrityQueueSelectCriteria(StudyIntegrityQueueSelectCriteria other)
 : base(other)
 {}
コード例 #7
0
ファイル: ServerHelper.cs プロジェクト: UIKit0/ClearCanvas
        /// <summary>
        /// Finds a list of <see cref="StudyIntegrityQueue"/> related to the specified <see cref="StudyStorage"/>.
        /// </summary>
		/// <param name="studyStorageKey"></param>
        /// <param name="filter">A delegate that will be used to filter the returned list. Pass in Null to get the entire list.</param>
        /// <returns>A list of  <see cref="StudyIntegrityQueue"/></returns>
        static public IList<StudyIntegrityQueue> FindSIQEntries(ServerEntityKey studyStorageKey, Predicate<StudyIntegrityQueue> filter)
        {
            using (ServerExecutionContext scope = new ServerExecutionContext())
            {
                IStudyIntegrityQueueEntityBroker broker = scope.PersistenceContext.GetBroker<IStudyIntegrityQueueEntityBroker>();
                StudyIntegrityQueueSelectCriteria criteria = new StudyIntegrityQueueSelectCriteria();
                criteria.StudyStorageKey.EqualTo(studyStorageKey);
                criteria.InsertTime.SortDesc(0);
                IList<StudyIntegrityQueue> list = broker.Find(criteria);
                if (filter != null)
                {
                    CollectionUtils.Remove(list, filter);
                }
                return list;
            }
        }
コード例 #8
0
ファイル: ServerHelper.cs プロジェクト: UIKit0/ClearCanvas
		/// <summary>
		/// Checks for the existinance of a SOP for a given Study in the <see cref="StudyIntegrityQueue"/>.
		/// </summary>
		/// <param name="studyStorageKey">The StudyStorage primary key</param>
		/// <param name="sopInstanceUid">The Sop Instance ot look for</param>
		/// <param name="seriesInstanceUid">The Series Instance Uid of the Sop</param>
		/// <returns>true if an entry exists, false if it doesn't</returns>
		static public bool StudyIntegrityUidExists(ServerEntityKey studyStorageKey, string seriesInstanceUid, string sopInstanceUid)
		{
			Platform.CheckForNullReference(studyStorageKey, "studyStorageKey");

			using (ServerExecutionContext scope = new ServerExecutionContext())
			{
				IStudyIntegrityQueueEntityBroker broker = scope.PersistenceContext.GetBroker<IStudyIntegrityQueueEntityBroker>();
				StudyIntegrityQueueUidSelectCriteria uidSelectCriteria = new StudyIntegrityQueueUidSelectCriteria();
				uidSelectCriteria.SeriesInstanceUid.EqualTo(seriesInstanceUid);
				uidSelectCriteria.SopInstanceUid.EqualTo(sopInstanceUid);
				StudyIntegrityQueueSelectCriteria selectCriteria = new StudyIntegrityQueueSelectCriteria();
				selectCriteria.StudyStorageKey.EqualTo(studyStorageKey);
				selectCriteria.StudyIntegrityQueueUidRelatedEntityCondition.Exists(uidSelectCriteria);

				return broker.Count(selectCriteria) > 0;
			}
		}
コード例 #9
0
		private StudyIntegrityQueueSelectCriteria GetStudyIntegrityQueueCriteria()
		{
			var criteria = new StudyIntegrityQueueSelectCriteria();

			// only query for device in this partition
			criteria.ServerPartitionKey.EqualTo(Partition.GetKey());

			string description = string.Empty;
            if (!String.IsNullOrEmpty(PatientName))
            {
                description += "%ExistingPatientName=" + PatientName;
            }
            if (!String.IsNullOrEmpty(PatientId))
            {
                description += "%ExistingPatientId=" + PatientId ;
            }
            else if (!String.IsNullOrEmpty(description))
                description += "%ExistingPatientId=%";

            if (!String.IsNullOrEmpty(AccessionNumber))
            {
                description += "%ExistingAccessionNumber=" + AccessionNumber;
            }
            else if (!String.IsNullOrEmpty(description))
                description += "%ExistingAccessionNumber=%";

			if(!String.IsNullOrEmpty(description))
			{
				description = description.Replace("*", "%");
				description = description.Replace("?", "_");
				criteria.Description.Like(description);    
			}
                       
			if (!String.IsNullOrEmpty(FromInsertTime) || !String.IsNullOrEmpty(ToInsertTime))
			{
                if (!String.IsNullOrEmpty(FromInsertTime) && !String.IsNullOrEmpty(ToInsertTime))
                {
                    DateTime fromTime = DateTime.Parse(FromInsertTime);
                    DateTime toTime = DateTime.Parse(ToInsertTime);
                    if (toTime == fromTime) criteria.InsertTime.Between(fromTime, fromTime.AddHours(24));
                    else criteria.InsertTime.Between(fromTime, toTime.AddHours(24));
                } else if(!String.IsNullOrEmpty(FromInsertTime))
                {
                    DateTime fromTime = DateTime.Parse(FromInsertTime);
                    criteria.InsertTime.MoreThanOrEqualTo(fromTime.AddHours(24));
                } else
                {
                    DateTime toTime = DateTime.Parse(ToInsertTime);
                    criteria.InsertTime.LessThanOrEqualTo(toTime.AddHours(24));
                }
			}

            if(ReasonEnum.Count > 0)
            {
                criteria.StudyIntegrityReasonEnum.In(ReasonEnum);
            }

			// Must do a sort order for range search to work right in this release.
			criteria.InsertTime.SortAsc(0);

			return criteria;
		}
コード例 #10
0
 public int GetReconcileQueueItemsCount(StudyIntegrityQueueSelectCriteria criteria)
 {
     return _adaptor.GetCount(criteria);
 }
コード例 #11
0
 public IList<StudyIntegrityQueue> GetRangeStudyIntegrityQueueItems(StudyIntegrityQueueSelectCriteria criteria, int startIndex, int maxRows)
 {
     return _adaptor.GetRange(criteria, startIndex, maxRows);
 }
コード例 #12
0
		public IList<StudyIntegrityQueue> GetStudyIntegrityQueueItems(StudyIntegrityQueueSelectCriteria criteria)
        {
            return _adaptor.Get(criteria);
        }
コード例 #13
0
 public StudyIntegrityQueueSelectCriteria(StudyIntegrityQueueSelectCriteria other)
     : base(other)
 {
 }
コード例 #14
0
ファイル: SeriesGridView.ascx.cs プロジェクト: nhannd/Xian
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

			// Get a count of the number of SIQ entries for the StudyStorageLocation.  If there's
			// any, we don't enable the Delete button.
			var siqController = new StudyIntegrityQueueController();
			var criteria = new StudyIntegrityQueueSelectCriteria();
			criteria.StudyStorageKey.EqualTo(Study.TheStudyStorage.Key);
        	int siqCount = siqController.GetReconcileQueueItemsCount(criteria);

            string reason;
            bool seriesDelete = Study.CanScheduleSeriesDelete(out reason);

            foreach(GridViewRow row in GridView1.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    int index = GridView1.PageIndex * GridView1.PageSize + row.RowIndex;
                    Series series = _series[index];

                    row.Attributes["serverae"] = _serverPartition.AeTitle;
                    row.Attributes["studyuid"] = _study.StudyInstanceUid;
                    row.Attributes["seriesuid"] = series.SeriesInstanceUid;

                    var controller = new StudyController();
                    if (controller.CanManipulateSeries(Study.TheStudyStorage.Key))
                    {
                        
						if (siqCount==0 && seriesDelete)
							row.Attributes.Add("candelete", "true");

                        row.Attributes.Add("canmove", "true");
                    }
                }
            }

            
        }