Example #1
0
        /// <summary>
        /// Constructs an instance of <see cref="WorkQueueSummary"/> based on a <see cref="WorkQueue"/> object.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        /// <remark>
        ///
        /// </remark>
        private WorkQueueSummary CreateWorkQueueSummary(WorkQueue item)
        {
            WorkQueueSummary summary = new WorkQueueSummary
            {
                TheWorkQueueItem = item,
                ThePartition     = Partition
            };

            // Fetch the patient info:
            StudyStorageAdaptor ssAdaptor = new StudyStorageAdaptor();
            StudyStorage        storages  = ssAdaptor.Get(item.StudyStorageKey);

            if (storages == null)
            {
                summary.PatientId    = "N/A";
                summary.PatientsName = "N/A";
                return(summary);
            }
            StudyAdaptor        studyAdaptor  = new StudyAdaptor();
            StudySelectCriteria studycriteria = new StudySelectCriteria();

            studycriteria.StudyInstanceUid.EqualTo(storages.StudyInstanceUid);
            studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
            IList <Study> studyList = studyAdaptor.Get(studycriteria);

            if (studyList == null || studyList.Count == 0)
            {
                summary.PatientId    = "N/A";
                summary.PatientsName = "N/A";
            }
            else
            {
                summary.PatientId    = studyList[0].PatientId;
                summary.PatientsName = studyList[0].PatientsName;
            }

            if (item.WorkQueueTypeEnum == WorkQueueTypeEnum.WebMoveStudy ||
                item.WorkQueueTypeEnum == WorkQueueTypeEnum.AutoRoute)
            {
                DeviceDataAdapter deviceAdaptor = new DeviceDataAdapter();
                Device            dest          = deviceAdaptor.Get(item.DeviceKey);

                summary.Notes = String.Format("Destination AE : {0}", dest.AeTitle);

                if (item.FailureDescription != null)
                {
                    summary.FullDescription = String.Format("{0}, {1}", summary.Notes, item.FailureDescription);                       //Set the FullDescription for the Tooltip in the GUI
                    summary.Notes           = summary.FullDescription.Length > 60
                                                ? summary.FullDescription.Substring(0, 60)
                                                : summary.FullDescription;
                }
            }
            else if (item.FailureDescription != null)
            {
                // This used to only be shown when the status was "Failed" for a
                // queue entry.  We now show it any time there's
                if (item.FailureDescription.Length > 60)
                {
                    summary.Notes           = item.FailureDescription.Substring(0, 60);
                    summary.Notes          += " ...";
                    summary.FullDescription = item.FailureDescription;                  //Set the FullDescription for the Tooltip in the GUI
                }
                else
                {
                    summary.Notes = item.FailureDescription;
                }
            }

            summary.RequiresAttention = item.WorkQueueStatusEnum.Equals(WorkQueueStatusEnum.Failed) || !ServerPlatform.IsActiveWorkQueue(item);
            return(summary);
        }
		/// <summary>
		/// Constructs an instance of <see cref="WorkQueueSummary"/> based on a <see cref="WorkQueue"/> object.
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		/// <remark>
		/// 
		/// </remark>
		private WorkQueueSummary CreateWorkQueueSummary(WorkQueue item)
		{
			WorkQueueSummary summary = new WorkQueueSummary
			                           	{
			                           		TheWorkQueueItem = item,
			                           		ThePartition = Partition
			                           	};

			// Fetch the patient info:
			StudyStorageAdaptor ssAdaptor = new StudyStorageAdaptor();
			StudyStorage storages = ssAdaptor.Get(item.StudyStorageKey);
			if (storages == null)
			{
				summary.PatientId = "N/A";
				summary.PatientsName = "N/A";
				return summary;
			}
			StudyAdaptor studyAdaptor = new StudyAdaptor();
			StudySelectCriteria studycriteria = new StudySelectCriteria();
			studycriteria.StudyInstanceUid.EqualTo(storages.StudyInstanceUid);
			studycriteria.ServerPartitionKey.EqualTo(item.ServerPartitionKey);
			IList<Study> studyList = studyAdaptor.Get(studycriteria);

			if (studyList == null || studyList.Count == 0)
			{
				summary.PatientId = "N/A";
				summary.PatientsName = "N/A";
			}
			else
			{
				summary.PatientId = studyList[0].PatientId;
				summary.PatientsName = studyList[0].PatientsName;
			}

			if (item.WorkQueueTypeEnum == WorkQueueTypeEnum.WebMoveStudy
			    || item.WorkQueueTypeEnum == WorkQueueTypeEnum.AutoRoute)
			{
				DeviceDataAdapter deviceAdaptor = new DeviceDataAdapter();
				Device dest = deviceAdaptor.Get(item.DeviceKey);

				summary.Notes = String.Format("Destination AE : {0}", dest.AeTitle);

				if (item.FailureDescription != null)
				{
					summary.FullDescription = String.Format("{0}, {1}", summary.Notes, item.FailureDescription);   //Set the FullDescription for the Tooltip in the GUI
					summary.Notes = summary.FullDescription.Length > 60 
						? summary.FullDescription.Substring(0, 60) 
						: summary.FullDescription;
				}
			}
			else if (item.FailureDescription != null)
			{
				// This used to only be shown when the status was "Failed" for a 
				// queue entry.  We now show it any time there's 
				if (item.FailureDescription.Length > 60)
				{
					summary.Notes = item.FailureDescription.Substring(0, 60);
					summary.Notes += " ...";
				    summary.FullDescription = item.FailureDescription;  //Set the FullDescription for the Tooltip in the GUI
				}
				else
					summary.Notes = item.FailureDescription;
			}

            summary.RequiresAttention = item.WorkQueueStatusEnum.Equals(WorkQueueStatusEnum.Failed) || !ServerPlatform.IsActiveWorkQueue(item);
			return summary;
		}