Ejemplo n.º 1
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();
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
    private void ReturnResult()
    {
        InitializeState();
        var index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);

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

        ssq.DocTextItem = int.Parse(currentIndex.Value) + 1000000;
        _results        = ss.DoSpeedSearch(ssq);

        _resultEntity = (EntityBase)_mEntityContextService.GetEntity();
        if (!string.IsNullOrEmpty(_childPropertyName))
        {
            var child = TypeDescriptor.GetProperties(_resultEntity.GetType())[_childPropertyName];
            _resultEntity = (EntityBase)child.GetValue(_resultEntity);
        }
        var resultProp = TypeDescriptor.GetProperties(_resultEntity.GetType())[_resultProperty];

        resultProp.SetValue(_resultEntity, _results.Items[0].HighlightedDoc);

        DialogService.CloseEventHappened(null, null);
    }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
 protected override void OnPreRender(EventArgs e)
 {
     if (Visible)
     {
         InitializeState();
         if (!string.IsNullOrEmpty(MarkUsedInfo.Value))
         {
             SetItemAsUsed();
             MarkUsedInfo.Value = string.Empty;
         }
         if (!string.IsNullOrEmpty(ReturnResultAction.Value))
         {
             ReturnResult();
             ReturnResultAction.Value = string.Empty;
             var page = Page as WebPortalPage;
             if (page != null)
             {
                 var refresher = page.PageWorkItem.Services.Get <IPanelRefreshService>();
                 if (refresher != null)
                 {
                     refresher.RefreshAll();
                 }
             }
         }
         if (!string.IsNullOrEmpty(currentIndex.Value))
         {
             var document = new Literal();
             if (currentIndex.Value.Equals("NoAccess"))
             {
                 document.Text = GetLocalResourceObject("SpeedSearch_Result_NoAccess").ToString();
             }
             else
             {
                 var index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);
                 _whichResultsPage = index;
                 var ss  = new SpeedSearchService();
                 var ssq = BuildQuery();
                 ssq.DocTextItem = int.Parse(currentIndex.Value);
                 _results        = ss.DoSpeedSearch(ssq);
                 document.Text   = _results.Items[0].HighlightedDoc;
             }
             currentIndex.Value   = "";
             FirstPage.Visible    = true;
             PreviousPage.Visible = true;
             NextPage.Visible     = true;
             LastPage.Visible     = true;
         }
     }
     base.OnPreRender(e);
 }
Ejemplo n.º 6
0
    public void ShowPage(DataSet resultSet)
    {
        // Do not display the grid if there are no results
        PagingLabel.Visible = true;
        if ((Results != null) && (Results.Items.Count == 0))
        {
            SearchResultsGrid.Visible = false;
            StatusLabel.Visible       = true;
            if (!String.IsNullOrEmpty(Results.ErrorMessage))
            {
                StatusLabel.Text    = Results.ErrorMessage;
                PagingLabel.Visible = false;
            }
            else
            {
                StatusLabel.Text = GetLocalResourceObject("SpeedSearch_Label_NoResults").ToString();
            }
        }
        else
        {
            StatusLabel.Visible       = false;
            SearchResultsGrid.Visible = true;
        }


        // Populate the DataGrid
        SearchResultsGrid.DataSource = resultSet;
        if (resultSet == null)
        {
            SearchResultsGrid.DataSource = ResultsToDataSet();
            if (Session[ClientID] != null)
            {
                Session[ClientID + "DataSet"] = SearchResultsGrid.DataSource;
            }
            else
            {
                Session[ClientID + "DataSet"] = SearchResultsGrid.DataSource;
            }
        }
        SearchResultsGrid.PageSize         = ItemsPerPage;
        SearchResultsGrid.CurrentPageIndex = whichResultsPage;
        SearchResultsGrid.VirtualItemCount = totalDocCount;
        SearchResultsGrid.DataBind();

        Results = null;
    }
 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();
 }
 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);
 }
    public void ShowPage(DataSet resultSet)
    {
        // Do not display the grid if there are no results
        PagingLabel.Visible = true;
        if ((Results != null) && (Results.Items.Count == 0))
        {
            SearchResultsGrid.Visible = false;
            StatusLabel.Visible = true;
            if (!String.IsNullOrEmpty(Results.ErrorMessage))
            {
                StatusLabel.Text = Results.ErrorMessage;
                PagingLabel.Visible = false;
            }
            else
            {
                StatusLabel.Text = GetLocalResourceObject("SpeedSearch_Label_NoResults").ToString();
            }
        }
        else
        {
            StatusLabel.Visible = false;
            SearchResultsGrid.Visible = true;
        }

        // Populate the DataGrid
        SearchResultsGrid.DataSource = resultSet;
        if (resultSet == null)
        {
            SearchResultsGrid.DataSource = ResultsToDataSet();
            Session[ClientID + "DataSet"] = SearchResultsGrid.DataSource;
        }
        SearchResultsGrid.PageSize = ItemsPerPage;
        SearchResultsGrid.CurrentPageIndex = whichResultsPage;
        SearchResultsGrid.VirtualItemCount = totalDocCount;
        SearchResultsGrid.DataBind();

        Results = null;
    }
    //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);
    }