当前位置: 首页>>代码示例>>C#>>正文


C# v201411.StatementBuilder类代码示例

本文整理汇总了C#中Google.Api.Ads.Dfp.Util.v201411.StatementBuilder的典型用法代码示例。如果您正苦于以下问题:C# StatementBuilder类的具体用法?C# StatementBuilder怎么用?C# StatementBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StatementBuilder类属于Google.Api.Ads.Dfp.Util.v201411命名空间,在下文中一共展示了StatementBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the InventoryService.
      InventoryService inventoryService =
          (InventoryService) user.GetService(DfpService.v201411.InventoryService);

      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("targetPlatform = :targetPlatform")
          .AddValue("targetPlatform", "WEB");

      try {
        // Get all ad unit sizes.
        AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(
            statementBuilder.ToStatement());

        // Display results.
        if (adUnitSizes != null) {
          for (int i = 0; i < adUnitSizes.Length; i++) {
            AdUnitSize adUnitSize = adUnitSizes[i];
            Console.WriteLine("{0}) Ad unit size ({1}x{2}) was found.\n", i,
                adUnitSize.size.width, adUnitSize.size.height);
          }
        } else {
          Console.WriteLine("No ad unit sizes found.");
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to get ad unit sizes. Exception says \"{0}\"", ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:32,代码来源:GetAdUnitSizes.cs

示例2: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the CompanyService.
      CompanyService companyService =
          (CompanyService) user.GetService(DfpService.v201411.CompanyService);

      // Set the ID of the company to update.
      int companyId = int.Parse(_T("INSERT_COMPANY_ID_HERE"));

      // Create a statement to select the company by ID.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("id = :companyId")
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
          .AddValue("id", companyId);

      try {
        // Get the companies by statement.
        CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());

        Company company = page.results[0];

        // Update the company comment
        company.comment = company.comment + " Updated.";

        // Update the company on the server.
        Company[] companies = companyService.updateCompanies(new Company[] {company});

        foreach (Company updatedCompany in companies) {
          Console.WriteLine("Company with ID = {0}, name = {1}, and comment \"{2}\" was updated",
              updatedCompany.id, updatedCompany.name, updatedCompany.comment);
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to update companies. Exception says \"{0}\"", ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:UpdateCompanies.cs

示例3: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the ActivityService.
              ActivityService activityService =
              (ActivityService) user.GetService(DfpService.v201411.ActivityService);

              // Set the ID of the activity to update.
              int activityId = int.Parse(_T("INSERT_ACTIVITY_ID_HERE"));

              try {
            // Get the activity.
            StatementBuilder statemetnBuilder = new StatementBuilder()
            .Where("id = :id")
            .OrderBy("id ASC")
            .Limit(1)
            .AddValue("id", activityId);

            ActivityPage page = activityService.getActivitiesByStatement(
            statemetnBuilder.ToStatement());
            Activity activity = page.results[0];

            // Update the expected URL.
            activity.expectedURL = "https://www.google.com";

            // Update the activity on the server.
            Activity[] activities = activityService.updateActivities(new Activity[] {activity});

            foreach (Activity updatedActivity in activities) {
              Console.WriteLine("Activity with ID \"{0}\" and name \"{1}\" was updated.",
              updatedActivity.id, updatedActivity.name);
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to update activities. Exception says \"{0}\"", e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:UpdateActivities.cs

示例4: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the PlacementService.
              PlacementService placementService =
              (PlacementService) user.GetService(DfpService.v201411.PlacementService);

              // Create statement to select active placements.
              StatementBuilder statementBuilder = new StatementBuilder()
              .Where("status = :status")
              .OrderBy("id ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .AddValue("status", InventoryStatus.ACTIVE.ToString());

              // Sets default for page.
              PlacementPage page = new PlacementPage();
              List<string> placementIds = new List<string>();

              try {
            do {
              // Get placements by statement.
              page = placementService.getPlacementsByStatement(statementBuilder.ToStatement());

              if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Placement placement in page.results) {
              Console.WriteLine("{0}) Placement with ID ='{1}', name ='{2}', and status ='{3}'" +
                  " will be deactivated.", i, placement.id, placement.name, placement.status);
              placementIds.Add(placement.id.ToString());
              i++;
            }
              }

              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while (statementBuilder.GetOffset() < page.totalResultSetSize);

            Console.WriteLine("Number of placements to be deactivated: {0}", placementIds.Count);

            if (placementIds.Count > 0) {
              // Modify statement for action.
              statementBuilder.RemoveLimitAndOffset();

              // Create action.
              DeactivatePlacements action = new DeactivatePlacements();

              // Perform action.
              UpdateResult result = placementService.performPlacementAction(action,
              statementBuilder.ToStatement());

              // Display results.
              if (result != null && result.numChanges > 0) {
            Console.WriteLine("Number of placements deactivated: {0}", result.numChanges);
              } else {
            Console.WriteLine("No placements were deactivated.");
              }
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to deactivate placements. Exception says \"{0}\"",
            e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:64,代码来源:DeactivatePlacement.cs

示例5: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the PublisherQueryLanguageService.
              PublisherQueryLanguageService pqlService =
              (PublisherQueryLanguageService) user.GetService(
              DfpService.v201411.PublisherQueryLanguageService);

              try {
            StatementBuilder lineItemStatementBuilder = new StatementBuilder()
            .Select("Id, Name, Status")
            .From("Line_Item")
            .OrderBy("Id ASC")
            .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            string lineItemFilePath = "Line-Item-Matchtable.csv";
            fetchMatchTables(pqlService, lineItemStatementBuilder, lineItemFilePath);

            StatementBuilder adUnitStatementBuilder = new StatementBuilder()
            .Select("Id, Name")
            .From("Ad_Unit")
            .OrderBy("Id ASC")
            .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            string adUnitFilePath = "Ad-Unit-Matchtable.csv";
            fetchMatchTables(pqlService, adUnitStatementBuilder, adUnitFilePath);

            Console.WriteLine("Ad units saved to %s", adUnitFilePath);
            Console.WriteLine("Line items saved to %s\n", lineItemFilePath);
              } catch (Exception e) {
            Console.WriteLine("Failed to get match tables. Exception says \"{0}\"", e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:34,代码来源:FetchMatchTables.cs

示例6: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the CompanyService.
      CompanyService companyService =
          (CompanyService) user.GetService(DfpService.v201411.CompanyService);

      // Set defaults for page and statement.
      CompanyPage page = new CompanyPage();
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      try {
        do {
          // Get companies by statement.
          page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Company company in page.results) {
              Console.WriteLine("{0}) Company with ID = {1}, name = {2} and type = {3} was found",
                  i, company.id, company.name, company.type);
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get companies. Exception says \"{0}\"", ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:36,代码来源:GetAllCompanies.cs

示例7: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the ActivityGroupService.
              ActivityGroupService activityGroupService =
              (ActivityGroupService) user.GetService(DfpService.v201411.ActivityGroupService);

              ActivityGroupPage page;
              StatementBuilder statementBuilder = new StatementBuilder()
              .OrderBy("id ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

              try {
            do {
              // Get activity groups by statement.
              page = activityGroupService.getActivityGroupsByStatement(statementBuilder.ToStatement());

              // Display results.
              if (page.results != null) {
            int i = page.startIndex;

            foreach (ActivityGroup activityGroup in page.results) {
              Console.WriteLine("{0}) Activity group with ID \"{1}\" and name \"{2}\" was " +
                  "found.", i, activityGroup.id, activityGroup.name);
              i++;
            }
              }

              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while (statementBuilder.GetOffset() < page.totalResultSetSize);

            Console.WriteLine("Number of results found: " + page.totalResultSetSize);
              } catch (Exception e) {
            Console.WriteLine("Failed to get activity groups. Exception says \"{0}\"", e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetAllActivityGroups.cs

示例8: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the SuggestedAdUnitService.
              SuggestedAdUnitService suggestedAdUnitService = (SuggestedAdUnitService) user.GetService(
              DfpService.v201411.SuggestedAdUnitService);

              // Set the number of requests for suggested ad units greater than which to approve.
              long NUMBER_OF_REQUESTS = 50L;

              // Create statement to select all suggested ad units that are highly requested.
              StatementBuilder statementBuilder = new StatementBuilder()
              .Where("numRequests > :numRequests")
              .OrderBy("id ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .AddValue("numRequests", NUMBER_OF_REQUESTS);

              // Set default for page.
              SuggestedAdUnitPage page = new SuggestedAdUnitPage();

              try {
            do {
              // Get suggested ad units by statement.
              page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(
              statementBuilder.ToStatement());

              int i = 0;
              if (page != null && page.results != null) {
            foreach (SuggestedAdUnit suggestedAdUnit in page.results) {
              Console.WriteLine("{0}) Suggested ad unit with ID \"{1}\", and \"{2}\" will be " +
                  "approved.", i, suggestedAdUnit.id, suggestedAdUnit.numRequests);
              i++;
            }
              }
              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while(statementBuilder.GetOffset() < page.totalResultSetSize);

            Console.WriteLine("Number of suggested ad units to be approved: " +
            page.totalResultSetSize);

            // Modify statement for action.
            statementBuilder.RemoveLimitAndOffset();

            // Create action.
            ApproveSuggestedAdUnit action = new ApproveSuggestedAdUnit();

            // Perform action.
            SuggestedAdUnitUpdateResult result = suggestedAdUnitService.performSuggestedAdUnitAction(
            action, statementBuilder.ToStatement());

            // Display results.
            if (result != null && result.numChanges > 0) {
              Console.WriteLine("Number of new ad units created: " + result.newAdUnitIds.Length);
            } else {
              Console.WriteLine("No suggested ad units were approved.");
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to approve suggested ad units. Exception says \"{0}\"",
            e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:64,代码来源:ApproveSuggestedAdUnits.cs

示例9: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Create the CreativeWrapperService.
      CreativeWrapperService creativeWrapperService = (CreativeWrapperService) user.GetService(
          DfpService.v201411.CreativeWrapperService);

      long creativeWrapperId = long.Parse(_T("INSERT_CREATIVE_WRAPPER_ID_HERE"));

      try {
        StatementBuilder statementBuilder = new StatementBuilder()
            .Where("id = :id")
            .OrderBy("id ASC")
            .Limit(1)
            .AddValue("id", creativeWrapperId);
        CreativeWrapperPage page = creativeWrapperService.getCreativeWrappersByStatement(
            statementBuilder.ToStatement());
        CreativeWrapper wrapper = page.results[0];

        wrapper.ordering = CreativeWrapperOrdering.OUTER;
        // Update the creative wrappers on the server.
        CreativeWrapper[] creativeWrappers = creativeWrapperService.updateCreativeWrappers(
            new CreativeWrapper[] {wrapper});

        // Display results.
        foreach (CreativeWrapper createdCreativeWrapper in creativeWrappers) {
          Console.WriteLine("Creative wrapper with ID '{0}' and wrapping order '{1}' was " +
              "updated.", createdCreativeWrapper.id, createdCreativeWrapper.ordering);
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to update creative wrappers. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:36,代码来源:UpdateCreativeWrappers.cs

示例10: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the BaseRateService.
      BaseRateService baseRateService =
          (BaseRateService) user.GetService(DfpService.v201411.BaseRateService);

      // Create a statement to get all base rates.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Sets default for page.
      BaseRatePage page = new BaseRatePage();
      try {
        do {
          // Get base rates by statement.
          page = baseRateService.getBaseRatesByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (BaseRate baseRate in page.results) {
              Console.WriteLine("{0}) Base rate with ID ='{1}' and type '{2}' belonging to rate " +
                  "card '{3}' was found.", i++, baseRate.id, baseRate.BaseRateType,
                  baseRate.rateCardId);
            }
          }

          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get base rates. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetAllBaseRates.cs

示例11: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the CompanyService.
      CompanyService companyService =
          (CompanyService) user.GetService(DfpService.v201411.CompanyService);

      // Create a statement to only select companies that are advertisers sorted
      // by name.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("type = :advertiser")
          .OrderBy("name ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
          .AddValue("advertiser", CompanyType.ADVERTISER.ToString());

      CompanyPage page = new CompanyPage();

      try {
        do {
          // Get companies by statement.
          page = companyService.getCompaniesByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Company company in page.results) {
              Console.WriteLine("{0}) Company with ID = {1}, name = {2} and type = {3} was found",
                  i, company.id, company.name, company.type);
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);
        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get companies. Exception says \"{0}\"", ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetCompaniesByStatement.cs

示例12: Run

    /// <summary>
    /// Run the sample code.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the InventoryService.
      InventoryService inventoryService =
          (InventoryService) user.GetService(DfpService.v201411.InventoryService);

      // Set the ID of the ad unit to update.
      int adUnitId = int.Parse(_T("INSERT_AD_UNIT_ID_HERE"));

      // Create a statement to get the ad unit.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("id = :id")
          .OrderBy("id ASC")
          .Limit(1)
          .AddValue("id", adUnitId);

      try {
        // Get ad units by statement.
        AdUnitPage page = inventoryService.getAdUnitsByStatement(statementBuilder.ToStatement());

        AdUnit adUnit = page.results[0];
        adUnit.inheritedAdSenseSettings.value.adSenseEnabled = true;

        // Update the ad units on the server.
        AdUnit[] updatedAdUnits = inventoryService.updateAdUnits(new AdUnit[] {adUnit});

        foreach (AdUnit updatedAdUnit in updatedAdUnits) {
          Console.WriteLine("Ad unit with ID \"{0}\", name \"{1}\", and is AdSense enabled " +
              "\"{2}\" was updated.", updatedAdUnit.id, updatedAdUnit.name,
              updatedAdUnit.inheritedAdSenseSettings.value.adSenseEnabled);
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to update ad units. Exception says \"{0}\"", ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:UpdateAdUnits.cs

示例13: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the TeamService.
              TeamService teamService = (TeamService) user.GetService(DfpService.v201411.TeamService);

              // Create a statement to order teams by name.
              StatementBuilder statementBuilder = new StatementBuilder()
              .OrderBy("name ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

              // Set default for page.
              TeamPage page = new TeamPage();

              try {
            do {
              // Get teams by statement.
              page = teamService.getTeamsByStatement(statementBuilder.ToStatement());

              // Display results.
              if (page.results != null) {
            int i = page.startIndex;
            foreach (Team team in page.results) {
              Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.",
                  i, team.id, team.name);
              i++;
            }
              }

              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while(statementBuilder.GetOffset() < page.totalResultSetSize);
              Console.WriteLine("Number of results found: " + page.totalResultSetSize);
              } catch (Exception e) {
            Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetTeamsByStatement.cs

示例14: Run

        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the InventoryService.
              InventoryService inventoryService =
              (InventoryService) user.GetService(DfpService.v201411.InventoryService);

              // Create a statement to get all ad units.
              StatementBuilder statementBuilder = new StatementBuilder()
              .OrderBy("id ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

              // Set default for page.
              AdUnitPage page = new AdUnitPage();

              try {
            do {
              // Get ad units by statement.
              page = inventoryService.getAdUnitsByStatement(statementBuilder.ToStatement());

              if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (AdUnit adUnit in page.results) {
              Console.WriteLine("{0}) Ad unit with ID = '{1}', name = '{2}' and status = '{3}' " +
                  "was found.", i, adUnit.id, adUnit.name, adUnit.status);
              i++;
            }
              }
              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while (statementBuilder.GetOffset() < page.totalResultSetSize);

            Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
              } catch (Exception e) {
            Console.WriteLine("Failed to get ad unit. Exception says \"{0}\"", e.Message);
              }
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetAllAdUnits.cs

示例15: Run

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ProposalService.
      ProposalService proposalService =
          (ProposalService) user.GetService(DfpService.v201411.ProposalService);

      // Create a statement to only select proposals that are pending approval.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("status = :status")
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
          .AddValue("status", ProposalStatus.PENDING_APPROVAL.ToString());

      // Set default for page.
      ProposalPage page = new ProposalPage();

      try {
        do {
          // Get proposals by statement.
          page = proposalService.getProposalsByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Proposal proposal in page.results) {
              Console.WriteLine("{0}) Proposal with ID = '{1}', name = '{2}' was found.",
                  i++, proposal.id, proposal.name);
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while(statementBuilder.GetOffset() < page.totalResultSetSize);
        Console.WriteLine("Number of results found: " + page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get proposals. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:everlive,项目名称:googleads-dotnet-lib,代码行数:39,代码来源:GetAllProposalsPendingApproval.cs


注:本文中的Google.Api.Ads.Dfp.Util.v201411.StatementBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。