/// <summary> /// Run the code example. /// </summary> /// <param name="service">An initialized Dfa Reporting service object /// </param> public override void Run(DfareportingService service) { long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE")); long dfaSiteId = long.Parse(_T("INSERT_SITE_ID_HERE")); long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE")); string placementGroupName = _T("INSERT_PLACEMENT_GROUP_NAME_HERE"); // Retrieve the campaign. Campaign campaign = service.Campaigns.Get(profileId, campaignId).Execute(); // Create a pricing schedule. PricingSchedule pricingSchedule = new PricingSchedule(); pricingSchedule.EndDate = campaign.EndDate; pricingSchedule.PricingType = "PRICING_TYPE_CPM"; pricingSchedule.StartDate = campaign.StartDate; // Create the placement group. PlacementGroup placementGroup = new PlacementGroup(); placementGroup.CampaignId = campaignId; placementGroup.Name = placementGroupName; placementGroup.PlacementGroupType = "PLACEMENT_PACKAGE"; placementGroup.PricingSchedule = pricingSchedule; placementGroup.SiteId = dfaSiteId; // Insert the placement. PlacementGroup result = service.PlacementGroups.Insert(placementGroup, profileId).Execute(); // Display the new placement ID. Console.WriteLine("Placement group with ID {0} was created.", result.Id); }
public double GetPriceForPricingSchedule(string agendaItemName, PricingSchedule pricingSchedule) { string locatorFormat = "//label[text()='" + agendaItemName + "']/..//span[text()='{0}']/parent::label"; string locator = string.Format(locatorFormat, StringEnum.GetStringValue(pricingSchedule)); string price = UIUtil.DefaultProvider.GetText(locator, LocateBy.XPath); price = price.Split(new string[] { "(" }, StringSplitOptions.RemoveEmptyEntries)[0]; price = price.Split(new string[] { "$" }, StringSplitOptions.RemoveEmptyEntries)[0]; return Convert.ToDouble(price); }
/// <summary> /// Run the code example. /// </summary> /// <param name="service">An initialized Dfa Reporting service object /// </param> public override void Run(DfareportingService service) { long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE")); long dfaSiteId = long.Parse(_T("INSERT_SITE_ID_HERE")); long sizeId = long.Parse(_T("INSERT_SIZE_ID_HERE")); long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE")); string placementName = _T("INSERT_PLACEMENT_NAME_HERE"); // Retrieve the campaign. Campaign campaign = service.Campaigns.Get(profileId, campaignId).Execute(); // [START create_placement] MOE:strip_line // Create the placement. Placement placement = new Placement(); placement.Name = placementName; placement.CampaignId = campaignId; placement.Compatibility = "DISPLAY"; placement.PaymentSource = "PLACEMENT_AGENCY_PAID"; placement.SiteId = dfaSiteId; placement.TagFormats = new List <string>() { "PLACEMENT_TAG_STANDARD" }; // Set the size of the placement. Size size = new Size(); size.Id = sizeId; placement.Size = size; // [END create_placement] MOE:strip_line // [START create_pricing_schedule] MOE:strip_line // Set the pricing schedule for the placement. PricingSchedule pricingSchedule = new PricingSchedule(); pricingSchedule.EndDate = campaign.EndDate; pricingSchedule.PricingType = "PRICING_TYPE_CPM"; pricingSchedule.StartDate = campaign.StartDate; placement.PricingSchedule = pricingSchedule; // [END create_pricing_schedule] MOE:strip_line // [START insert_placement] MOE:strip_line // Insert the placement. Placement result = service.Placements.Insert(placement, profileId).Execute(); // [END insert_placement] MOE:strip_line // Display the new placement ID. Console.WriteLine("Placement with ID {0} was created.", result.Id); }
private static void CreateTestPricingScheduleEntry(QuiltContext ctx, PricingSchedule dbPricingSchedule, string unitOfMeasure, decimal price) { var dbPricingScheduleEntry = dbPricingSchedule.PricingScheduleEntries.Where(r => r.UnitOfMeasureCode == unitOfMeasure).SingleOrDefault(); if (dbPricingScheduleEntry == null) { dbPricingScheduleEntry = new PricingScheduleEntry() { PricingSchedule = dbPricingSchedule, UnitOfMeasureCode = unitOfMeasure, Price = price }; _ = ctx.PricingScheduleEntries.Add(dbPricingScheduleEntry); } else { dbPricingScheduleEntry.Price = price; } }
/// <summary> /// Run the code example. /// </summary> /// <param name="service">An initialized Dfa Reporting service object /// </param> public override void Run(DfareportingService service) { long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE")); long dfaSiteId = long.Parse(_T("INSERT_SITE_ID_HERE")); long sizeId = long.Parse(_T("INSERT_SIZE_ID_HERE")); long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE")); string placementName = _T("INSERT_PLACEMENT_NAME_HERE"); // Retrieve the campaign. Campaign campaign = service.Campaigns.Get(profileId, campaignId).Execute(); // Create the placement. Placement placement = new Placement(); placement.Name = placementName; placement.CampaignId = campaignId; placement.Compatibility = "WEB"; placement.PaymentSource = "PLACEMENT_AGENCY_PAID"; placement.SiteId = dfaSiteId; placement.TagFormats = new List<string>() { "PLACEMENT_TAG_STANDARD" }; // Set the size of the placement. Size size = new Size(); size.Id = sizeId; placement.Size = size; // Set the pricing schedule for the placement. PricingSchedule pricingSchedule = new PricingSchedule(); pricingSchedule.EndDate = campaign.EndDate; pricingSchedule.PricingType = "PRICING_TYPE_CPM"; pricingSchedule.StartDate = campaign.StartDate; placement.PricingSchedule = pricingSchedule; // Insert the placement. Placement result = service.Placements.Insert(placement, profileId).Execute(); // Display the new placement ID. Console.WriteLine("Placement with ID {0} was created.", result.Id); }
public void SelectPricingSchedule(string agendaItemName, PricingSchedule pricingSchedule) { string locatorFormat = "//label[text()='" + agendaItemName + "']/..//span[text()='{0}']/../../input"; string locator = string.Format(locatorFormat, StringEnum.GetStringValue(pricingSchedule)); UIUtil.DefaultProvider.WaitForDisplayAndClick(locator, LocateBy.XPath); }