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;
                    }
                }
            }
        }
예제 #2
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;
                    }
                }
            }
        }