/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Create AdvertiserRemoteService instance. AdvertiserRemoteService service = (AdvertiserRemoteService) user.GetService( DfaService.v1_20.AdvertiserRemoteService); long networkId = long.Parse(_T("INSERT_NETWORK_ID_HERE")); string advertiserName = _T("INSERT_ADVERTISER_NAME_HERE"); // Create advertiser structure. Advertiser advertiser = new Advertiser(); advertiser.name = advertiserName; advertiser.networkId = networkId; advertiser.id = 0; advertiser.advertiserGroupId = 0; advertiser.approved = true; try { // Create advertiser. AdvertiserSaveResult result = service.saveAdvertiser(advertiser); if (result != null) { // Display advertiser id. Console.WriteLine("Advertiser with id \"{0}\" was created.", result.id); } else { Console.WriteLine("Could not create advertiser for the specified network id."); } } catch (Exception ex) { Console.WriteLine("Failed to create advertiser. Exception says \"{0}\"", ex.Message); } }
public AdvertiserSaveResult saveAdvertiser(Advertiser advertiser) { object[] results = this.Invoke("saveAdvertiser", new object[] {advertiser}); return ((AdvertiserSaveResult) (results[0])); }