コード例 #1
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="businessId">The AdWords Express business id.</param>
        public void Run(AdWordsUser user, long businessId)
        {
            // Get the PromotionService.
            PromotionService promotionService = (PromotionService)
                                                user.GetService(AdWordsService.v201402.PromotionService);

            // Set the business ID to the service.
            promotionService.RequestHeader.expressBusinessId = businessId;

            Selector selector = new Selector();

            selector.fields = new String[] { "PromotionId", "Name", "Status", "DestinationUrl",
                                             "StreetAddressVisible", "CallTrackingEnabled", "ContentNetworkOptedOut", "Budget",
                                             "PromotionCriteria", "RemainingBudget", "Creatives", "CampaignIds" };

            // Set the selector paging.
            selector.paging = new Paging();

            int offset   = 0;
            int pageSize = 500;

            PromotionPage page = null;

            try {
                do
                {
                    selector.paging.startIndex    = offset;
                    selector.paging.numberResults = pageSize;

                    // Get all promotions for the  business.
                    page = promotionService.get(selector);

                    // Display the results.
                    if (page != null && page.entries != null)
                    {
                        int i = offset;
                        foreach (Promotion promotion in page.entries)
                        {
                            // Summary.
                            Console.WriteLine("0) Express promotion with name = {1} and id = {2} was found.",
                                              i + 1, promotion.id, promotion.name);
                            i++;
                        }
                    }
                    offset += pageSize;
                } while (offset < page.totalNumEntries);
                Console.WriteLine("Number of promotions found: {0}", page.totalNumEntries);
            } catch (Exception ex) {
                throw new System.ApplicationException("Failed to retrieve promotions.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="businessId">The AdWords Express business id.</param>
        public void Run(AdWordsUser user, long businessId)
        {
            // Get the PromotionService.
            PromotionService promotionService = (PromotionService)
                                                user.GetService(AdWordsService.v201506.PromotionService);

            // Set the business ID to the service.
            promotionService.RequestHeader.expressBusinessId = businessId;

            Selector selector = new Selector()
            {
                fields = new String[] {
                    Promotion.Fields.PromotionId, Promotion.Fields.Name, Promotion.Fields.Status,
                    Promotion.Fields.DestinationUrl, Promotion.Fields.CallTrackingEnabled,
                    Promotion.Fields.Budget, Promotion.Fields.PromotionCriteria,
                    Promotion.Fields.RemainingBudget, Promotion.Fields.Creatives,
                    Promotion.Fields.CampaignIds
                },
                paging = Paging.Default
            };

            PromotionPage page = null;

            try {
                do
                {
                    // Get all promotions for the  business.
                    page = promotionService.get(selector);

                    // Display the results.
                    if (page != null && page.entries != null)
                    {
                        int i = selector.paging.startIndex;
                        foreach (Promotion promotion in page.entries)
                        {
                            // Summary.
                            Console.WriteLine("0) Express promotion with name = {1} and id = {2} was found.",
                                              i + 1, promotion.id, promotion.name);
                            i++;
                        }
                    }
                    selector.paging.IncreaseOffset();
                } while (selector.paging.startIndex < page.totalNumEntries);
                Console.WriteLine("Number of promotions found: {0}", page.totalNumEntries);
            } catch (Exception e) {
                throw new System.ApplicationException("Failed to retrieve promotions.", e);
            }
        }
コード例 #3
0
 private void SendPersonsListToPromotionPage(PromotionPage obj)
 {
     MessagingCenter.Send <Students, ObservableCollection <Person> >(this, GlobalMethods.MessagingCenterMessage.SentToPromotionPage, PersonsList);
 }
コード例 #4
0
        private async void DeleteCompletedPromotion(PromotionPage arg1, BjjEvent arg2)
        {
            await _connection.DeleteAsync(arg2);

            EventsList.Remove(arg2);
        }