Exemplo n.º 1
0
 public virtual void ReadFrom(XElement xE)
 {
     BiddingStrategyId     = null;
     BiddingStrategyName   = null;
     BiddingStrategyType   = null;
     BiddingStrategySource = null;
     BiddingScheme         = null;
     Bids = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "biddingStrategyId")
         {
             BiddingStrategyId = long.Parse(xItem.Value);
         }
         else if (localName == "biddingStrategyName")
         {
             BiddingStrategyName = xItem.Value;
         }
         else if (localName == "biddingStrategyType")
         {
             BiddingStrategyType = BiddingStrategyTypeExtensions.Parse(xItem.Value);
         }
         else if (localName == "biddingStrategySource")
         {
             BiddingStrategySource = BiddingStrategySourceExtensions.Parse(xItem.Value);
         }
         else if (localName == "biddingScheme")
         {
             BiddingScheme = InstanceCreator.CreateBiddingScheme(xItem);
             BiddingScheme.ReadFrom(xItem);
         }
         else if (localName == "bids")
         {
             if (Bids == null)
             {
                 Bids = new List <Bids>();
             }
             var bidsItem = InstanceCreator.CreateBids(xItem);
             bidsItem.ReadFrom(xItem);
             Bids.Add(bidsItem);
         }
     }
 }
Exemplo n.º 2
0
        public virtual void WriteTo(XElement xE)
        {
            XElement xItem = null;

            if (BiddingStrategyId != null)
            {
                xItem = new XElement(XName.Get("biddingStrategyId", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(BiddingStrategyId.Value.ToString());
                xE.Add(xItem);
            }
            if (BiddingStrategyName != null)
            {
                xItem = new XElement(XName.Get("biddingStrategyName", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(BiddingStrategyName);
                xE.Add(xItem);
            }
            if (BiddingStrategyType != null)
            {
                xItem = new XElement(XName.Get("biddingStrategyType", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(BiddingStrategyType.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (BiddingStrategySource != null)
            {
                xItem = new XElement(XName.Get("biddingStrategySource", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(BiddingStrategySource.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (BiddingScheme != null)
            {
                xItem = new XElement(XName.Get("biddingScheme", "https://adwords.google.com/api/adwords/cm/v201609"));
                BiddingScheme.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (Bids != null)
            {
                foreach (var bidsItem in Bids)
                {
                    xItem = new XElement(XName.Get("bids", "https://adwords.google.com/api/adwords/cm/v201609"));
                    bidsItem.WriteTo(xItem);
                    xE.Add(xItem);
                }
            }
        }
Exemplo n.º 3
0
        public virtual void WriteTo(XElement xE)
        {
            XElement xItem = null;

            if (BiddingScheme != null)
            {
                xItem = new XElement(XName.Get("biddingScheme", "https://adwords.google.com/api/adwords/cm/v201609"));
                BiddingScheme.WriteTo(xItem);
                xE.Add(xItem);
            }
            if (Id != null)
            {
                xItem = new XElement(XName.Get("id", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(Id.Value.ToString());
                xE.Add(xItem);
            }
            if (Name != null)
            {
                xItem = new XElement(XName.Get("name", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(Name);
                xE.Add(xItem);
            }
            if (Status != null)
            {
                xItem = new XElement(XName.Get("status", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(Status.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (Type != null)
            {
                xItem = new XElement(XName.Get("type", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(Type.Value.ToXmlValue());
                xE.Add(xItem);
            }
            if (SystemStatus != null)
            {
                xItem = new XElement(XName.Get("systemStatus", "https://adwords.google.com/api/adwords/cm/v201609"));
                xItem.Add(SystemStatus.Value.ToXmlValue());
                xE.Add(xItem);
            }
        }
Exemplo n.º 4
0
 public virtual void ReadFrom(XElement xE)
 {
     BiddingScheme = null;
     Id            = null;
     Name          = null;
     Status        = null;
     Type          = null;
     SystemStatus  = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "biddingScheme")
         {
             BiddingScheme = InstanceCreator.CreateBiddingScheme(xItem);
             BiddingScheme.ReadFrom(xItem);
         }
         else if (localName == "id")
         {
             Id = long.Parse(xItem.Value);
         }
         else if (localName == "name")
         {
             Name = xItem.Value;
         }
         else if (localName == "status")
         {
             Status = SharedBiddingStrategyBiddingStrategyStatusExtensions.Parse(xItem.Value);
         }
         else if (localName == "type")
         {
             Type = BiddingStrategyTypeExtensions.Parse(xItem.Value);
         }
         else if (localName == "systemStatus")
         {
             SystemStatus = BiddingStrategySystemStatusExtensions.Parse(xItem.Value);
         }
     }
 }