예제 #1
0
    /*
     * /// <summary>
     * /// Gives us a query string for the sort we want
     * /// </summary>
     * /// <returns></returns>
     * private string SortDirectiveForContentQuery()
     * {
     *  switch(_sort)
     *  {
     *      case Sort.NoSort:
     *          return "";
     *      default:
     *          IwsDiagnostics.Assert(false, "Unknown flow sort");
     *          throw new Exception("Unknown flow sort");
     *  }
     * }
     */
    /// <summary>
    /// Get a page's worth of Flow listings
    /// </summary>
    /// <param name="onlineFlows"></param>
    /// <param name="pageToRequest">Page # we are requesting (1 based)</param>
    /// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
    private void ExecuteRequest_ForPage(List <SiteFlow> onlineFlows, int pageToRequest, out int totalNumberPages)
    {
        int pageSize = _onlineUrls.PageSize;
        //Create a web request, in including the users logged-in auth information in the request headers
//        var urlQuery = _onlineUrls.Url_FlowsListForUser(_onlineSession, _userIdForContentQuery, _filterToOwnedBy, pageSize, pageToRequest, SortDirectiveForContentQuery());
        var urlQuery = _onlineUrls.Url_FlowsList(_onlineSession, pageSize, pageToRequest);

        _onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
        var xmlDoc = ResourceSafe_PerformWebRequest_GetXmlDocument(urlQuery, "get flows list");

        //Get all the flow nodes
        var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
        var flows     = xmlDoc.SelectNodes("//iwsOnline:flow", nsManager);

        //Get information for each of the data sources
        foreach (XmlNode itemXml in flows)
        {
            try
            {
                var ds = new SiteFlow(itemXml);
                onlineFlows.Add(ds);
            }
            catch
            {
                AppDiagnostics.Assert(false, "Flow parse error");
                _onlineSession.StatusLog.AddError("Error parsing flow: " + itemXml.InnerXml);
            }
        } //end: foreach

        //-------------------------------------------------------------------
        //Get the updated page-count
        //-------------------------------------------------------------------
        totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
            xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
            pageSize);
    }