Beispiel #1
0
 public virtual void ReadFrom(XElement xE)
 {
     CustomerId                 = null;
     CurrencyCode               = null;
     DateTimeZone               = null;
     DescriptiveName            = null;
     CompanyName                = null;
     CanManageClients           = null;
     TestAccount                = null;
     AutoTaggingEnabled         = null;
     TrackingUrlTemplate        = null;
     ConversionTrackingSettings = null;
     RemarketingSettings        = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "customerId")
         {
             CustomerId = long.Parse(xItem.Value);
         }
         else if (localName == "currencyCode")
         {
             CurrencyCode = xItem.Value;
         }
         else if (localName == "dateTimeZone")
         {
             DateTimeZone = xItem.Value;
         }
         else if (localName == "descriptiveName")
         {
             DescriptiveName = xItem.Value;
         }
         else if (localName == "companyName")
         {
             CompanyName = xItem.Value;
         }
         else if (localName == "canManageClients")
         {
             CanManageClients = bool.Parse(xItem.Value);
         }
         else if (localName == "testAccount")
         {
             TestAccount = bool.Parse(xItem.Value);
         }
         else if (localName == "autoTaggingEnabled")
         {
             AutoTaggingEnabled = bool.Parse(xItem.Value);
         }
         else if (localName == "trackingUrlTemplate")
         {
             TrackingUrlTemplate = xItem.Value;
         }
         else if (localName == "conversionTrackingSettings")
         {
             ConversionTrackingSettings = new ConversionTrackingSettings();
             ConversionTrackingSettings.ReadFrom(xItem);
         }
         else if (localName == "remarketingSettings")
         {
             RemarketingSettings = new RemarketingSettings();
             RemarketingSettings.ReadFrom(xItem);
         }
     }
 }
Beispiel #2
0
        public virtual void WriteTo(XElement xE)
        {
            XElement xItem = null;

            if (CustomerId != null)
            {
                xItem = new XElement(XName.Get("customerId", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(CustomerId.Value.ToString());
                xE.Add(xItem);
            }
            if (CurrencyCode != null)
            {
                xItem = new XElement(XName.Get("currencyCode", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(CurrencyCode);
                xE.Add(xItem);
            }
            if (DateTimeZone != null)
            {
                xItem = new XElement(XName.Get("dateTimeZone", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(DateTimeZone);
                xE.Add(xItem);
            }
            if (DescriptiveName != null)
            {
                xItem = new XElement(XName.Get("descriptiveName", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(DescriptiveName);
                xE.Add(xItem);
            }
            if (CompanyName != null)
            {
                xItem = new XElement(XName.Get("companyName", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(CompanyName);
                xE.Add(xItem);
            }
            if (CanManageClients != null)
            {
                xItem = new XElement(XName.Get("canManageClients", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(CanManageClients.Value.ToString());
                xE.Add(xItem);
            }
            if (TestAccount != null)
            {
                xItem = new XElement(XName.Get("testAccount", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(TestAccount.Value.ToString());
                xE.Add(xItem);
            }
            if (AutoTaggingEnabled != null)
            {
                xItem = new XElement(XName.Get("autoTaggingEnabled", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(AutoTaggingEnabled.Value.ToString());
                xE.Add(xItem);
            }
            if (TrackingUrlTemplate != null)
            {
                xItem = new XElement(XName.Get("trackingUrlTemplate", "https://adwords.google.com/api/adwords/mcm/v201609"));
                xItem.Add(TrackingUrlTemplate);
                xE.Add(xItem);
            }
            if (ConversionTrackingSettings != null)
            {
                xItem = new XElement(XName.Get("conversionTrackingSettings", "https://adwords.google.com/api/adwords/mcm/v201609"));
                ConversionTrackingSettings.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (RemarketingSettings != null)
            {
                xItem = new XElement(XName.Get("remarketingSettings", "https://adwords.google.com/api/adwords/mcm/v201609"));
                RemarketingSettings.WriteTo(xItem);
                xE.Add(xItem);
            }
        }