Beispiel #1
0
 public virtual void ReadFrom(XElement xE)
 {
     CriterionTypeGroup = null;
     TargetAll          = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "criterionTypeGroup")
         {
             CriterionTypeGroup = CriterionTypeGroupExtensions.Parse(xItem.Value);
         }
         else if (localName == "targetAll")
         {
             TargetAll = bool.Parse(xItem.Value);
         }
     }
 }
 public virtual void ReadFrom(XElement xE)
 {
     Id                           = null;
     CampaignId                   = null;
     CampaignName                 = null;
     Name                         = null;
     Status                       = null;
     Settings                     = null;
     Labels                       = null;
     ForwardCompatibilityMap      = null;
     BiddingStrategyConfiguration = null;
     ContentBidCriterionTypeGroup = null;
     BaseCampaignId               = null;
     BaseAdGroupId                = null;
     TrackingUrlTemplate          = null;
     UrlCustomParameters          = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "id")
         {
             Id = long.Parse(xItem.Value);
         }
         else if (localName == "campaignId")
         {
             CampaignId = long.Parse(xItem.Value);
         }
         else if (localName == "campaignName")
         {
             CampaignName = xItem.Value;
         }
         else if (localName == "name")
         {
             Name = xItem.Value;
         }
         else if (localName == "status")
         {
             Status = AdGroupStatusExtensions.Parse(xItem.Value);
         }
         else if (localName == "settings")
         {
             if (Settings == null)
             {
                 Settings = new List <Setting>();
             }
             var settingsItem = InstanceCreator.CreateSetting(xItem);
             settingsItem.ReadFrom(xItem);
             Settings.Add(settingsItem);
         }
         else if (localName == "labels")
         {
             if (Labels == null)
             {
                 Labels = new List <Label>();
             }
             var labelsItem = InstanceCreator.CreateLabel(xItem);
             labelsItem.ReadFrom(xItem);
             Labels.Add(labelsItem);
         }
         else if (localName == "forwardCompatibilityMap")
         {
             if (ForwardCompatibilityMap == null)
             {
                 ForwardCompatibilityMap = new List <String_StringMapEntry>();
             }
             var forwardCompatibilityMapItem = new String_StringMapEntry();
             forwardCompatibilityMapItem.ReadFrom(xItem);
             ForwardCompatibilityMap.Add(forwardCompatibilityMapItem);
         }
         else if (localName == "biddingStrategyConfiguration")
         {
             BiddingStrategyConfiguration = new BiddingStrategyConfiguration();
             BiddingStrategyConfiguration.ReadFrom(xItem);
         }
         else if (localName == "contentBidCriterionTypeGroup")
         {
             ContentBidCriterionTypeGroup = CriterionTypeGroupExtensions.Parse(xItem.Value);
         }
         else if (localName == "baseCampaignId")
         {
             BaseCampaignId = long.Parse(xItem.Value);
         }
         else if (localName == "baseAdGroupId")
         {
             BaseAdGroupId = long.Parse(xItem.Value);
         }
         else if (localName == "trackingUrlTemplate")
         {
             TrackingUrlTemplate = xItem.Value;
         }
         else if (localName == "urlCustomParameters")
         {
             UrlCustomParameters = new CustomParameters();
             UrlCustomParameters.ReadFrom(xItem);
         }
     }
 }