Exemplo n.º 1
0
        protected void LoadStudy()
        {
            if (String.IsNullOrEmpty(_studyInstanceUid))
            {
                return;
            }

            if (_partition == null)
            {
                return;
            }


            StudyAdaptor        studyAdaptor = new StudyAdaptor();
            StudySelectCriteria criteria     = new StudySelectCriteria();

            criteria.StudyInstanceUid.EqualTo(_studyInstanceUid);
            criteria.ServerPartitionKey.EqualTo(Partition.GetKey());
            Study study = studyAdaptor.GetFirst(HttpContextData.Current.ReadContext, criteria);

            if (study != null)
            {
                _study = StudySummaryAssembler.CreateStudySummary(HttpContextData.Current.ReadContext, study);
            }
            else
            {
                StudyNotFoundException exception = new StudyNotFoundException(_studyInstanceUid);
                ExceptionHandler.ThrowException(exception);
            }

            StudyDetailsPanel.Study = _study;
            StudyDetailsPanel.DataBind();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tries to find the study that appears on the current page.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="study"></param>
        /// <returns></returns>
        private bool TryFindStudySummaryOnCurrentPage(string key, out StudySummary study)
        {
            study = null;
            if (_studies != null && _studies.ToList().Exists(x => x.Key.Key.ToString().Equals(key)))
            {
                study = _studies.First(x => x.Key.Key.ToString().Equals(key));
            }

            return(study != null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete a Study.
        /// </summary>
        public void DeleteStudy(ServerEntityKey studyKey, string reason)
        {
            StudySummary study = StudySummaryAssembler.CreateStudySummary(HttpContextData.Current.ReadContext, Study.Load(HttpContextData.Current.ReadContext, studyKey));

            if (study.IsReconcileRequired)
            {
                throw new ApplicationException(
                          String.Format("Deleting the study is not allowed at this time : there are items to be reconciled."));

                // NOTE: another check will occur when the delete is actually processed
            }


            using (IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                LockStudyParameters lockParms = new LockStudyParameters
                {
                    QueueStudyStateEnum = QueueStudyStateEnum.WebDeleteScheduled,
                    StudyStorageKey     = study.TheStudyStorage.Key
                };
                ILockStudy broker = ctx.GetBroker <ILockStudy>();
                broker.Execute(lockParms);
                if (!lockParms.Successful)
                {
                    throw new ApplicationException(String.Format("Unable to lock the study : {0}", lockParms.FailureReason));
                }


                InsertWorkQueueParameters insertParms = new InsertWorkQueueParameters
                {
                    WorkQueueTypeEnum  = WorkQueueTypeEnum.WebDeleteStudy,
                    ServerPartitionKey = study.ThePartition.Key,
                    StudyStorageKey    = study.TheStudyStorage.Key,
                    ScheduledTime      = Platform.Time
                };

                WebDeleteStudyLevelQueueData extendedData = new WebDeleteStudyLevelQueueData
                {
                    Level    = DeletionLevel.Study,
                    Reason   = reason,
                    UserId   = ServerHelper.CurrentUserId,
                    UserName = ServerHelper.CurrentUserName
                };
                insertParms.WorkQueueData = XmlUtils.SerializeAsXmlDoc(extendedData);
                IInsertWorkQueue insertWorkQueue = ctx.GetBroker <IInsertWorkQueue>();

                if (insertWorkQueue.FindOne(insertParms) == null)
                {
                    throw new ApplicationException("DeleteStudy failed");
                }


                ctx.Commit();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Delete a Study.
        /// </summary>
        public void DeleteStudy(ServerEntityKey studyKey, string reason)
        {
            StudySummary study = StudySummaryAssembler.CreateStudySummary(HttpContext.Current.GetSharedPersistentContext(), Study.Load(HttpContext.Current.GetSharedPersistentContext(), studyKey));

            if (study.IsReconcileRequired)
            {
                throw new ApplicationException(
                          String.Format("Deleting the study is not allowed at this time : there are items to be reconciled."));

                // NOTE: another check will occur when the delete is actually processed
            }

            using (IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                StudyDeleteHelper.DeleteStudy(ctx, study.ThePartition, study.StudyInstanceUid, reason);
                ctx.Commit();
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            if (Studies == null)
            {
                return;
            }

            new ServerPartitionDataAdapter();

            foreach (GridViewRow row in StudyListControl.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    StudySummary study = Studies[row.RowIndex];

                    if (study != null)
                    {
                        row.Attributes.Add("instanceuid", study.StudyInstanceUid);
                        row.Attributes.Add("serverae", study.ThePartition.AeTitle);
                        row.Attributes.Add("canviewimages", "true");
                    }
                }
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);



            if (Studies == null)
            {
                return;
            }

            foreach (GridViewRow row in StudyListControl.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    StudySummary study = Studies[row.RowIndex];

                    if (study != null)
                    {
                        row.Attributes.Add("instanceuid", study.StudyInstanceUid);
                        row.Attributes.Add("serverae", study.ThePartition.AeTitle);

                        string reason;
                        if (study.CanScheduleDelete(out reason))
                        {
                            row.Attributes.Add("candelete", "true");
                        }

                        if (study.CanScheduleMove(out reason))
                        {
                            row.Attributes.Add("canmove", "true");
                        }

                        if (study.CanScheduleRestore(out reason))
                        {
                            row.Attributes.Add("canrestore", "true");
                        }

                        if (study.CanViewImages(out reason))
                        {
                            row.Attributes.Add("canviewimages", "true");
                        }
                        else
                        {
                            row.Attributes.Add("canviewimagesreason", reason);
                        }

                        var status = (Label)row.FindControl("StudyStatusEnum");
                        status.Text = ServerEnumDescription.GetLocalizedDescription(study.StudyStatusEnum);


                        var qcStatusLink = (HtmlAnchor)row.FindControl("QCStatusLink");
                        if (qcStatusLink != null)
                        {
                            var processing = study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.ProcessingScheduled) || study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.ProcessingScheduled);
                            if (string.IsNullOrEmpty(study.TheStudy.QCOutput))
                            {
                                if (!processing)
                                {
                                    qcStatusLink.InnerText = "N/A";
                                    qcStatusLink.HRef      = ResolveClientUrl(string.Format("~/Pages/Studies/StudyQCReport.aspx?PartitionAE={0}&StudyUid={1}",
                                                                                            study.ThePartition.AeTitle, study.TheStudy.StudyInstanceUid
                                                                                            ));
                                }
                                else
                                {
                                    qcStatusLink.InnerText = "";
                                }
                            }
                        }



                        LinkButton button = (LinkButton)row.FindControl("ReconcileLinkButton");
                        Label      label  = (Label)row.FindControl("SeparatorLabel");

                        if (study.IsReconcileRequired)
                        {
                            button.Visible = true;
                            label.Visible  = true;

                            button.PostBackUrl = ImageServerConstants.PageURLs.StudyIntegrityQueuePage +
                                                 "?PatientID=" + study.PatientId + "&PatientName=" + study.PatientsName + "&PartitionKey=" + study.ThePartition.GetKey();

                            button.Enabled = Context.User.IsInRole(AuthorityTokens.StudyIntegrityQueue.Search);
                        }
                        else
                        {
                            button.Visible = false;
                            label.Visible  = false;
                        }

                        button = (LinkButton)row.FindControl("QueueLinkButton");
                        label  = (Label)row.FindControl("QueueSeparatorLabel");

                        if (study.IsLocked)
                        {
                            button.Visible = true;

                            if (study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.RestoreScheduled))
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.RestoreQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(AuthorityTokens.RestoreQueue.Search);
                            }
                            else if (study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.ArchiveScheduled))
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.ArchiveQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(AuthorityTokens.ArchiveQueue.Search);
                            }
                            else
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.WorkQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(AuthorityTokens.WorkQueue.Search);
                            }
                        }
                        else
                        {
                            button.Visible = false;
                        }

                        label.Visible = button.Visible;
                    }
                }
            }
        }
Exemplo n.º 7
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);



            if (Studies == null)
            {
                return;
            }

            foreach (GridViewRow row in StudyListControl.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    StudySummary study = Studies[row.RowIndex];

                    if (study != null)
                    {
                        row.Attributes.Add("instanceuid", study.StudyInstanceUid);
                        row.Attributes.Add("serverae", study.ThePartition.AeTitle);

                        string reason;
                        if (study.CanScheduleDelete(out reason))
                        {
                            row.Attributes.Add("candelete", "true");
                        }

                        if (study.CanScheduleMove(out reason))
                        {
                            row.Attributes.Add("canmove", "true");
                        }

                        if (study.CanScheduleRestore(out reason))
                        {
                            row.Attributes.Add("canrestore", "true");
                        }

                        if (study.CanViewImages(out reason))
                        {
                            row.Attributes.Add("canviewimages", "true");
                        }
                        else
                        {
                            row.Attributes.Add("canviewimagesreason", reason);
                        }

                        var status = (Label)row.FindControl("StudyStatusEnum");
                        status.Text = ServerEnumDescription.GetLocalizedDescription(study.StudyStatusEnum);

                        LinkButton button = (LinkButton)row.FindControl("ReconcileLinkButton");
                        Label      label  = (Label)row.FindControl("SeparatorLabel");

                        if (study.IsReconcileRequired)
                        {
                            button.Visible = true;
                            label.Visible  = true;

                            button.PostBackUrl = ImageServerConstants.PageURLs.StudyIntegrityQueuePage +
                                                 "?PatientID=" + study.PatientId + "&PatientName=" + study.PatientsName + "&PartitionKey=" + study.ThePartition.GetKey();

                            button.Enabled = Context.User.IsInRole(Enterprise.Authentication.AuthorityTokens.StudyIntegrityQueue.Search);
                        }
                        else
                        {
                            button.Visible = false;
                            label.Visible  = false;
                        }

                        button = (LinkButton)row.FindControl("QueueLinkButton");
                        label  = (Label)row.FindControl("QueueSeparatorLabel");

                        if (study.IsLocked)
                        {
                            button.Visible = true;

                            if (study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.RestoreScheduled))
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.RestoreQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(Enterprise.Authentication.AuthorityTokens.RestoreQueue.Search);
                            }
                            else if (study.QueueStudyStateEnum.Equals(QueueStudyStateEnum.ArchiveScheduled))
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.ArchiveQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(Enterprise.Authentication.AuthorityTokens.ArchiveQueue.Search);
                            }
                            else
                            {
                                button.PostBackUrl = ImageServerConstants.PageURLs.WorkQueuePage +
                                                     "?PatientID=" + Server.UrlEncode(study.PatientId) + "&PatientName=" + Server.UrlEncode(study.PatientsName) + "&PartitionKey=" +
                                                     study.ThePartition.Key;
                                button.Text    = ServerEnumDescription.GetLocalizedDescription(study.QueueStudyStateEnum);
                                button.Enabled = Context.User.IsInRole(Enterprise.Authentication.AuthorityTokens.WorkQueue.Search);
                            }
                        }
                        else
                        {
                            button.Visible = false;
                        }

                        label.Visible = button.Visible;
                    }
                }
            }
        }