internal void Reset()
 {
     Clear();
     StudyIntegrityQueueItemList.Reset();
 }
 protected void SearchButton_Click(object sender, ImageClickEventArgs e)
 {
     StudyIntegrityQueueItemList.Refresh();
 }
 public void Refresh()
 {
     SearchUpdatePanel.Update();
     StudyIntegrityQueueItemList.RefreshCurrentPage();
 }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ClearFromDateButton.OnClientClick = ScriptHelper.ClearDate(FromDate.ClientID,
                                                                       FromDateCalendarExtender.ClientID);
            ClearToDateButton.OnClientClick = ScriptHelper.ClearDate(ToDate.ClientID,
                                                                     ToDateCalendarExtender.ClientID);
            ToDate.Attributes["OnChange"] = ScriptHelper.CheckDateRange(FromDate.ClientID, ToDate.ClientID,
                                                                        ToDate.ClientID, ToDateCalendarExtender.ClientID,
                                                                        "To Date must be greater than From Date");
            FromDate.Attributes["OnChange"] = ScriptHelper.CheckDateRange(FromDate.ClientID, ToDate.ClientID,
                                                                          FromDate.ClientID,
                                                                          FromDateCalendarExtender.ClientID,
                                                                          "From Date must be less than To Date");

            GridPagerTop.InitializeGridPager(Labels.GridPagerQueueSingleItem,
                                             Labels.GridPagerQueueMultipleItems,
                                             StudyIntegrityQueueItemList.StudyIntegrityQueueGrid,
                                             () => StudyIntegrityQueueItemList.ResultCount,
                                             ImageServerConstants.GridViewPagerPosition.Top);
            StudyIntegrityQueueItemList.Pager = GridPagerTop;

            StudyIntegrityQueueItemList.DataSourceCreated += delegate(StudyIntegrityQueueDataSource source)
            {
                source.Partition = ServerPartition;

                if (!String.IsNullOrEmpty(PatientName.Text))
                {
                    source.PatientName = SearchHelper.NameWildCard(PatientName.Text);
                }
                if (!String.IsNullOrEmpty(PatientId.Text))
                {
                    source.PatientId = SearchHelper.TrailingWildCard(PatientId.Text);
                }
                if (!String.IsNullOrEmpty(AccessionNumber.Text))
                {
                    source.AccessionNumber = SearchHelper.TrailingWildCard(AccessionNumber.Text);
                }
                if (!String.IsNullOrEmpty(FromDate.Text))
                {
                    source.FromInsertTime = FromDate.Text;
                }

                if (!String.IsNullOrEmpty(ToDate.Text))
                {
                    source.ToInsertTime = ToDate.Text;
                }

                if (ReasonListBox.SelectedIndex > -1)
                {
                    var reasonEnums =
                        new List <StudyIntegrityReasonEnum>();
                    foreach (ListItem item in ReasonListBox.Items)
                    {
                        if (item.Selected)
                        {
                            reasonEnums.Add(
                                StudyIntegrityReasonEnum.GetEnum(
                                    item.Value));
                        }
                    }

                    source.ReasonEnum = reasonEnums;
                }
            };

            ReconcileButton.Roles =
                AuthorityTokens.StudyIntegrityQueue.Reconcile;

            List <StudyIntegrityReasonEnum> reasons = StudyIntegrityReasonEnum.GetAll();

            foreach (StudyIntegrityReasonEnum reason in reasons)
            {
                ReasonListBox.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(reason), reason.Lookup));
            }

            if (!string.IsNullOrEmpty(ReasonFromUrl))
            {
                ReasonListBox.Items.FindByValue(ReasonFromUrl).Selected = true;
            }

            if (!string.IsNullOrEmpty(PatientNameFromUrl) || !string.IsNullOrEmpty(PatientIdFromUrl))
            {
                PatientName.Text = PatientNameFromUrl;
                PatientId.Text   = PatientIdFromUrl;

                StudyIntegrityQueueItemList.SetDataSource();
                StudyIntegrityQueueItemList.Refresh();
            }
            else if (DataBindFromUrl)
            {
                StudyIntegrityQueueItemList.SetDataSource();
                StudyIntegrityQueueItemList.Refresh();
            }
        }