/// <summary> /// Creates the lead form extension. /// </summary> /// <param name="client">The Google Ads client.</param> /// <param name="customerId">The customer ID for which the call is made.</param> /// <param name="campaignId"> /// ID of the campaign to which lead form extensions are added. /// </param> /// <param name="leadFormAssetResourceName">The lead form asset resource name.</param> // [START add_lead_form_extension_1] private void CreateLeadFormExtension(GoogleAdsClient client, long customerId, long campaignId, string leadFormAssetResourceName) { CampaignAssetServiceClient campaignAssetService = client.GetService( Services.V10.CampaignAssetService); // Creates the campaign asset for the lead form. CampaignAsset campaignAsset = new CampaignAsset() { Asset = leadFormAssetResourceName, FieldType = AssetFieldTypeEnum.Types.AssetFieldType.LeadForm, Campaign = ResourceNames.Campaign(customerId, campaignId), }; CampaignAssetOperation operation = new CampaignAssetOperation() { Create = campaignAsset }; MutateCampaignAssetsResponse response = campaignAssetService.MutateCampaignAssets( customerId.ToString(), new[] { operation }); foreach (MutateCampaignAssetResult result in response.Results) { Console.WriteLine("Created campaign asset with resource name =" + $" '{result.ResourceName}' for campaign ID {campaignId}."); } }
/// <summary>Snippet for GetCampaignAsset</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCampaignAssetResourceNames() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) CampaignAssetName resourceName = CampaignAssetName.FromCustomerCampaignAssetFieldType("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[ASSET_ID]", "[FIELD_TYPE]"); // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(resourceName); }
/// <summary>Snippet for GetCampaignAsset</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCampaignAsset() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/campaignAssets/[CAMPAIGN_ASSET]"; // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(resourceName); }
/// <summary>Snippet for GetCampaignAssetAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetCampaignAssetResourceNamesAsync() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) CampaignAssetName resourceName = CampaignAssetName.FromCustomerCampaignAsset("[CUSTOMER]", "[CAMPAIGN_ASSET]"); // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(resourceName); }
/// <summary>Snippet for GetCampaignAssetAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetCampaignAssetAsync() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/campaignAssets/[CAMPAIGN_ASSET]"; // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(resourceName); }
/// <summary>Snippet for GetCampaignAsset</summary> public void GetCampaignAsset() { // Snippet: GetCampaignAsset(string, CallSettings) // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/campaignAssets/[CAMPAIGN_ID]~[ASSET_ID]~[FIELD_TYPE]"; // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignAsset</summary> public void GetCampaignAssetResourceNames() { // Snippet: GetCampaignAsset(CampaignAssetName, CallSettings) // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) CampaignAssetName resourceName = CampaignAssetName.FromCustomerCampaignAsset("[CUSTOMER]", "[CAMPAIGN_ASSET]"); // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignAsset</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetCampaignAssetRequestObject() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) GetCampaignAssetRequest request = new GetCampaignAssetRequest { ResourceNameAsCampaignAssetName = CampaignAssetName.FromCustomerCampaignAsset("[CUSTOMER]", "[CAMPAIGN_ASSET]"), }; // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(request); }
/// <summary>Snippet for GetCampaignAssetAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetCampaignAssetRequestObjectAsync() { // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) GetCampaignAssetRequest request = new GetCampaignAssetRequest { ResourceNameAsCampaignAssetName = CampaignAssetName.FromCustomerCampaignAssetFieldType("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[ASSET_ID]", "[FIELD_TYPE]"), }; // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(request); }
/// <summary>Snippet for GetCampaignAssetAsync</summary> public async Task GetCampaignAssetAsync() { // Snippet: GetCampaignAssetAsync(string, CallSettings) // Additional: GetCampaignAssetAsync(string, CancellationToken) // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/campaignAssets/[CAMPAIGN_ID]~[ASSET_ID]~[FIELD_TYPE]"; // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignAsset</summary> public void GetCampaignAssetRequestObject() { // Snippet: GetCampaignAsset(GetCampaignAssetRequest, CallSettings) // Create client CampaignAssetServiceClient campaignAssetServiceClient = CampaignAssetServiceClient.Create(); // Initialize request argument(s) GetCampaignAssetRequest request = new GetCampaignAssetRequest { ResourceNameAsCampaignAssetName = CampaignAssetName.FromCustomerCampaignAssetFieldType("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[ASSET_ID]", "[FIELD_TYPE]"), }; // Make the request CampaignAsset response = campaignAssetServiceClient.GetCampaignAsset(request); // End snippet }
/// <summary>Snippet for GetCampaignAssetAsync</summary> public async Task GetCampaignAssetResourceNamesAsync() { // Snippet: GetCampaignAssetAsync(CampaignAssetName, CallSettings) // Additional: GetCampaignAssetAsync(CampaignAssetName, CancellationToken) // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) CampaignAssetName resourceName = CampaignAssetName.FromCustomerCampaignAssetFieldType("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[ASSET_ID]", "[FIELD_TYPE]"); // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(resourceName); // End snippet }
/// <summary>Snippet for GetCampaignAssetAsync</summary> public async Task GetCampaignAssetRequestObjectAsync() { // Snippet: GetCampaignAssetAsync(GetCampaignAssetRequest, CallSettings) // Additional: GetCampaignAssetAsync(GetCampaignAssetRequest, CancellationToken) // Create client CampaignAssetServiceClient campaignAssetServiceClient = await CampaignAssetServiceClient.CreateAsync(); // Initialize request argument(s) GetCampaignAssetRequest request = new GetCampaignAssetRequest { ResourceNameAsCampaignAssetName = CampaignAssetName.FromCustomerCampaignAsset("[CUSTOMER]", "[CAMPAIGN_ASSET]"), }; // Make the request CampaignAsset response = await campaignAssetServiceClient.GetCampaignAssetAsync(request); // End snippet }
public ActionResult CloneConfirmed(Guid id) { var camps = Db.Campaigns.ToList(); int newOrderNumber = camps.Count > 0 ? camps.Max(x => int.Parse(x.OrderNumber.TrimEnd("RDP".ToCharArray()))) + 1 : 2500; Campaign campaign = Db.Campaigns .Include(x => x.Assets) .Include(x => x.Segments) .Include(x => x.Testing) .Include(x => x.Approved) .FirstOrDefault(x => x.Id == id); var copyId = Guid.NewGuid(); var copy = new Campaign(); Db.Campaigns.Add(copy); Db.Entry(copy).CurrentValues.SetValues(Db.Entry(campaign).CurrentValues); copy.Id = copyId; copy.CreatedAt = DateTime.Now; copy.OrderNumber = newOrderNumber.ToString(); copy.Status = (int)CampaignStatus.OrderRecevied; copy.TestingId = null; copy.ApprovedId = null; Db.SaveChanges(); var copyAssets = new CampaignAsset(); Db.CampaignAssets.Add(copyAssets); Db.Entry(copyAssets).CurrentValues.SetValues(Db.Entry(campaign.Assets).CurrentValues); copyAssets.Id = Guid.NewGuid(); copyAssets.CampaignId = copyId; copyAssets.CreatedAt = DateTime.Now; Db.SaveChanges(); copy.AssetsId = copyAssets.Id; Db.SaveChanges(); foreach (var segment in campaign.Segments.ToList()) { var copySegment = new CampaignSegment(); Db.CampaignSegments.Add(copySegment); Db.Entry(copySegment).CurrentValues.SetValues(Db.Entry(segment).CurrentValues); copySegment.Id = Guid.NewGuid(); copySegment.CampaignId = copyId; copySegment.OrderNumber = "" + newOrderNumber; copySegment.CreatedAt = DateTime.Now; Db.SaveChanges(); } if (campaign.Testing != null) { //var testingId = Guid.NewGuid(); //var testing = new CampaignTesting(); //Db.CampaignsTesting.Add(testing); //Db.Entry(testing).CurrentValues.SetValues(Db.Entry(campaign.Testing).CurrentValues); //testing.Id = testingId; //testing.CreatedAt = DateTime.Now; //testing.CampaignId = copy.Id; //Db.SaveChanges(); //copy.TestingId = testingId; //Db.SaveChanges(); // don't add new testing, update some values from testing copy.CampaignName = campaign.Testing.CampaignName; copy.WhiteLabel = campaign.Testing.WhiteLabel; copy.FromLine = campaign.Testing.FromLine; copy.SubjectLine = campaign.Testing.SubjectLine; copy.BroadcastDate = campaign.Testing.DeployDate; copy.Quantity = campaign.Testing.Quantity; copy.ReBroadcastDate = campaign.Testing.ReBroadcastDate; copy.GeoDetails = campaign.Testing.GeoDetails; copy.Demographics = campaign.Testing.Demographics; copy.SpecialInstructions = campaign.Testing.SpecialInstructions; copy.IsOpenPixel = campaign.Testing.IsOpenPixel; copy.OpenPixelUrl = campaign.Testing.OpenPixelUrl; Db.SaveChanges(); } if (campaign.Approved != null) { //var approvedId = Guid.NewGuid(); //var approved = new CampaignApproved(); //Db.CampaignsApproved.Add(approved); //Db.Entry(approved).CurrentValues.SetValues(Db.Entry(campaign.Approved).CurrentValues); //approved.Id = approvedId; //approved.CreatedAt = DateTime.Now; //approved.CampaignId = copy.Id; //Db.SaveChanges(); //copy.ApprovedId = approvedId; //Db.SaveChanges(); // don't add new approved, update copy some values from approved copy.CampaignName = campaign.Approved.CampaignName; copy.WhiteLabel = campaign.Approved.WhiteLabel; copy.FromLine = campaign.Approved.FromLine; copy.SubjectLine = campaign.Approved.SubjectLine; copy.BroadcastDate = campaign.Approved.DeployDate; copy.Quantity = campaign.Approved.Quantity; copy.ReBroadcastDate = campaign.Approved.ReBroadcastDate; copy.GeoDetails = campaign.Approved.GeoDetails; copy.Demographics = campaign.Approved.Demographics; copy.SpecialInstructions = campaign.Approved.SpecialInstructions; copy.IsOpenPixel = campaign.Approved.IsOpenPixel; copy.OpenPixelUrl = campaign.Approved.OpenPixelUrl; Db.SaveChanges(); } ForceOrders = true; TempData["Success"] = "Order : " + campaign.OrderNumber + " has been cloned to Order: " + newOrderNumber + " sucessfully."; return(RedirectToAction("Index", "Campaigns")); }
protected override void Seed(WfpictContext context) { // Look for any students. if (context.Users.Any()) { return; // DB has been seeded } var userManager = new UserManager <WfpUser>(new UserStore <WfpUser>(context)); var appUser = new WfpUser { Id = Guid.NewGuid().ToString(), CreatedAt = DateTime.Now, UserName = "******", Email = "*****@*****.**", Status = (int)UserStatus.Active, UserType = (int)UserType.Admin }; var result = userManager.CreateAsync(appUser, "P@kistan1"); if (result.Result == IdentityResult.Success) { //Success } appUser = new WfpUser { Id = Guid.NewGuid().ToString(), CreatedAt = DateTime.Now, UserName = "******", Email = "*****@*****.**", Status = (int)UserStatus.Active, UserType = (int)UserType.User }; result = userManager.CreateAsync(appUser, "P@kistan1"); if (result.Result == IdentityResult.Success) { //Success } var compaignId = Guid.NewGuid(); var asset = new CampaignAsset() { Id = Guid.NewGuid(), CreatedAt = DateTime.Now, CampaignId = compaignId, ZipCodeFile = "2500/2500zip.csv", CreativeFiles = "2500/2500_html.zip", TestSeedFile = "2500/2500test.csv", LiveSeedFile = "2500/2500live.csv", SuppressionFile = "2500/2500supp.csv", }; var campaigns = new Campaign[] { new Campaign { Id = compaignId, CreatedAt = DateTime.Now, CreatedBy = "josh.silver", Status = (int)CampaignStatus.OrderRecevied, CampaignName = "Car Dealership 123", BroadcastDate = DateTime.Now.AddDays(5), RepresentativeName = "Josh Silver", RepresentativeEmail = "*****@*****.**", ReBroadCast = true, ReBroadcastDate = DateTime.Now.AddMonths(1), Price = 10000, TestingUrgency = (int)TestingUrgency.One_Three_Hour, GeoDetails = "1 km around 5432", Demographics = "NY", Quantity = 100000, FromLine = "Testing", SubjectLine = "This is testing", IsPersonalization = true, IsMatchback = false, IsSuppression = true, WhiteLabel = "reporting.consumermkts.com", OptOut = "MM", SpecialInstructions = "Hello, this is special instructions, please do it quickly", OrderNumber = "2500", IsOpenPixel = true, OpenPixelUrl = "http://www.opened.com/pix101", DataFileQuantity = 1800, Assets = asset } }; foreach (var campaign in campaigns) { context.Campaigns.Add(campaign); } context.SaveChanges(); var vendor = new Vendor() { Id = Guid.NewGuid(), CreatedAt = DateTime.Now, Email = "*****@*****.**", CcEmails = @"[email protected],[email protected],[email protected],[email protected],[email protected]", Name = "Test Vendor", CompanyName = "Vendor Company" }; context.Vendors.Add(vendor); context.SaveChanges(); }