Exemplo n.º 1
0
 /// <summary>
 /// Restores a sandbox client accounts under an mcc.
 /// </summary>
 /// <param name="account">The data to be restored to the accounts.</param>
 internal void UploadAccount(LocalClientAccount account) {
   SetCampaigns(account.Campaigns, account.CustomerId);
 }
Exemplo n.º 2
0
 /// <summary>
 /// A generic serialization function to serialize an Object as XML.
 /// </summary>
 /// <param name="accountNode">The XML node to which serialization
 /// happens.</param>
 /// <param name="client">The account details to be serialized.</param>
 private static void SerializeAccount(XmlElement accountNode, LocalClientAccount client) {
   MemoryStream memoryStream = new MemoryStream();
   XmlSerializer serializer = new XmlSerializer(typeof(LocalClientAccount));
   serializer.Serialize(memoryStream, client);
   memoryStream.Seek(0, SeekOrigin.Begin);
   XmlDocument xmldoc = new XmlDocument();
   xmldoc.Load(memoryStream);
   XmlNode importedNode = accountNode.OwnerDocument.ImportNode(xmldoc.DocumentElement, true);
   accountNode.AppendChild(importedNode);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Downloads a sandbox client account under an mcc. All the campaigns,
 /// adgroups, ads and criteria are downloaded by this function.
 /// </summary>
 /// <param name="customerId">The customer id for the account</param>
 /// <param name="campaignFields">The list of names of campaign fields that
 /// should be saved.</param>
 /// <param name="adGroupFields">The list of names of ad group fields that
 /// should be saved.</param>
 /// <param name="adFields">The list of names of ad fields that should be
 /// saved.</param>
 /// <param name="criterionFields">The list of names of criterion fields that
 /// should be saved.</param>
 /// <param name="campaignCriterionFields">The list of names of campaign
 /// criterion fields that should be saved.</param>
 /// <returns>The LocalClientAccount object representing this account.
 /// </returns>
 public LocalClientAccount DownloadAccount(long customerId, string[] campaignFields,
     string[] adGroupFields, string[] adFields, string[] criterionFields,
     string[] campaignCriterionFields) {
   LocalClientAccount account = new LocalClientAccount();
   account.CustomerId = customerId;
   account.Campaigns = new List<LocalCampaign>(GetAccountCampaigns(customerId, campaignFields,
       adGroupFields, adFields, criterionFields, campaignCriterionFields));
   return account;
 }