• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# v201408.Statement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Statement类属于Google.Api.Ads.Dfp.v201408命名空间,在下文中一共展示了Statement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 SuggestedAdUnitService.
      SuggestedAdUnitService suggestedAdUnitService = (SuggestedAdUnitService) user.GetService(
          DfpService.v201408.SuggestedAdUnitService);

      // Set defaults for page and filterStatement.
      SuggestedAdUnitPage page = new SuggestedAdUnitPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      try {
        do {
          // Create a statement to get all suggested ad units.
          filterStatement.query = "LIMIT 500 OFFSET " + offset;

          // Get suggested ad units by statement.
          page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);

          if (page.results != null) {
            int i = page.startIndex;
            foreach (SuggestedAdUnit suggestedAdUnit in page.results) {
              Console.WriteLine("{0}) Suggested ad unit with ID \"{1}\", and number of requests " +
                  "\"{2}\" was found.", i, suggestedAdUnit.id, suggestedAdUnit.numRequests);
              i++;
            }
          }
          offset += 500;
        } while (offset < page.totalResultSetSize);

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


示例2: TestAllStatementBuilderPartialFunctions

        public void TestAllStatementBuilderPartialFunctions()
        {
            StatementBuilder statementBuilder = new StatementBuilder()
              .Select("Name, Id")
              .From("Geo_Target")
              .Where("Targetable = :targetable")
              .OrderBy("Id DESC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .Offset(0)
              .AddValue("targetable", true)
              .IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .RemoveLimitAndOffset();
              Assert.AreEqual(null, statementBuilder.GetOffset());

              Statement expectedStatement = new Statement();
              expectedStatement.query = "SELECT Name, Id FROM Geo_Target"
              + " WHERE Targetable = :targetable ORDER BY Id DESC";
              String_ValueMapEntry targetableEntry = new String_ValueMapEntry();
              targetableEntry.key = "targetable";
              BooleanValue targetableValue = new BooleanValue();
              targetableValue.value = true;
              targetableEntry.value = targetableValue;
              expectedStatement.values = new String_ValueMapEntry[] {targetableEntry};
              Assert.True(StatementsAreEqual(expectedStatement, statementBuilder.ToStatement()));
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:25,代码来源:StatementBuilderTests.cs


示例3: TestStatementBuilderBasicStatement

        public void TestStatementBuilderBasicStatement()
        {
            StatementBuilder statementBuilder = new StatementBuilder()
              .Where("ID = 1");

              Statement expectedStatement = new Statement();
              expectedStatement.query = "WHERE ID = 1";
              expectedStatement.values = new String_ValueMapEntry[0];

              Assert.True(StatementsAreEqual(expectedStatement,
                                     statementBuilder.ToStatement()));
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:12,代码来源:StatementBuilderTests.cs


示例4: GetUserByEmail

    public User GetUserByEmail(DfpUser user, string email) {
      UserService userService = (UserService) user.GetService(DfpService.v201408.UserService);

      // Create a Statement to get all users sorted by name.
      Statement statement = new Statement();
      statement.query = string.Format("where email = '{0}' LIMIT 1", email);

      UserPage page = userService.getUsersByStatement(statement);

      if (page.results != null && page.results.Length > 0) {
        return page.results[0];
      } else {
        return null;
      }
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:15,代码来源:TestUtils.cs


示例5: StatementsAreEqual

 private static bool StatementsAreEqual(Statement s1, Statement s2) {
   // Assumes both Statements are non-null and have non-null properties
   if (String.Compare(s1.query, s2.query, true) != 0) {
     return false;
   }
   if (s1.values.Length != s2.values.Length) {
     return false;
   }
   // Assumes Statement values are in the same order
   for (int i = 0; i < s1.values.Length; i++) {
     if (!StringValueMapEntriesAreEqual(s1.values[i], s2.values[i])) {
       return false;
     }
   }
   return true;
 }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:16,代码来源:StatementBuilderTests.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 PlacementService.
      PlacementService placementService =
          (PlacementService) user.GetService(DfpService.v201408.PlacementService);

      // Create a statement to select first 500 placements.
      Statement filterStatement = new Statement();
      filterStatement.query = "LIMIT 500";

      try {
        // Get placements by statement.
        PlacementPage page = placementService.getPlacementsByStatement(filterStatement);

        if (page.results != null) {
          Placement[] placements = page.results;

          // Update each local placement object by enabling AdSense targeting.
          foreach (Placement placement in placements) {
            placement.targetingDescription = (string.IsNullOrEmpty(placement.description))?
                "Generic description" : placement.description;
            placement.targetingAdLocation = "All images on sports pages.";
            placement.targetingSiteName = "http://code.google.com";
            placement.isAdSenseTargetingEnabled = true;
          }

          // Update the placements on the server.
          placements = placementService.updatePlacements(placements);

          // Display results.
          if (placements != null) {
            foreach (Placement placement in placements) {
              Console.WriteLine("A placement with ID \"{0}\", name \"{1}\", and AdSense targeting" +
                  " enabled \"{2}\" was updated.", placement.id, placement.name,
                  placement.isAdSenseTargetingEnabled);
            }
          } else {
            Console.WriteLine("No placements updated.");
          }
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to update placements. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:48,代码来源:UpdatePlacements.cs


示例7: Run

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

      // Set defaults for page and filterStatement.
      UserTeamAssociationPage page = new UserTeamAssociationPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      try {
        do {
          // Create a statement to get all user team associations.
          filterStatement.query = "LIMIT 500 OFFSET " + offset;

          // Get user team associations by statement.
          page = userTeamAssociationService.getUserTeamAssociationsByStatement(filterStatement);

          if (page.results != null) {
            int i = page.startIndex;
            foreach (UserTeamAssociation userTeamAssociation in page.results) {
              Console.WriteLine("{0}) User team association between user with ID \"{1}\" and " +
                  "team with ID \"{2}\" was found.", i, userTeamAssociation.userId,
                  userTeamAssociation.teamId);
              i++;
            }
          }

          offset += 500;
        } while (offset < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}." + page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get user team associations. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:41,代码来源:GetAllUserTeamAssociations.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 PlacementService.
      PlacementService placementService =
          (PlacementService) user.GetService(DfpService.v201408.PlacementService);

      // Sets defaults for page and Statement.
      PlacementPage page = new PlacementPage();
      Statement statement = new Statement();
      int offset = 0;

      try {
        do {
          // Create a Statement to get all ad units.
          statement.query = string.Format("LIMIT 500 OFFSET {0}", offset);

          // Get ad units by Statement.
          page = placementService.getPlacementsByStatement(statement);

          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}' and name = '{2}' was found.",
                  i, placement.id, placement.name);
              i++;
            }
          }

          offset += 500;
        } while (offset < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}" + page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get all placements. Exception says \"{0}\"",
            ex.Message);
      }
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:40,代码来源:GetAllPlacements.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.v201408.CreativeWrapperService);

      // Set defaults for page and Statement.
      CreativeWrapperPage page = new CreativeWrapperPage();
      Statement statement = new Statement();
      int offset = 0;

      try {
        do {
          // Create a Statement to get all creative wrappers.
          statement.query = string.Format("LIMIT 500 OFFSET {0}", offset);

          // Get creative wrappers by Statement.
          page = creativeWrapperService.getCreativeWrappersByStatement(statement);

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (CreativeWrapper wrapper in page.results) {
              Console.WriteLine("Creative wrapper with ID \'{0}\' applying to label \'{1}\' with " +
                "status \'{2}\' was found.", wrapper.id, wrapper.labelId, wrapper.status);
              i++;
            }
          }

          offset += 500;
        } while (offset < page.totalResultSetSize);

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


示例10: TestUpdateUsers

    public void TestUpdateUsers() {
      Statement statement = new Statement();
      statement.query = String.Format("WHERE id = {0} LIMIT 1", salespersonId);
      User user = userService.getUsersByStatement(statement).results[0];
      user.preferredLocale = (user.preferredLocale == "fr_FR")? "en_US" : "fr_FR";

      User[] newUsers = null;

      Assert.DoesNotThrow(delegate() {
        newUsers = userService.updateUsers(new User[] {user});
      });

      Assert.NotNull(newUsers);
      Assert.AreEqual(newUsers.Length, 1);
      Assert.AreEqual(newUsers[0].id, user.id);
      Assert.AreEqual(newUsers[0].preferredLocale, user.preferredLocale);
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:17,代码来源:UserServiceTests.cs


示例11: getCreativeTemplatesByStatement

 public virtual CreativeTemplatePage getCreativeTemplatesByStatement(Statement filterStatement) {
   object[] results = this.Invoke("getCreativeTemplatesByStatement", new object[] { filterStatement });
   return ((CreativeTemplatePage) (results[0]));
 }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:4,代码来源:DfpApi.cs


示例12: TestGetUsersByStatement

    public void TestGetUsersByStatement() {
      Statement statement = new Statement();
      statement.query = "ORDER BY name LIMIT 500";

      UserPage page = null;

      Assert.DoesNotThrow(delegate() {
        page = userService.getUsersByStatement(statement);
      });

      Assert.NotNull(page);
      Assert.NotNull(page.results);

      List<long> salesPersonIds = new List<long>();
      List<long> traffickerIds = new List<long>();

      foreach(User tempUser in page.results) {
        if (tempUser.roleName == "Salesperson") {
          salesPersonIds.Add(tempUser.id);
        } else if (tempUser.roleName == "Trafficker") {
          traffickerIds.Add(tempUser.id);
        }
      }
      Assert.Contains(salespersonId, salesPersonIds);
      Assert.Contains(traffickerId, traffickerIds);
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:26,代码来源:UserServiceTests.cs


示例13: TestPerformUserAction

    public void TestPerformUserAction() {
      Statement statement = new Statement();
      statement.query = string.Format("WHERE id = {0}", salespersonId);

      DeactivateUsers action = new DeactivateUsers();

      UpdateResult result = null;

      Assert.DoesNotThrow(delegate() {
        result = userService.performUserAction(action, statement);
      });

      Assert.NotNull(result);
      Assert.AreEqual(result.numChanges, 1);

      // Activate the user again.

      Assert.DoesNotThrow(delegate() {
        result = userService.performUserAction(new ActivateUsers(), statement);
      });

      Assert.NotNull(result);
      Assert.AreEqual(result.numChanges, 1);
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:24,代码来源:UserServiceTests.cs


示例14: FindRootAdUnit

    public AdUnit FindRootAdUnit(DfpUser user) {
      // Get InventoryService.
      InventoryService inventoryService =
          (InventoryService)user.GetService(DfpService.v201408.InventoryService);

      // Create a Statement to only select the root ad unit.
      Statement statement = new Statement();
      statement.query = "WHERE parentId IS NULL LIMIT 500";

      // Get ad units by Statement.
      AdUnitPage page = inventoryService.getAdUnitsByStatement(statement);
      return page.results[0];
    }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:13,代码来源:TestUtils.cs


示例15: getAdRulesByStatement

 public virtual AdRulePage getAdRulesByStatement(Statement statement) {
   object[] results = this.Invoke("getAdRulesByStatement", new object[] { statement });
   return ((AdRulePage) (results[0]));
 }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:4,代码来源:DfpApi.cs


示例16: TestGetLineItemCreativeAssociationsByStatement

        public void TestGetLineItemCreativeAssociationsByStatement()
        {
            Statement statement = new Statement();
              statement.query = string.Format("WHERE lineItemId = '{0}' LIMIT 500", lineItemId3);

              LineItemCreativeAssociationPage page = null;
              Assert.DoesNotThrow(delegate() {
            page = licaService.getLineItemCreativeAssociationsByStatement(statement);
              });
              Assert.NotNull(page);
              Assert.NotNull(page.results);
              Assert.AreEqual(page.totalResultSetSize, 1);

              Assert.NotNull(page.results[0]);
              Assert.AreEqual(page.results[0].creativeId, lica1.creativeId);
              Assert.AreEqual(page.results[0].lineItemId, lica1.lineItemId);
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:17,代码来源:LineItemCreativeAssociationServiceTests.cs


示例17: performAdRuleAction

 public virtual UpdateResult performAdRuleAction(AdRuleAction adRuleAction, Statement filterStatement) {
   object[] results = this.Invoke("performAdRuleAction", new object[] { adRuleAction, filterStatement });
   return ((UpdateResult) (results[0]));
 }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:4,代码来源:DfpApi.cs


示例18: TestPerformLineItemAction

        public void TestPerformLineItemAction()
        {
            Statement statement = new Statement();
              statement.query = string.Format("WHERE orderId = '{0}' and status = '{1}'",
              orderId, ComputedStatus.NEEDS_CREATIVES);

              ActivateLineItems action = new ActivateLineItems();
              UpdateResult result = null;

              Assert.DoesNotThrow(delegate() {
            result = lineItemService.performLineItemAction(action, statement);
              });

              Assert.NotNull(result);
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:15,代码来源:LineItemServiceTests.cs


示例19: getLineItemsByStatement

 public virtual LineItemPage getLineItemsByStatement(Statement filterStatement) {
   object[] results = this.Invoke("getLineItemsByStatement", new object[] { filterStatement });
   return ((LineItemPage) (results[0]));
 }
开发者ID:psmacchia,项目名称:googleads-dotnet-lib,代码行数:4,代码来源:DfpApi.cs


示例20: TestGetPlacementsByStatement

        public void TestGetPlacementsByStatement()
        {
            // Create a Statement to only select active placements.
              Statement statement = new Statement();
              statement.query = string.Format("WHERE id = '{0}'", placement.id);

              PlacementPage page = null;

              Assert.DoesNotThrow(delegate() {
            page = placementService.getPlacementsByStatement(statement);
              });

              Assert.NotNull(page);
              Assert.NotNull(page.results);
              Assert.AreEqual(page.results.Length, 1);

              Assert.AreEqual(page.results[0].id, placement.id);
              Assert.AreEqual(page.results[0].name, placement.name);
              Assert.AreEqual(page.results[0].description, placement.description);
              Assert.Contains(adUnit1.id, page.results[0].targetedAdUnitIds);
              Assert.Contains(adUnit2.id, page.results[0].targetedAdUnitIds);
        }
开发者ID:nathanlowy,项目名称:googleads-dotnet-lib,代码行数:22,代码来源:PlacementServiceTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Calendar.CalendarService类代码示例发布时间:2022-05-26
下一篇:
C# v201405.Statement类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap