/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="campaignId">Id of the campaign to be removed.</param> public void Run(AdWordsUser user, long campaignId) { // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService( AdWordsService.v201409.CampaignService); // Create campaign with REMOVED status. Campaign campaign = new Campaign(); campaign.id = campaignId; campaign.status = CampaignStatus.REMOVED; // Create the operation. CampaignOperation operation = new CampaignOperation(); operation.operand = campaign; operation.@operator = Operator.SET; try { // Remove the campaign. CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { operation }); // Display the results. if (retVal != null && retVal.value != null && retVal.value.Length > 0) { Campaign removedCampaign = retVal.value[0]; Console.WriteLine("Campaign with id = \"{0}\" was renamed to \"{1}\" and removed.", removedCampaign.id, removedCampaign.name); } else { Console.WriteLine("No campaigns were removed."); } } catch (Exception ex) { throw new System.ApplicationException("Failed to remove campaign.", ex); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="campaignId">Id of the campaign to be updated.</param> public void Run(AdWordsUser user, long campaignId) { // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201705.CampaignService); // Create the campaign. Campaign campaign = new Campaign(); campaign.id = campaignId; campaign.status = CampaignStatus.PAUSED; // Create the operation. CampaignOperation operation = new CampaignOperation(); operation.@operator = Operator.SET; operation.operand = campaign; try { // Update the campaign. CampaignReturnValue retVal = campaignService.mutate((new CampaignOperation[] { operation })); // Display the results. if (retVal != null && retVal.value != null && retVal.value.Length > 0) { Campaign updatedCampaign = retVal.value[0]; Console.WriteLine("Campaign with name = '{0}' and id = '{1}' was updated.", updatedCampaign.name, updatedCampaign.id); } else { Console.WriteLine("No campaigns were updated."); } } catch (Exception e) { throw new System.ApplicationException("Failed to update campaign.", e); } }
/// <summary> /// Creates the campaign with a portfolio bidding strategy. /// </summary> /// <param name="campaignService">The campaign service.</param> /// <param name="name">The campaign name.</param> /// <param name="biddingStrategyId">The bidding strategy id.</param> /// <param name="sharedBudgetId">The shared budget id.</param> /// <returns>The campaign object.</returns> private Campaign CreateCampaignWithBiddingStrategy(CampaignService campaignService, string name, long biddingStrategyId, long sharedBudgetId) { // Create campaign. Campaign campaign = new Campaign(); campaign.name = name; campaign.advertisingChannelType = AdvertisingChannelType.SEARCH; // Set the budget. campaign.budget = new Budget(); campaign.budget.budgetId = sharedBudgetId; // Set bidding strategy (required). BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.biddingStrategyId = biddingStrategyId; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; // Set network targeting (recommended). NetworkSetting networkSetting = new NetworkSetting(); networkSetting.targetGoogleSearch = true; networkSetting.targetSearchNetwork = true; networkSetting.targetContentNetwork = true; campaign.networkSetting = networkSetting; // Create operation. CampaignOperation operation = new CampaignOperation(); operation.operand = campaign; operation.@operator = Operator.ADD; return(campaignService.mutate(new CampaignOperation[] { operation }).value[0]); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the CampaignService. CampaignService campaignService = (CampaignService) user.GetService(AdWordsService.v201509.CampaignService); // Create the query. string query = "SELECT Id, Name, Status ORDER BY Name"; int offset = 0; int pageSize = 500; CampaignPage page = new CampaignPage(); try { do { string queryWithPaging = string.Format("{0} LIMIT {1}, {2}", query, offset, pageSize); // Get the campaigns. page = campaignService.query(queryWithPaging); // Display the results. if (page != null && page.entries != null) { int i = offset; foreach (Campaign campaign in page.entries) { Console.WriteLine("{0}) Campaign with id = '{1}', name = '{2}' and status = '{3}'" + " was found.", i + 1, campaign.id, campaign.name, campaign.status); i++; } } offset += pageSize; } while (offset < page.totalNumEntries); Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries); } catch (Exception e) { throw new System.ApplicationException("Failed to retrieve campaigns", e); } }
public void CreateCampaignService() { var uow = new UnitOfWork(new DigitalSignageDbContext("Test")); CampaignService cS = new CampaignService(); CampaignDTO campaignDTO = new CampaignDTO(); campaignDTO.Name = "nueva campaña"; campaignDTO.Description = "qsy"; campaignDTO.InitDate = new DateTime().AddYears(2018); campaignDTO.EndDate = new DateTime().AddYears(2018); campaignDTO.InitTime = new TimeSpan(); campaignDTO.EndTime = new TimeSpan(); try { cS.Create(campaignDTO); } catch (Exception e) { Assert.Fail(e.Message); } }
private void LoadBannerInfo() { var banner = CampaignService.GetOfferBannerById(QueryId); if (banner != null) { ltlTitle.Text = string.Format("{0} (ID: {1})", banner.Title, QueryId); txtTitle.Text = banner.Title; txtLink.Text = banner.Link; ltlBanner.Text = string.Format("<img src='/get_image_handler.aspx?" + QueryKey.TYPE + "=" + ImageHandlerType.OFFER_BANNER + "&img={0}'/>", banner.MediaFilename); cbEnabled.Checked = banner.Enabled; txtPriority.Text = banner.Priority.ToString(); if (banner.StartDate.HasValue) { txtDateFrom.Text = banner.StartDate.Value.ToString(AppConstant.DATE_FORM1); } if (banner.EndDate.HasValue) { txtDateTo.Text = banner.EndDate.Value.ToString(AppConstant.DATE_FORM1); } } }
/// <summary> /// Gets campaign List and Binds to ListBox /// </summary> private void GetActiveCampaignList() { DataSet dsCampaignList; try { CampaignService objCampService = new CampaignService(); dsCampaignList = objCampService.GetActiveCampaignList(); bool bCampaignsExists = (dsCampaignList.Tables[0].Rows.Count > 0); lbtnOk.Visible = bCampaignsExists; if (bCampaignsExists) { lbxCampaign.SelectedIndex = -1; lbxCampaign.DataSource = dsCampaignList; lbxCampaign.DataTextField = "Description"; // Replaced Short description lbxCampaign.DataValueField = "CampaignID"; lbxCampaign.DataBind(); if (Request.QueryString["CampaignID"] != null) { lbxCampaign.SelectedValue = Request.QueryString["CampaignID"].ToString(); } } else { lbxCampaign.Items.Clear(); ListItem li = new ListItem("No Active Campaigns", "0"); lbxCampaign.Items.Add(li); lbxCampaign.SelectedValue = "0"; } } catch (Exception ex) { PageMessage = ex.Message; } }
public static string GetOffsiteTransferNumber(string campDbConn, CampaignDetails callDetail) { CampaignService objCampService = null; string offsiteNumber = ""; try { if (callDetail != null) { objCampService = new CampaignService(); offsiteNumber = objCampService.GetOffsiteTransferNumber(campDbConn, callDetail.UniqueKey, callDetail.PhoneNum); } return(offsiteNumber); } catch (Exception ex) { DialerEngine.Log.WriteException(ex, "Error in AddResultCodeToCallList"); return(offsiteNumber); } finally { objCampService = null; } }
protected void ddlActiveScheme_Change(object sender, EventArgs e) { try { if (rdoSelected.Checked) { if (Session["Campaign"] != null) { Campaign objCampaign = (Campaign)Session["Campaign"]; CampaignService objCampService = new CampaignService(); XmlDocument xDocCampaign = new XmlDocument(); xDocCampaign.LoadXml(Serialize.SerializeObject(objCampaign, "Campaign")); ltrlPage.Text = " <img src=\"../images/arrowright.gif\"> <b>Training Schemes<b>"; objCampService.UpdateActiveTrainingScheme(xDocCampaign, Convert.ToInt64(ddlActiveScheme.SelectedValue)); } } GetTrainingPageList(); } catch (Exception ex) { PageMessage = ex.Message; } }
// GET: Campaign public async Task <ActionResult> Index(int?page) { if (Session["token"] != null) { if (page == null) { page = 1; } CampaignService campaignService = new CampaignService(); var campaignResponse = await campaignService.GetAllCampaigns(Session["token"].ToString(), page); var pager = new Pager(campaignResponse.campaigns.Count(), page, 10, campaignResponse.totalPaginas.Value + 1); var viewModel = new IndexViewModelCampaigns { Items = campaignResponse.campaigns, Pager = pager }; return(View(viewModel)); } else { return(RedirectToAction("Login", "Account")); } }
/// <summary> /// The main method. /// </summary> /// <param name="args">Command line arguments.</param> static void _Main(string[] args) { AdWordsUser user = new AdWordsUser(); // This code example shows how to run an AdWords API web application // while incorporating the OAuth2 installed application flow into your // application. If your application uses a single AdWords manager account // login to make calls to all your accounts, you shouldn't use this code // example. Instead, you should run OAuthTokenGenerator.exe to generate a // refresh token and use that configuration in your application's // App.config. AdWordsAppConfig config = user.Config as AdWordsAppConfig; if (user.Config.OAuth2Mode == OAuth2Flow.APPLICATION && string.IsNullOrEmpty(config.OAuth2RefreshToken)) { DoAuth2Authorization(user); } Console.Write("Enter the customer id: "); string customerId = Console.ReadLine(); config.ClientCustomerId = customerId; // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201802.CampaignService); Selector selector = new Selector() { fields = new string[] { Campaign.Fields.Id, Campaign.Fields.Name, Campaign.Fields.Status }, ordering = new OrderBy[] { OrderBy.Asc(Campaign.Fields.Name) }, paging = Paging.Default }; CampaignPage page = new CampaignPage(); try { do { // Get the campaigns. page = campaignService.get(selector); // Display the results. if (page != null && page.entries != null) { int i = selector.paging.startIndex; foreach (Campaign campaign in page.entries) { Console.WriteLine("{0}) Campaign with id = '{1}', name = '{2}' and status = '{3}'" + " was found.", i + 1, campaign.id, campaign.name, campaign.status); i++; } } selector.paging.IncreaseOffset(); } while (selector.paging.startIndex < page.totalNumEntries); Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries); } catch (Exception e) { throw new System.ApplicationException("Failed to retrieve campaigns", e); } }
/// <summary> /// Creates the shopping campaign. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="budgetId">The budget id.</param> /// <param name="merchantId">The Merchant Center id.</param> /// <returns>The Shopping campaign.</returns> private static Campaign CreateCampaign(AdWordsUser user, long budgetId, long merchantId) { using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201809.CampaignService)) { // Create campaign. Campaign campaign = new Campaign { name = "Shopping campaign #" + ExampleUtilities.GetRandomString(), // The advertisingChannelType is what makes this a Shopping campaign. advertisingChannelType = AdvertisingChannelType.SHOPPING, // Recommendation: Set the campaign to PAUSED when creating it to prevent // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. status = CampaignStatus.PAUSED, // Set shared budget (required). budget = new Budget { budgetId = budgetId } }; // Set bidding strategy (required). BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration { biddingStrategyType = BiddingStrategyType.MANUAL_CPC }; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; // All Shopping campaigns need a ShoppingSetting. ShoppingSetting shoppingSetting = new ShoppingSetting { salesCountry = "US", campaignPriority = 0, merchantId = merchantId, // Set to "true" to enable Local Inventory Ads in your campaign. enableLocal = true }; campaign.settings = new Setting[] { shoppingSetting }; // Create operation. CampaignOperation campaignOperation = new CampaignOperation { operand = campaign, @operator = Operator.ADD }; // Make the mutate request. CampaignReturnValue retval = campaignService.mutate(new CampaignOperation[] { campaignOperation }); return(retval.value[0]); } }
/// <summary> /// Saves Agent Stats, Agent Activity, Log Off status /// </summary> /// <returns></returns> private void SaveLoginStatus() { Agent objAgent; AgentStat objAgentStat; Campaign objCampaign; /*if (lbxLoginStatus.SelectedValue == "Manual Dial") * { * return; * }*/ if (Session["Campaign"] != null && Session["AgentStat"] != null && Session["LoggedAgent"] != null) { objCampaign = (Campaign)Session["Campaign"]; objAgentStat = (AgentStat)Session["AgentStat"]; objAgent = (Agent)Session["LoggedAgent"]; if (lbxLoginStatus.SelectedValue == "Receive Outbound Calls Only") { objAgentStat.StatusID = objAgent.AgentStatusID = (long)AgentLoginStatus.Ready; objAgentStat.ReceiptModeID = objAgent.ReceiptModeID = (long)AgentCallReceiptMode.OutboundOnly; } if (lbxLoginStatus.SelectedValue == "Verification Only") { objAgentStat.StatusID = objAgent.AgentStatusID = (long)AgentLoginStatus.Ready; objAgentStat.ReceiptModeID = objAgent.ReceiptModeID = (long)AgentCallReceiptMode.VerifyOnly; } if (lbxLoginStatus.SelectedValue == "Blended: Verification and Outbound Calls") { objAgentStat.StatusID = objAgent.AgentStatusID = (long)AgentLoginStatus.Ready; objAgentStat.ReceiptModeID = objAgent.ReceiptModeID = (long)AgentCallReceiptMode.VerifyBlended; } if (lbxLoginStatus.SelectedValue == "Manual Dial") { objAgentStat.StatusID = objAgent.AgentStatusID = (long)AgentLoginStatus.Pause; objAgentStat.ReceiptModeID = objAgent.ReceiptModeID = (long)AgentCallReceiptMode.ManualDial; } if (lbxLoginStatus.SelectedValue == "Log Off") { objAgentStat.LogOffDate = DateTime.Now; objAgentStat.LogOffTime = DateTime.Now; } AgentService objAgentService = new AgentService(); CampaignService objCampService = new CampaignService(); XmlDocument xDocAgent = new XmlDocument(); XmlDocument xDocCampaign = new XmlDocument(); XmlDocument xDocAgentStat = new XmlDocument(); xDocAgentStat.LoadXml(Serialize.SerializeObject(objAgentStat, "AgentStat")); xDocCampaign.LoadXml(Serialize.SerializeObject(objCampaign, "Campaign")); try { xDocAgent.LoadXml(Serialize.SerializeObject(objAgent, "Agent")); if (lbxLoginStatus.SelectedValue == "Receive Outbound Calls Only" || lbxLoginStatus.SelectedValue == "Manual Dial" || lbxLoginStatus.SelectedValue == "Verification Only" || lbxLoginStatus.SelectedValue == "Blended: Verification and Outbound Calls") { objAgent = (Agent)Serialize.DeserializeObject( objAgentService.AgentActivityInsertUpdate(xDocAgent), "Agent"); try { objAgentStat = (AgentStat)Serialize.DeserializeObject( objCampService.InsertUpdateAgentStat(xDocCampaign, xDocAgentStat), "AgentStat"); if (objAgentStat != null) { Session["AgentStat"] = objAgentStat; } } catch { } } else if (lbxLoginStatus.SelectedValue == "Log Off") { objAgentService.UpdateAgentLogOut(xDocAgent); //Sets LogoutTime to now for specific agent try { objAgentStat = (AgentStat)Serialize.DeserializeObject ( objCampService.InsertUpdateAgentStat(xDocCampaign, xDocAgentStat), "AgentStat" ); } catch { } } string timestamp = "ts=" + DateTime.Now.Ticks.ToString(); if (lbxLoginStatus.SelectedValue == "Receive Outbound Calls Only" || lbxLoginStatus.SelectedValue == "Verification Only" || lbxLoginStatus.SelectedValue == "Blended: Verification and Outbound Calls") { ActivityLogger.WriteAgentEntry(objAgent, "Agent has chosen to recieve outbound calls only."); Response.Redirect("~/agent/waitingforCall.aspx" + "?" + timestamp); } else if (lbxLoginStatus.SelectedValue == "Manual Dial") { ActivityLogger.WriteAgentEntry(objAgent, "Agent has chosen to manual dial."); Response.Redirect("~/agent/ManualDial.aspx" + "?" + timestamp); } else if (lbxLoginStatus.SelectedValue == "Select Another Campaign") { ActivityLogger.WriteAgentEntry(objAgent, "Agent has chosen to select another campaign."); Response.Redirect("~/agent/Campaigns.aspx"); } else { ActivityLogger.WriteAgentEntry(objAgent, "Agent has chosen to log out."); Session.Remove("LoggedAgent"); Response.Redirect("../Logout.aspx" + "?" + timestamp); } } catch (Exception ex) { PageMessage = ex.Message; } } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the BudgetService. BudgetService budgetService = (BudgetService)user.GetService(AdWordsService.v201605.BudgetService); // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201605.CampaignService); // Create the campaign budget. Budget budget = new Budget(); budget.name = "Interplanetary Cruise Budget #" + ExampleUtilities.GetRandomString(); budget.deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD; budget.amount = new Money(); budget.amount.microAmount = 500000; BudgetOperation budgetOperation = new BudgetOperation(); budgetOperation.@operator = Operator.ADD; budgetOperation.operand = budget; try { BudgetReturnValue budgetRetval = budgetService.mutate( new BudgetOperation[] { budgetOperation }); budget = budgetRetval.value[0]; } catch (Exception e) { throw new System.ApplicationException("Failed to add shared budget.", e); } List <CampaignOperation> operations = new List <CampaignOperation>(); for (int i = 0; i < NUM_ITEMS; i++) { // Create the campaign. Campaign campaign = new Campaign(); campaign.name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString(); campaign.status = CampaignStatus.PAUSED; campaign.advertisingChannelType = AdvertisingChannelType.SEARCH; BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration(); biddingConfig.biddingStrategyType = BiddingStrategyType.MANUAL_CPC; campaign.biddingStrategyConfiguration = biddingConfig; campaign.budget = new Budget(); campaign.budget.budgetId = budget.budgetId; // Set the campaign network options. campaign.networkSetting = new NetworkSetting(); campaign.networkSetting.targetGoogleSearch = true; campaign.networkSetting.targetSearchNetwork = true; campaign.networkSetting.targetContentNetwork = false; campaign.networkSetting.targetPartnerSearchNetwork = false; // Set the campaign settings for Advanced location options. GeoTargetTypeSetting geoSetting = new GeoTargetTypeSetting(); geoSetting.positiveGeoTargetType = GeoTargetTypeSettingPositiveGeoTargetType.DONT_CARE; geoSetting.negativeGeoTargetType = GeoTargetTypeSettingNegativeGeoTargetType.DONT_CARE; campaign.settings = new Setting[] { geoSetting }; // Optional: Set the start date. campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd"); // Optional: Set the end date. campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd"); // Optional: Set the campaign ad serving optimization status. campaign.adServingOptimizationStatus = AdServingOptimizationStatus.ROTATE; // Optional: Set the frequency cap. FrequencyCap frequencyCap = new FrequencyCap(); frequencyCap.impressions = 5; frequencyCap.level = Level.ADGROUP; frequencyCap.timeUnit = TimeUnit.DAY; campaign.frequencyCap = frequencyCap; // Create the operation. CampaignOperation operation = new CampaignOperation(); operation.@operator = Operator.ADD; operation.operand = campaign; operations.Add(operation); } try { // Add the campaign. CampaignReturnValue retVal = campaignService.mutate(operations.ToArray()); // Display the results. if (retVal != null && retVal.value != null && retVal.value.Length > 0) { foreach (Campaign newCampaign in retVal.value) { Console.WriteLine("Campaign with name = '{0}' and id = '{1}' was added.", newCampaign.name, newCampaign.id); } } else { Console.WriteLine("No campaigns were added."); } } catch (Exception e) { throw new System.ApplicationException("Failed to add campaigns.", e); } }
/// <summary> /// Updates the campaign DSA setting to add DSA pagefeeds. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="campaignId">The Campaign ID.</param> /// <param name="feedId">The page feed ID.</param> private static void UpdateCampaignDsaSetting(AdWordsUser user, long campaignId, long feedId) { using (CampaignService campaignService = (CampaignService)user.GetService( AdWordsService.v201802.CampaignService)) { Selector selector = new Selector() { fields = new string[] { Campaign.Fields.Id, Campaign.Fields.Settings }, predicates = new Predicate[] { Predicate.Equals(Campaign.Fields.Id, campaignId) }, paging = Paging.Default }; CampaignPage page = campaignService.get(selector); if (page == null || page.entries == null || page.entries.Length == 0) { throw new System.ApplicationException(string.Format( "Failed to retrieve campaign with ID = {0}.", campaignId)); } Campaign campaign = page.entries[0]; if (campaign.settings == null) { throw new System.ApplicationException("This is not a DSA campaign."); } DynamicSearchAdsSetting dsaSetting = null; Setting[] campaignSettings = campaign.settings; for (int i = 0; i < campaign.settings.Length; i++) { Setting setting = campaignSettings[i]; if (setting is DynamicSearchAdsSetting) { dsaSetting = (DynamicSearchAdsSetting)setting; break; } } if (dsaSetting == null) { throw new System.ApplicationException("This is not a DSA campaign."); } // Use a page feed to specify precisely which URLs to use with your // Dynamic Search Ads. dsaSetting.pageFeed = new PageFeed() { feedIds = new long[] { feedId }, }; // Optional: Specify whether only the supplied URLs should be used with your // Dynamic Search Ads. dsaSetting.useSuppliedUrlsOnly = true; Campaign campaignToUpdate = new Campaign(); campaignToUpdate.id = campaignId; campaignToUpdate.settings = campaignSettings; CampaignOperation operation = new CampaignOperation(); operation.operand = campaignToUpdate; operation.@operator = Operator.SET; try { CampaignReturnValue retval = campaignService.mutate( new CampaignOperation[] { operation }); Campaign updatedCampaign = retval.value[0]; Console.WriteLine("DSA page feed for campaign ID '{0}' was updated with feed ID '{1}'.", updatedCampaign.id, feedId); } catch (Exception e) { throw new System.ApplicationException("Failed to set page feed for campaign.", e); } } }
/// <summary> /// The main method. /// </summary> /// <param name="args">Command line arguments.</param> static void Main(string[] args) { AdWordsUser user = new AdWordsUser(); // This code example shows how to run an AdWords API web application // while incorporating the OAuth2 installed application flow into your // application. If your application uses a single MCC login to make calls // to all your accounts, you shouldn't use this code example. Instead, you // should run OAuthTokenGenerator.exe to generate a refresh // token and use that configuration in your application's App.config. AdWordsAppConfig config = user.Config as AdWordsAppConfig; if (user.Config.OAuth2Mode == OAuth2Flow.APPLICATION && string.IsNullOrEmpty(config.OAuth2RefreshToken)) { DoAuth2Authorization(user); } Console.Write("Enter the customer id: "); string customerId = Console.ReadLine(); config.ClientCustomerId = customerId; // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201406.CampaignService); // Create the selector. Selector selector = new Selector(); selector.fields = new string[] { "Id", "Name", "Status" }; // Set the selector paging. selector.paging = new Paging(); int offset = 0; int pageSize = 500; CampaignPage page = new CampaignPage(); try { do { selector.paging.startIndex = offset; selector.paging.numberResults = pageSize; // Get the campaigns. page = campaignService.get(selector); // Display the results. if (page != null && page.entries != null) { int i = offset; foreach (Campaign campaign in page.entries) { Console.WriteLine("{0}) Campaign with id = '{1}', name = '{2}' and status = '{3}'" + " was found.", i + 1, campaign.id, campaign.name, campaign.status); i++; } } offset += pageSize; } while (offset < page.totalNumEntries); Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries); } catch (Exception ex) { throw new System.ApplicationException("Failed to retrieve campaigns", ex); } }
public void Setup() { mockCampaignRepository = new Mock <ICampaignRepository>(); mockProductRepository = new Mock <IProductRepository>(); campaignService = new CampaignService(mockCampaignRepository.Object); }
/// <summary> /// Creates the campaign. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="budget">The campaign budget.</param> /// <returns>The newly created campaign.</returns> private static Campaign CreateCampaign(AdWordsUser user, Budget budget) { using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201802.CampaignService)) { // Create a Dynamic Search Ads campaign. Campaign campaign = new Campaign { name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString(), advertisingChannelType = AdvertisingChannelType.SEARCH, // Recommendation: Set the campaign to PAUSED when creating it to prevent // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. status = CampaignStatus.PAUSED }; BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration { biddingStrategyType = BiddingStrategyType.MANUAL_CPC }; campaign.biddingStrategyConfiguration = biddingConfig; campaign.budget = new Budget { budgetId = budget.budgetId }; // Required: Set the campaign's Dynamic Search Ads settings. DynamicSearchAdsSetting dynamicSearchAdsSetting = new DynamicSearchAdsSetting { // Required: Set the domain name and language. domainName = "example.com", languageCode = "en" }; // Set the campaign settings. campaign.settings = new Setting[] { dynamicSearchAdsSetting }; // Optional: Set the start date. campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd"); // Optional: Set the end date. campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd"); // Create the operation. CampaignOperation operation = new CampaignOperation { @operator = Operator.ADD, operand = campaign }; try { // Add the campaign. CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { operation }); // Display the results. Campaign newCampaign = retVal.value[0]; Console.WriteLine("Campaign with id = '{0}' and name = '{1}' was added.", newCampaign.id, newCampaign.name); return(newCampaign); } catch (Exception e) { throw new System.ApplicationException("Failed to add campaigns.", e); } } }
public async Task <IActionResult> GetCampaigns([FromQuery] ListOptions <GetCampaignsListFilter> options) { var campaigns = await CampaignService.GetCampaigns(options); return(Ok(campaigns)); }
/// <summary> /// Creates the shopping campaign. /// </summary> /// <param name="budgetId">The budget id.</param> /// <param name="merchantId">The Merchant Center id.</param> /// <param name="campaignService">The CampaignService instance.</param> /// <returns>The Shopping campaign.</returns> private static Campaign CreateCampaign(long budgetId, long merchantId, CampaignService campaignService) { // Create campaign. Campaign campaign = new Campaign(); campaign.name = "Shopping campaign #" + ExampleUtilities.GetRandomString(); // The advertisingChannelType is what makes this a Shopping campaign. campaign.advertisingChannelType = AdvertisingChannelType.SHOPPING; // Set shared budget (required). campaign.budget = new Budget(); campaign.budget.budgetId = budgetId; // Set bidding strategy (required). BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.biddingStrategyType = BiddingStrategyType.MANUAL_CPC; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; // All Shopping campaigns need a ShoppingSetting. ShoppingSetting shoppingSetting = new ShoppingSetting(); shoppingSetting.salesCountry = "US"; shoppingSetting.campaignPriority = 0; shoppingSetting.merchantId = merchantId; // Set to "true" to enable Local Inventory Ads in your campaign. shoppingSetting.enableLocal = true; campaign.settings = new Setting[] { shoppingSetting }; // Create operation. CampaignOperation campaignOperation = new CampaignOperation(); campaignOperation.operand = campaign; campaignOperation.@operator = Operator.ADD; // Make the mutate request. CampaignReturnValue retval = campaignService.mutate( new CampaignOperation[] { campaignOperation }); return retval.value[0]; }
/// <summary> /// Saves recording Data /// </summary> private void SaveData() { if (chkEnableDigitizedRecording.Checked && !IsPathValid()) { PageMessage = "Please provide valid Recording File's Storage Path"; txtFileStoragePath.Focus(); } else { DigitalizedRecording objDigitalizedRecording = new DigitalizedRecording(); Campaign objCampaign = new Campaign(); if (Session["Campaign"] != null) { objCampaign = (Campaign)Session["Campaign"]; } if (ViewState["DigitalizedRecordingID"].ToString() != "0") { objDigitalizedRecording.DigitalizedRecordingID = (long)ViewState["DigitalizedRecordingID"]; } objDigitalizedRecording.EnableRecording = chkEnableDigitizedRecording.Checked; objDigitalizedRecording.EnableWithABeep = false; //objDigitalizedRecording.StartWithABeep = chkStartRecordingWithBeep.Checked; //objDigitalizedRecording.RecordToWave = chkWaveFormat.Checked; //objDigitalizedRecording.HighQualityRecording = chkHigherQuality.Checked; objDigitalizedRecording.RecordingFilePath = txtFileStoragePath.Text.EndsWith(@"\") == true? txtFileStoragePath.Text.Trim() : txtFileStoragePath.Text.Trim() + @"\"; /*string RecordingsPath; * string ismultiboxconfig = ConfigurationManager.AppSettings["IsMultiBoxConfig"]; * if (ismultiboxconfig == "yes" || ismultiboxconfig == "Yes" || ismultiboxconfig == "YES") * { * RecordingsPath = ConfigurationManager.AppSettings["RecordingsPathMulti"]; * * } * else * { * RecordingsPath = ConfigurationManager.AppSettings["RecordingsPath"]; * * } * * objDigitalizedRecording.RecordingFilePath = RecordingsPath; */ objDigitalizedRecording.FileNaming = string.Empty; CampaignService objCampaignService = new CampaignService(); XmlDocument xDocDigitalizedRecording = new XmlDocument(); XmlDocument xDocCampaign = new XmlDocument(); try { xDocDigitalizedRecording.LoadXml(Serialize.SerializeObject( objDigitalizedRecording, "DigitalizedRecording")); xDocCampaign.LoadXml(Serialize.SerializeObject(objCampaign, "Campaign")); objDigitalizedRecording = (DigitalizedRecording)Serialize.DeserializeObject( objCampaignService.DigitalizedRecordingInsertUpdate(xDocCampaign, xDocDigitalizedRecording), "DigitalizedRecording"); Response.Redirect("Home.aspx"); } catch (Exception ex) { PageMessage = ex.Message; } } }
public CampaignModule(CampaignService campaignService) => _campaignService = campaignService;
/// <summary> /// Creates a test campaign for running further tests. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="channelType">The advertising channel type for this /// campaign.</param> /// <param name="strategyType">The bidding strategy to be used for /// this campaign.</param> /// <param name="isMobile">True, if this campaign is mobile-only, false /// otherwise.</param> /// <returns>The campaign id.</returns> public long CreateCampaign(AdWordsUser user, AdvertisingChannelType channelType, BiddingStrategyType strategyType, bool isMobile) { CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201607.CampaignService); Campaign campaign = new Campaign() { name = string.Format("Campaign {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")), advertisingChannelType = channelType, status = CampaignStatus.PAUSED, biddingStrategyConfiguration = new BiddingStrategyConfiguration() { biddingStrategyType = strategyType }, budget = new Budget() { budgetId = CreateBudget(user), amount = new Money() { microAmount = 100000000, }, deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD } }; if (isMobile) { switch (campaign.advertisingChannelType) { case AdvertisingChannelType.SEARCH: campaign.advertisingChannelSubType = AdvertisingChannelSubType.SEARCH_MOBILE_APP; break; case AdvertisingChannelType.DISPLAY: campaign.advertisingChannelSubType = AdvertisingChannelSubType.DISPLAY_MOBILE_APP; break; } } List <Setting> settings = new List <Setting>(); if (channelType == AdvertisingChannelType.SHOPPING) { // All Shopping campaigns need a ShoppingSetting. ShoppingSetting shoppingSetting = new ShoppingSetting() { salesCountry = "US", campaignPriority = 0, merchantId = (user.Config as AdWordsAppConfig).MerchantCenterId }; settings.Add(shoppingSetting); } campaign.settings = settings.ToArray(); CampaignOperation campaignOperation = new CampaignOperation() { @operator = Operator.ADD, operand = campaign }; CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { campaignOperation }); return(retVal.value[0].id); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201806.CampaignService)) { Budget budget = CreateBudget(user); List <CampaignOperation> operations = new List <CampaignOperation>(); for (int i = 0; i < NUM_ITEMS; i++) { // Create the campaign. Campaign campaign = new Campaign { name = "Interplanetary Cruise #" + ExampleUtilities.GetRandomString(), advertisingChannelType = AdvertisingChannelType.SEARCH, // Recommendation: Set the campaign to PAUSED when creating it to prevent // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. status = CampaignStatus.PAUSED }; BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration { biddingStrategyType = BiddingStrategyType.MANUAL_CPC }; campaign.biddingStrategyConfiguration = biddingConfig; campaign.budget = new Budget { budgetId = budget.budgetId }; // Set the campaign network options. campaign.networkSetting = new NetworkSetting { targetGoogleSearch = true, targetSearchNetwork = true, targetContentNetwork = false, targetPartnerSearchNetwork = false }; // Set the campaign settings for Advanced location options. GeoTargetTypeSetting geoSetting = new GeoTargetTypeSetting { positiveGeoTargetType = GeoTargetTypeSettingPositiveGeoTargetType.DONT_CARE, negativeGeoTargetType = GeoTargetTypeSettingNegativeGeoTargetType.DONT_CARE }; campaign.settings = new Setting[] { geoSetting }; // Optional: Set the start date. campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd"); // Optional: Set the end date. campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd"); // Optional: Set the frequency cap. FrequencyCap frequencyCap = new FrequencyCap { impressions = 5, level = Level.ADGROUP, timeUnit = TimeUnit.DAY }; campaign.frequencyCap = frequencyCap; // Create the operation. CampaignOperation operation = new CampaignOperation { @operator = Operator.ADD, operand = campaign }; operations.Add(operation); } try { // Add the campaign. CampaignReturnValue retVal = campaignService.mutate(operations.ToArray()); // Display the results. if (retVal != null && retVal.value != null && retVal.value.Length > 0) { foreach (Campaign newCampaign in retVal.value) { Console.WriteLine("Campaign with name = '{0}' and id = '{1}' was added.", newCampaign.name, newCampaign.id); } } else { Console.WriteLine("No campaigns were added."); } } catch (Exception e) { throw new System.ApplicationException("Failed to add campaigns.", e); } } }
static void Main(string[] args) { #region InnerClass List <Player> playerList = new List <Player>(); List <Campaign> campaignList = new List <Campaign>(); while (true) { var process = Intro(); switch (process) { case 1: //oyuncu ekle PlayerService playerServiceAdd = new PlayerService(); playerServiceAdd.Add(playerList); break; case 2: //oyuncu güncelle PlayerService playerServiceUpdate = new PlayerService(); playerServiceUpdate.Update(playerList); break; case 3: //oyuncu sil PlayerService playerServiceDelete = new PlayerService(); playerServiceDelete.Delete(playerList); break; case 4: //kampanya ekle CampaignService campaignServiceAdd = new CampaignService(); campaignServiceAdd.Add(campaignList); break; case 5: //kampanya güncelle CampaignService campaignServiceUpdate = new CampaignService(); campaignServiceUpdate.Update(campaignList); break; case 6: //kampanya sil CampaignService campaignServiceDelete = new CampaignService(); campaignServiceDelete.Delete(campaignList); break; case 7: //oyun satın al GameService gameServiceBuy = new GameService(); gameServiceBuy.Buy(playerList, campaignList); break; case 8: //oyuncuları listele Console.WriteLine("---Oyuncular---"); foreach (var player in playerList) { Console.WriteLine("----------------------"); Console.WriteLine(player.PlayerTcNo); Console.WriteLine(player.PlayerFirstName); Console.WriteLine(player.PlayerLastName); Console.WriteLine(player.PlayerBirthOfYear); } break; case 9: //kampanyaları listele Console.WriteLine("---Kampanyalar---"); foreach (var campaign in campaignList) { Console.WriteLine("----------------------"); Console.WriteLine(campaign.CampaignName); Console.WriteLine(campaign.CampaignDiscount); } break; case 10: //oyunları listele GameService gameService = new GameService(); Console.WriteLine("---Oyunlar---"); foreach (var game in gameService.games) { Console.WriteLine("----------------------"); Console.WriteLine(game.GameName); Console.WriteLine(game.GameType); Console.WriteLine(game.GamePlatform); Console.WriteLine(game.GamePrice); } break; } } #endregion }
/// <summary> /// Creates the campaign with a shared bidding strategy. /// </summary> /// <param name="campaignService">The campaign service.</param> /// <param name="name">The campaign name.</param> /// <param name="biddingStrategyId">The bidding strategy id.</param> /// <param name="sharedBudgetId">The shared budget id.</param> /// <returns>The campaign object.</returns> private Campaign CreateCampaignWithBiddingStrategy(CampaignService campaignService, string name, long biddingStrategyId, long sharedBudgetId) { // Create campaign. Campaign campaign = new Campaign(); campaign.name = name; campaign.advertisingChannelType = AdvertisingChannelType.SEARCH; // Set the budget. campaign.budget = new Budget(); campaign.budget.budgetId = sharedBudgetId; // Set bidding strategy (required). BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.biddingStrategyId = biddingStrategyId; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; // Set network targeting (recommended). NetworkSetting networkSetting = new NetworkSetting(); networkSetting.targetGoogleSearch = true; networkSetting.targetSearchNetwork = true; networkSetting.targetContentNetwork = true; campaign.networkSetting = networkSetting; // Create operation. CampaignOperation operation = new CampaignOperation(); operation.operand = campaign; operation.@operator = Operator.ADD; return campaignService.mutate(new CampaignOperation[] {operation}).value[0]; }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="labelId">ID of the label.</param> public void Run(AdWordsUser user, long labelId) { using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201802.CampaignService)) { // Create the selector. Selector selector = new Selector() { fields = new string[] { Campaign.Fields.Id, Campaign.Fields.Name, Campaign.Fields.Labels }, predicates = new Predicate[] { // Labels filtering is performed by ID. You can use CONTAINS_ANY to // select campaigns with any of the label IDs, CONTAINS_ALL to select // campaigns with all of the label IDs, or CONTAINS_NONE to select // campaigns with none of the label IDs. Predicate.ContainsAny(Campaign.Fields.Labels, new string[] { labelId.ToString() }) }, paging = Paging.Default }; CampaignPage page = new CampaignPage(); try { do { // Get the campaigns. page = campaignService.get(selector); // Display the results. if (page != null && page.entries != null) { int i = selector.paging.startIndex; foreach (Campaign campaign in page.entries) { List <string> labelNames = new List <string>(); foreach (Label label in campaign.labels) { labelNames.Add(label.name); } Console.WriteLine( "{0}) Campaign with id = '{1}', name = '{2}' and " + "labels = '{3}' was found.", i + 1, campaign.id, campaign.name, string.Join(", ", labelNames.ToArray())); i++; } } selector.paging.IncreaseOffset(); } while (selector.paging.startIndex < page.totalNumEntries); Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries); } catch (Exception e) { throw new System.ApplicationException("Failed to retrieve campaigns by label", e); } } }
/// <summary> /// Creates a Shopping dynamic remarketing campaign object (not including ad group level and /// below). This creates a Display campaign with the merchant center feed attached. /// Merchant Center is used for the product information in combination with a user list /// which contains hits with <code>ecomm_prodid</code> specified. See /// <a href="https://developers.google.com/adwords-remarketing-tag/parameters#retail"> /// the guide</a> for more detail. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="merchantId">The ID of the Merchant Center account.</param> /// <param name="budgetId">The ID of the budget to use for the campaign.</param> /// <returns>The campaign that was created.</returns> private static Campaign CreateCampaign(AdWordsUser user, long merchantId, long budgetId) { using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201806.CampaignService)) { Campaign campaign = new Campaign { name = "Shopping campaign #" + ExampleUtilities.GetRandomString(), // Dynamic remarketing campaigns are only available on the Google Display // Network. advertisingChannelType = AdvertisingChannelType.DISPLAY, status = CampaignStatus.PAUSED }; Budget budget = new Budget { budgetId = budgetId }; campaign.budget = budget; // This example uses a Manual CPC bidding strategy, but you should select the // strategy that best aligns with your sales goals. More details here: // https://support.google.com/adwords/answer/2472725 BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration { biddingStrategyType = BiddingStrategyType.MANUAL_CPC }; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; ShoppingSetting setting = new ShoppingSetting { // Campaigns with numerically higher priorities take precedence over those with // lower priorities. campaignPriority = 0, // Set the Merchant Center account ID from which to source products. merchantId = merchantId, // Display Network campaigns do not support partition by country. The only // supported value is "ZZ". This signals that products from all countries are // available in the campaign. The actual products which serve are based on the // products tagged in the user list entry. salesCountry = "ZZ", // Optional: Enable local inventory ads (items for sale in physical stores.) enableLocal = true }; campaign.settings = new Setting[] { setting }; CampaignOperation op = new CampaignOperation { operand = campaign, @operator = Operator.ADD }; CampaignReturnValue result = campaignService.mutate(new CampaignOperation[] { op }); return(result.value[0]); } }
public SessionModule(SessionService sessionService, CampaignService campaignService, UserService userService) { _sessionService = sessionService; _campaignService = campaignService; _userService = userService; }
/// <summary> /// Creates a test campaign for running further tests. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="channelType">The advertising channel type for this /// campaign.</param> /// <param name="strategyType">The bidding strategy to be used for /// this campaign.</param> /// <param name="isMobile">True, if this campaign is mobile-only, false /// otherwise.</param> /// <param name="isDsa">True, if this campaign is for DSA, false /// otherwise.</param> /// <param name="isGmail">True, if this campaign is for GMail Ads, false /// otherwise.</param> /// <returns>The campaign id.</returns> private long CreateCampaign(AdWordsUser user, AdvertisingChannelType channelType, BiddingStrategyType strategyType, bool isMobile, bool isDsa, bool isGmail) { CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201802.CampaignService); Campaign campaign = new Campaign() { name = string.Format("Campaign {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")), advertisingChannelType = channelType, // Set the test campaign to PAUSED when creating it to prevent the ads from serving. status = CampaignStatus.PAUSED, biddingStrategyConfiguration = new BiddingStrategyConfiguration() { biddingStrategyType = strategyType }, budget = new Budget() { budgetId = CreateBudget(user), amount = new Money() { microAmount = 100000000, }, deliveryMethod = BudgetBudgetDeliveryMethod.STANDARD } }; // Campaign setups that cannot be inferred just from AdvertisingChannelType uses flags. List <Setting> settings = new List <Setting>(); // The following flags are all mutually exclusive for the purpose of testing. if (isMobile) { switch (campaign.advertisingChannelType) { case AdvertisingChannelType.SEARCH: campaign.advertisingChannelSubType = AdvertisingChannelSubType.SEARCH_MOBILE_APP; break; case AdvertisingChannelType.DISPLAY: campaign.advertisingChannelSubType = AdvertisingChannelSubType.DISPLAY_MOBILE_APP; break; } } else if (isDsa) { // Required: Set the campaign's Dynamic Search Ads settings. DynamicSearchAdsSetting dynamicSearchAdsSetting = new DynamicSearchAdsSetting(); // Required: Set the domain name and language. dynamicSearchAdsSetting.domainName = "example.com"; dynamicSearchAdsSetting.languageCode = "en"; settings.Add(dynamicSearchAdsSetting); } else if (isGmail) { campaign.advertisingChannelSubType = AdvertisingChannelSubType.DISPLAY_GMAIL_AD; } else if (channelType == AdvertisingChannelType.SHOPPING) { // All Shopping campaigns need a ShoppingSetting. ShoppingSetting shoppingSetting = new ShoppingSetting() { salesCountry = "US", campaignPriority = 0, merchantId = (user.Config as AdWordsAppConfig).MerchantCenterId }; settings.Add(shoppingSetting); } campaign.settings = settings.ToArray(); CampaignOperation campaignOperation = new CampaignOperation() { @operator = Operator.ADD, operand = campaign }; CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { campaignOperation }); return(retVal.value[0].id); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // [START prepareUAC] MOE:strip_line // Get the CampaignService. CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201609.CampaignService); // Create the campaign. Campaign campaign = new Campaign(); campaign.name = "Interplanetary Cruise App #" + ExampleUtilities.GetRandomString(); campaign.status = CampaignStatus.PAUSED; // Set the advertising channel and subchannel types for universal app campaigns. campaign.advertisingChannelType = AdvertisingChannelType.MULTI_CHANNEL; campaign.advertisingChannelSubType = AdvertisingChannelSubType.UNIVERSAL_APP_CAMPAIGN; // Set the campaign's bidding strategy. Universal app campaigns // only support TARGET_CPA bidding strategy. BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration(); biddingConfig.biddingStrategyType = BiddingStrategyType.TARGET_CPA; // Set the target CPA to $1 / app install. TargetCpaBiddingScheme biddingScheme = new TargetCpaBiddingScheme(); biddingScheme.targetCpa = new Money(); biddingScheme.targetCpa.microAmount = 1000000; biddingConfig.biddingScheme = biddingScheme; campaign.biddingStrategyConfiguration = biddingConfig; // Set the campaign's budget. campaign.budget = new Budget(); campaign.budget.budgetId = CreateBudget(user).budgetId; // Optional: Set the start date. campaign.startDate = DateTime.Now.AddDays(1).ToString("yyyyMMdd"); // Optional: Set the end date. campaign.endDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd"); // [END prepareUAC] MOE:strip_line // [START setUACAssets] MOE:strip_line // Set the campaign's assets and ad text ideas. These values will be used to // generate ads. UniversalAppCampaignSetting universalAppSetting = new UniversalAppCampaignSetting(); universalAppSetting.appId = "com.interplanetarycruise.booking"; universalAppSetting.description1 = "Best Space Cruise Line"; universalAppSetting.description2 = "Visit all the planets"; universalAppSetting.description3 = "Trips 7 days a week"; universalAppSetting.description4 = "Buy your tickets now!"; // Optional: You can set up to 10 image assets for your campaign. // See UploadImage.cs for an example on how to upload images. // // universalAppSetting.imageMediaIds = new long[] { INSERT_IMAGE_MEDIA_ID_HERE }; // [END setUACAssets] MOE:strip_line // [START optimizeUAC] MOE:strip_line // Optimize this campaign for getting new users for your app. universalAppSetting.universalAppBiddingStrategyGoalType = UniversalAppBiddingStrategyGoalType.OPTIMIZE_FOR_INSTALL_CONVERSION_VOLUME; // Optional: If you select the OPTIMIZE_FOR_IN_APP_CONVERSION_VOLUME goal // type, then also specify your in-app conversion types so AdWords can // focus your campaign on people who are most likely to complete the // corresponding in-app actions. // Conversion type IDs can be retrieved using ConversionTrackerService.get. // // campaign.selectiveOptimization = new SelectiveOptimization(); // campaign.selectiveOptimization.conversionTypeIds = // new long[] { INSERT_CONVERSION_TYPE_ID_1_HERE, INSERT_CONVERSION_TYPE_ID_2_HERE }; // Optional: Set the campaign settings for Advanced location options. GeoTargetTypeSetting geoSetting = new GeoTargetTypeSetting(); geoSetting.positiveGeoTargetType = GeoTargetTypeSettingPositiveGeoTargetType.LOCATION_OF_PRESENCE; geoSetting.negativeGeoTargetType = GeoTargetTypeSettingNegativeGeoTargetType.DONT_CARE; campaign.settings = new Setting[] { universalAppSetting, geoSetting }; // [END optimizeUAC] MOE:strip_line // [START createUAC] MOE:strip_line // Create the operation. CampaignOperation operation = new CampaignOperation(); operation.@operator = Operator.ADD; operation.operand = campaign; try { // Add the campaign. CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] { operation }); // Display the results. if (retVal != null && retVal.value != null && retVal.value.Length > 0) { foreach (Campaign newCampaign in retVal.value) { Console.WriteLine("Universal app campaign with name = '{0}' and id = '{1}' was added.", newCampaign.name, newCampaign.id); // Optional: Set the campaign's location and language targeting. No other targeting // criteria can be used for universal app campaigns. SetCampaignTargetingCriteria(user, newCampaign); } } else { Console.WriteLine("No universal app campaigns were added."); } } catch (Exception e) { throw new System.ApplicationException("Failed to add universal app campaigns.", e); } // [END createUAC] MOE:strip_line }
/// <summary> /// Gets the login status list /// </summary> private void GetLoginStatusList() { //AgentService objAgentService = new AgentService(); //DataSet ds = new DataSet(); //try //{ // ds = objAgentService.GetLoginStatusList(); //} //catch (Exception ex) //{ // PageMessage = ex.Message; //} //lbxLoginStatus.DataSource = ds; //lbxLoginStatus.DataTextField = "Status"; //lbxLoginStatus.DataValueField = "LoginStatusID"; //lbxLoginStatus.DataBind(); bool showManualDial = true; bool isVerificationAgent = false; try { Campaign objCampaign = (Campaign)Session["Campaign"]; CampaignService objCampaignService = new CampaignService(); XmlDocument xDocCampaign = new XmlDocument(); xDocCampaign.LoadXml(Serialize.SerializeObject(objCampaign, "Campaign")); OtherParameter objOtherParameter = (OtherParameter)Serialize.DeserializeObject( objCampaignService.GetOtherParameter(xDocCampaign), "OtherParameter"); // Check which agent modes are allowed by the campaign *** Add inbound in future if (objOtherParameter.OtherParameterID > 0) { showManualDial = objOtherParameter.AllowManualDial; } } catch { } try { if (Session["LoggedAgent"] != null) { Agent agent; agent = (Agent)Session["LoggedAgent"]; if (showManualDial) { showManualDial = agent.AllowManualDial; } isVerificationAgent = agent.VerificationAgent; } } catch { } lbxLoginStatus.Items.Add(new ListItem("Receive Outbound Calls Only", "Receive Outbound Calls Only")); if (showManualDial) { lbxLoginStatus.Items.Add(new ListItem("Manual Dial", "Manual Dial")); } if (isVerificationAgent) { lbxLoginStatus.Items.Add(new ListItem("Verification Only", "Verification Only")); lbxLoginStatus.Items.Add(new ListItem("Blended: Verification and Calls", "Blended: Verification and Outbound Calls")); } lbxLoginStatus.Items.Add(new ListItem("Select Another Campaign", "Select Another Campaign")); lbxLoginStatus.Items.Add(new ListItem("Log Off", "Log Off")); }