public override void ReadFrom(XElement xE) { base.ReadFrom(xE); NetworkSetting = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "networkSetting") { NetworkSetting = new NetworkSetting(); NetworkSetting.ReadFrom(xItem); } } }
public override void ReadFrom(XElement xE) { base.ReadFrom(xE); CampaignId = null; AdGroupEstimateRequests = null; Criteria = null; NetworkSetting = null; DailyBudget = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "campaignId") { CampaignId = long.Parse(xItem.Value); } else if (localName == "adGroupEstimateRequests") { if (AdGroupEstimateRequests == null) { AdGroupEstimateRequests = new List <AdGroupEstimateRequest>(); } var adGroupEstimateRequestsItem = new AdGroupEstimateRequest(); adGroupEstimateRequestsItem.ReadFrom(xItem); AdGroupEstimateRequests.Add(adGroupEstimateRequestsItem); } else if (localName == "criteria") { if (Criteria == null) { Criteria = new List <Criterion>(); } var criteriaItem = InstanceCreator.CreateCriterion(xItem); criteriaItem.ReadFrom(xItem); Criteria.Add(criteriaItem); } else if (localName == "networkSetting") { NetworkSetting = new NetworkSetting(); NetworkSetting.ReadFrom(xItem); } else if (localName == "dailyBudget") { DailyBudget = new Money(); DailyBudget.ReadFrom(xItem); } } }
public virtual void ReadFrom(XElement xE) { Id = null; Name = null; Status = null; ServingStatus = null; StartDate = null; EndDate = null; Budget = null; ConversionOptimizerEligibility = null; AdServingOptimizationStatus = null; FrequencyCap = null; Settings = null; AdvertisingChannelType = null; AdvertisingChannelSubType = null; NetworkSetting = null; Labels = null; BiddingStrategyConfiguration = null; CampaignTrialType = null; BaseCampaignId = null; ForwardCompatibilityMap = null; TrackingUrlTemplate = null; UrlCustomParameters = null; VanityPharma = null; SelectiveOptimization = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "id") { Id = long.Parse(xItem.Value); } else if (localName == "name") { Name = xItem.Value; } else if (localName == "status") { Status = CampaignStatusExtensions.Parse(xItem.Value); } else if (localName == "servingStatus") { ServingStatus = ServingStatusExtensions.Parse(xItem.Value); } else if (localName == "startDate") { StartDate = xItem.Value; } else if (localName == "endDate") { EndDate = xItem.Value; } else if (localName == "budget") { Budget = new Budget(); Budget.ReadFrom(xItem); } else if (localName == "conversionOptimizerEligibility") { ConversionOptimizerEligibility = new ConversionOptimizerEligibility(); ConversionOptimizerEligibility.ReadFrom(xItem); } else if (localName == "adServingOptimizationStatus") { AdServingOptimizationStatus = AdServingOptimizationStatusExtensions.Parse(xItem.Value); } else if (localName == "frequencyCap") { FrequencyCap = new FrequencyCap(); FrequencyCap.ReadFrom(xItem); } 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 == "advertisingChannelType") { AdvertisingChannelType = AdvertisingChannelTypeExtensions.Parse(xItem.Value); } else if (localName == "advertisingChannelSubType") { AdvertisingChannelSubType = AdvertisingChannelSubTypeExtensions.Parse(xItem.Value); } else if (localName == "networkSetting") { NetworkSetting = new NetworkSetting(); NetworkSetting.ReadFrom(xItem); } 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 == "biddingStrategyConfiguration") { BiddingStrategyConfiguration = new BiddingStrategyConfiguration(); BiddingStrategyConfiguration.ReadFrom(xItem); } else if (localName == "campaignTrialType") { CampaignTrialType = CampaignTrialTypeExtensions.Parse(xItem.Value); } else if (localName == "baseCampaignId") { BaseCampaignId = long.Parse(xItem.Value); } 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 == "trackingUrlTemplate") { TrackingUrlTemplate = xItem.Value; } else if (localName == "urlCustomParameters") { UrlCustomParameters = new CustomParameters(); UrlCustomParameters.ReadFrom(xItem); } else if (localName == "vanityPharma") { VanityPharma = new VanityPharma(); VanityPharma.ReadFrom(xItem); } else if (localName == "selectiveOptimization") { SelectiveOptimization = new SelectiveOptimization(); SelectiveOptimization.ReadFrom(xItem); } } }