Exemplo n.º 1
0
    //protected void btnReturnResult_Click(object sender, EventArgs e)
    private void ReturnResult()
    {
        InitializeState();
        int index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);

        if (string.IsNullOrEmpty(currentIndex.Value))
        {
            return;
        }
        whichResultsPage = index;
        SpeedSearchService ss  = new SpeedSearchService();
        SpeedSearchQuery   ssq = BuildQuery();

        ssq.DocTextItem = int.Parse(currentIndex.Value) + 1000000;
        string xml = ss.DoSpeedSearch(ssq.GetAsXml());

        Results = SpeedSearchResults.LoadFromXml(xml);

        _ResultEntity = (EntityBase)m_EntityContextService.GetEntity();
        if (!string.IsNullOrEmpty(_ChildPropertyName))
        {
            PropertyDescriptor child = TypeDescriptor.GetProperties(_ResultEntity.GetType())[_ChildPropertyName];
            _ResultEntity = (EntityBase)child.GetValue(_ResultEntity);
        }
        PropertyDescriptor resultProp = TypeDescriptor.GetProperties(_ResultEntity.GetType())[_ResultProperty];

        resultProp.SetValue(_ResultEntity, Results.Items[0].HighlightedDoc);

        DialogService.CloseEventHappened(null, null);
    }
Exemplo n.º 2
0
    private void initResults(string resultsXml)
    {
        Results       = SpeedSearchResults.LoadFromXml(resultsXml);
        totalDocCount = Results.TotalCount;
        int max = int.Parse(MaxResults.SelectedValue);

        if ((max > 0) && (totalDocCount > max))
        {
            totalDocCount = max;
        }
        if (totalDocCount > 0)
        {
            FirstPage.Visible    = true;
            PreviousPage.Visible = true;
            NextPage.Visible     = true;
            LastPage.Visible     = true;
        }
        int startPage = (totalDocCount > 0) ? ((whichResultsPage * 10) + 1) : 0;
        int end       = (whichResultsPage + 1) * 10;

        if (end > totalDocCount)
        {
            end = totalDocCount;
        }
        PagingLabel.Text = string.Format(GetLocalResourceObject("SpeedSearch_Label_PagingLabel").ToString(),
                                         startPage, end, totalDocCount);
        TotalCount.Value = totalDocCount.ToString();
    }
Exemplo n.º 3
0
 protected override void OnPreRender(EventArgs e)
 {
     if (this.Visible)
     {
         InitializeState();
         if (!string.IsNullOrEmpty(MarkUsedInfo.Value))
         {
             SetItemAsUsed();
             MarkUsedInfo.Value = string.Empty;
         }
         if (!string.IsNullOrEmpty(ReturnResultAction.Value))
         {
             ReturnResult();
             ReturnResultAction.Value = string.Empty;
             WebPortalPage page = Page as WebPortalPage;
             if (page != null)
             {
                 IPanelRefreshService refresher = page.PageWorkItem.Services.Get <IPanelRefreshService>();
                 if (refresher != null)
                 {
                     refresher.RefreshAll();
                 }
             }
         }
         if (!string.IsNullOrEmpty(currentIndex.Value))
         {
             Literal document = new Literal();
             if (currentIndex.Value.Equals("NoAccess"))
             {
                 document.Text = GetLocalResourceObject("SpeedSearch_Result_NoAccess").ToString();
             }
             else
             {
                 int index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);
                 whichResultsPage = index;
                 //SpeedSearchWebService.SpeedSearchService ss = new SpeedSearchWebService.SpeedSearchService();
                 //ss.Url = ConfigurationManager.AppSettings.Get("SpeedSearchWebService.SpeedSearchService");
                 SpeedSearchService ss  = new SpeedSearchService();
                 SpeedSearchQuery   ssq = BuildQuery();
                 ssq.DocTextItem = int.Parse(currentIndex.Value);
                 string xml = ss.DoSpeedSearch(ssq.GetAsXml());
                 Results       = SpeedSearchResults.LoadFromXml(xml);
                 document.Text = Results.Items[0].HighlightedDoc;
             }
             currentIndex.Value   = "";
             FirstPage.Visible    = true;
             PreviousPage.Visible = true;
             NextPage.Visible     = true;
             LastPage.Visible     = true;
             //SearchDocumentPanel.ContentTemplateContainer.Controls.Add(document);
         }
     }
     base.OnPreRender(e);
 }