コード例 #1
0
        public override void WriteTo(XElement xE)
        {
            base.WriteTo(xE);
            XmlUtility.SetXsiType(xE, "https://adwords.google.com/api/adwords/cm/v201609", "BiddableAdGroupCriterion");
            XElement xItem = null;

            if (UserStatus != null)
            {
                xItem = new XElement(XName.Get("userStatus", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(UserStatus.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (SystemServingStatus != null)
            {
                xItem = new XElement(XName.Get("systemServingStatus", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(SystemServingStatus.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (ApprovalStatus != null)
            {
                xItem = new XElement(XName.Get("approvalStatus", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(ApprovalStatus.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (DisapprovalReasons != null)
            {
                foreach (var disapprovalReasonsItem in DisapprovalReasons)
                {
                    xItem = new XElement(XName.Get("disapprovalReasons", "https://adwords.google.com/api/adwords/cm/v201609"));
                    xItem.Add(disapprovalReasonsItem);
                    xE.Add(xItem);
                }
            }
            if (DestinationUrl != null)
            {
                xItem = new XElement(XName.Get("destinationUrl", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(DestinationUrl);
                xE.Add(xItem);
            }
            if (FirstPageCpc != null)
            {
                xItem = new XElement(XName.Get("firstPageCpc", "https://adwords.google.com/api/adwords/cm/v201609"));
                FirstPageCpc.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (TopOfPageCpc != null)
            {
                xItem = new XElement(XName.Get("topOfPageCpc", "https://adwords.google.com/api/adwords/cm/v201609"));
                TopOfPageCpc.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (FirstPositionCpc != null)
            {
                xItem = new XElement(XName.Get("firstPositionCpc", "https://adwords.google.com/api/adwords/cm/v201609"));
                FirstPositionCpc.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (QualityInfo != null)
            {
                xItem = new XElement(XName.Get("qualityInfo", "https://adwords.google.com/api/adwords/cm/v201609"));
                QualityInfo.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (BiddingStrategyConfiguration != null)
            {
                xItem = new XElement(XName.Get("biddingStrategyConfiguration", "https://adwords.google.com/api/adwords/cm/v201609"));
                BiddingStrategyConfiguration.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (BidModifier != null)
            {
                xItem = new XElement(XName.Get("bidModifier", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(BidModifier.Value.ToString());
                xE.Add(xItem);
            }
            if (FinalUrls != null)
            {
                xItem = new XElement(XName.Get("finalUrls", "https://adwords.google.com/api/adwords/cm/v201609"));
                FinalUrls.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (FinalMobileUrls != null)
            {
                xItem = new XElement(XName.Get("finalMobileUrls", "https://adwords.google.com/api/adwords/cm/v201609"));
                FinalMobileUrls.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (FinalAppUrls != null)
            {
                xItem = new XElement(XName.Get("finalAppUrls", "https://adwords.google.com/api/adwords/cm/v201609"));
                FinalAppUrls.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (TrackingUrlTemplate != null)
            {
                xItem = new XElement(XName.Get("trackingUrlTemplate", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(TrackingUrlTemplate);
                xE.Add(xItem);
            }
            if (UrlCustomParameters != null)
            {
                xItem = new XElement(XName.Get("urlCustomParameters", "https://adwords.google.com/api/adwords/cm/v201609"));
                UrlCustomParameters.WriteTo(xItem);
                xE.Add(xItem);
            }
        }
コード例 #2
0
 public override void ReadFrom(XElement xE)
 {
     base.ReadFrom(xE);
     UserStatus                   = null;
     SystemServingStatus          = null;
     ApprovalStatus               = null;
     DisapprovalReasons           = null;
     DestinationUrl               = null;
     FirstPageCpc                 = null;
     TopOfPageCpc                 = null;
     FirstPositionCpc             = null;
     QualityInfo                  = null;
     BiddingStrategyConfiguration = null;
     BidModifier                  = null;
     FinalUrls           = null;
     FinalMobileUrls     = null;
     FinalAppUrls        = null;
     TrackingUrlTemplate = null;
     UrlCustomParameters = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "userStatus")
         {
             UserStatus = UserStatusExtensions.Parse(xItem.Value);
         }
         else if (localName == "systemServingStatus")
         {
             SystemServingStatus = SystemServingStatusExtensions.Parse(xItem.Value);
         }
         else if (localName == "approvalStatus")
         {
             ApprovalStatus = ApprovalStatusExtensions.Parse(xItem.Value);
         }
         else if (localName == "disapprovalReasons")
         {
             if (DisapprovalReasons == null)
             {
                 DisapprovalReasons = new List <string>();
             }
             DisapprovalReasons.Add(xItem.Value);
         }
         else if (localName == "destinationUrl")
         {
             DestinationUrl = xItem.Value;
         }
         else if (localName == "firstPageCpc")
         {
             FirstPageCpc = new Bid();
             FirstPageCpc.ReadFrom(xItem);
         }
         else if (localName == "topOfPageCpc")
         {
             TopOfPageCpc = new Bid();
             TopOfPageCpc.ReadFrom(xItem);
         }
         else if (localName == "firstPositionCpc")
         {
             FirstPositionCpc = new Bid();
             FirstPositionCpc.ReadFrom(xItem);
         }
         else if (localName == "qualityInfo")
         {
             QualityInfo = new QualityInfo();
             QualityInfo.ReadFrom(xItem);
         }
         else if (localName == "biddingStrategyConfiguration")
         {
             BiddingStrategyConfiguration = new BiddingStrategyConfiguration();
             BiddingStrategyConfiguration.ReadFrom(xItem);
         }
         else if (localName == "bidModifier")
         {
             BidModifier = double.Parse(xItem.Value);
         }
         else if (localName == "finalUrls")
         {
             FinalUrls = new UrlList();
             FinalUrls.ReadFrom(xItem);
         }
         else if (localName == "finalMobileUrls")
         {
             FinalMobileUrls = new UrlList();
             FinalMobileUrls.ReadFrom(xItem);
         }
         else if (localName == "finalAppUrls")
         {
             FinalAppUrls = new AppUrlList();
             FinalAppUrls.ReadFrom(xItem);
         }
         else if (localName == "trackingUrlTemplate")
         {
             TrackingUrlTemplate = xItem.Value;
         }
         else if (localName == "urlCustomParameters")
         {
             UrlCustomParameters = new CustomParameters();
             UrlCustomParameters.ReadFrom(xItem);
         }
     }
 }