本文整理汇总了C#中Google.Api.Ads.Dfp.Util.v201411.StatementBuilder.GetOffset方法的典型用法代码示例。如果您正苦于以下问题:C# StatementBuilder.GetOffset方法的具体用法?C# StatementBuilder.GetOffset怎么用?C# StatementBuilder.GetOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google.Api.Ads.Dfp.Util.v201411.StatementBuilder
的用法示例。
在下文中一共展示了StatementBuilder.GetOffset方法的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 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);
}
}
示例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 SuggestedAdUnitService.
SuggestedAdUnitService suggestedAdUnitService = (SuggestedAdUnitService) user.GetService(
DfpService.v201411.SuggestedAdUnitService);
// Set default for page.
SuggestedAdUnitPage page = new SuggestedAdUnitPage();
// Create a statement to get all suggested ad units.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
try {
do {
// Get suggested ad units by statement.
page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(
statementBuilder.ToStatement());
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);
}
}
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 suggested ad units. Exception says \"{0}\"",
ex.Message);
}
}
示例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 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);
}
}
示例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 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 ex) {
Console.WriteLine("Failed to get activity groups. Exception says \"{0}\"", ex.Message);
}
}
示例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 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 ex) {
Console.WriteLine("Failed to get ad unit. Exception says \"{0}\"", ex.Message);
}
}
示例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 RateCardService.
RateCardService rateCardService =
(RateCardService) user.GetService(DfpService.v201411.RateCardService);
// Create a statement to get all rate cards.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Sets default for page.
RateCardPage page = new RateCardPage();
try {
do {
// Get rate cards by statement.
page = rateCardService.getRateCardsByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (RateCard rateCard in page.results) {
Console.WriteLine("{0}) Rate card with ID = '{1}' and name '{2}' was" +
" found.", i++, rateCard.id, rateCard.name);
}
}
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 rate cards. Exception says \"{0}\"",
ex.Message);
}
}
示例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 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);
}
}
示例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 CreativeService.
CreativeService creativeService =
(CreativeService) user.GetService(DfpService.v201411.CreativeService);
// Create a statement to get all creatives.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Set default for page.
CreativePage page = new CreativePage();
try {
do {
// Get creatives by statement.
page = creativeService.getCreativesByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (Creative creative in page.results) {
Console.WriteLine("{0}) Creative with ID ='{1}', name ='{2}' and type ='{3}' " +
"was found.", i, creative.id, creative.name, creative.CreativeType);
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 all creatives. Exception says \"{0}\"", ex.Message);
}
}
示例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) {
// Get the ActivityService.
ActivityService activityService =
(ActivityService) user.GetService(DfpService.v201411.ActivityService);
int totalResultsCounter = 0;
try {
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
ActivityPage page = new ActivityPage();
do {
// Get activities by statement.
page = activityService.getActivitiesByStatement(statementBuilder.ToStatement());
// Display results.
if (page.results != null) {
foreach (Activity activity in page.results) {
Console.WriteLine("{0}) Activity with ID \"{1}\", name \"{2}\" and type \"{3}\" " +
"was found.\n", totalResultsCounter, activity.id, activity.name,
activity.type);
totalResultsCounter++;
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of results found: {0}.", totalResultsCounter);
} catch (Exception ex) {
Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", ex.Message);
}
}
示例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 ContactService.
ContactService contactService =
(ContactService) user.GetService(DfpService.v201411.ContactService);
// Create a statement to get all contacts.
StatementBuilder statementBuilder = new StatementBuilder()
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Set default for page.
ContactPage page = new ContactPage();
try {
do {
// Get contacts by statement.
page = contactService.getContactsByStatement(statementBuilder.ToStatement());
if (page.results != null) {
int i = page.startIndex;
foreach (Contact contact in page.results) {
Console.WriteLine("{0}) Contact with ID \"{1}\" and name \"{2}\" was found.",
i, contact.id, contact.name);
i++;
}
}
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 contacts. Exception says \"{0}\"", ex.Message);
}
}
示例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 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);
}
}
示例12: 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 UserService.
UserService userService = (UserService) user.GetService(DfpService.v201411.UserService);
// Create a statement to get all active users sorted by name.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("status = :status")
.OrderBy("name ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("status", "ACTIVE");
// Set default for page.
UserPage page = new UserPage();
try {
do {
// Get users by statement.
page = userService.getUsersByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (User usr in page.results) {
Console.WriteLine("{0}) User with ID = '{1}', email = '{2}', and role = '{3}'" +
" was found.", i, usr.id, usr.email, usr.roleName);
}
}
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 user by ID. Exception says \"{0}\"",
ex.Message);
}
}
示例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) {
// Create the CreativeWrapperService.
CreativeWrapperService creativeWrapperService = (CreativeWrapperService) user.GetService(
DfpService.v201411.CreativeWrapperService);
long labelId = long.Parse(_T("INSERT_CREATIVE_WRAPPER_LABEL_ID_HERE"));
try {
// Create a query to select the active creative wrapper for the given
// label.
StatementBuilder statementBuilder = new StatementBuilder()
.Where ("labelId = :labelId AND status = :status")
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("status", CreativeWrapperStatus.ACTIVE.ToString())
.AddValue("labelId", labelId);
// Set default for page.
CreativeWrapperPage page = new CreativeWrapperPage();
do {
page =
creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.ToStatement());
CreativeWrapper[] creativeWrappers = page.results;
if (creativeWrappers != null) {
foreach (CreativeWrapper wrapper in creativeWrappers) {
Console.WriteLine("Creative wrapper with ID \'{0}\' applying to label \'{1}\' with " +
"status \'{2}\' will be deactivated.", wrapper.id, wrapper.labelId,
wrapper.status);
}
}
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.GetOffset() < page.totalResultSetSize);
Console.WriteLine("Number of creative wrappers to be deactivated: {0}",
page.totalResultSetSize);
// Modify statement for action.
statementBuilder.RemoveLimitAndOffset();
// Perform action.
CreativeWrapperAction action = new DeactivateCreativeWrappers();
UpdateResult result = creativeWrapperService.performCreativeWrapperAction(action,
statementBuilder.ToStatement());
// Display results.
if (result.numChanges > 0) {
Console.WriteLine("Number of creative wrappers deactivated: {0}", result.numChanges);
} else {
Console.WriteLine("No creative wrappers were deactivated.");
}
} catch (Exception ex) {
Console.WriteLine("Failed to create creative wrappers. Exception says \"{0}\"", ex.Message);
}
}
示例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 ProductService.
ProductService productService =
(ProductService) user.GetService(DfpService.v201411.ProductService);
// Set the ID of the product template to filter products by.
long productTemplateId = long.Parse(_T("INSERT_PRODUCT_TEMPLATE_ID_HERE"));
// Create a statement to only select products that were created from a specific
// product template.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("WHERE productTemplateId = :productTemplateId")
.OrderBy("name ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("productTemplateId", productTemplateId);
// Set default for page.
ProductPage page = new ProductPage();
try {
do {
// Get products by statement.
page = productService.getProductsByStatement(statementBuilder.ToStatement());
if (page.results != null && page.results.Length > 0) {
int i = page.startIndex;
foreach (Product product in page.results) {
Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.",
i++, product.id, product.name);
}
}
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 products. Exception says \"{0}\"",
ex.Message);
}
}
示例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) {
// Create the CreativeWrapperService.
CreativeWrapperService creativeWrapperService = (CreativeWrapperService) user.GetService(
DfpService.v201411.CreativeWrapperService);
// Create a statement to get all active creative wrappers.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("status = :status")
.OrderBy("id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.AddValue("status", CreativeWrapperStatus.ACTIVE.ToString());
// Set default for page.
CreativeWrapperPage page = new CreativeWrapperPage();
try {
do {
// Get creative wrappers by statement.
page = creativeWrapperService.getCreativeWrappersByStatement(
statementBuilder.ToStatement());
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++;
}
}
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 active creative wrappers. Exception says \"{0}\"",
ex.Message);
}
}