Ejemplo n.º 1
0
        private static void CsvToBiddingScheme(RowValues values, BulkAdGroup c)
        {
            string bidStrategyTypeRowValue;

            BiddingScheme biddingScheme;

            if (!values.TryGetValue(StringTable.BidStrategyType, out bidStrategyTypeRowValue) || (biddingScheme = bidStrategyTypeRowValue.ParseBiddingScheme()) == null)
            {
                return;
            }

            string inheritedBidStrategyTypeRowValue;

            values.TryGetValue(StringTable.InheritedBidStrategyType, out inheritedBidStrategyTypeRowValue);

            var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;

            if (inheritFromParentBiddingScheme != null)
            {
                c.AdGroup.BiddingScheme = new InheritFromParentBiddingScheme
                {
                    InheritedBidStrategyType = inheritedBidStrategyTypeRowValue,
                    Type = "InheritFromParent",
                };
            }
            else
            {
                c.AdGroup.BiddingScheme = biddingScheme;
            }
        }
Ejemplo n.º 2
0
        private static void CoOpSettingToCsv(BulkAdGroup c, RowValues values)
        {
            var setting = (CoOpSetting)c.GetSetting(typeof(CoOpSetting));

            if (setting == null)
            {
                return;
            }

            values[StringTable.BidOption]     = setting.BidOption.ToBulkString();
            values[StringTable.BidBoostValue] = setting.BidBoostValue.ToBulkString();
            values[StringTable.MaximumBid]    = setting.BidMaxValue.ToBulkString();
        }
Ejemplo n.º 3
0
        private static void BiddingSchemeToCsv(BulkAdGroup c, RowValues values)
        {
            var biddingScheme = c.AdGroup.BiddingScheme;

            if (biddingScheme == null)
            {
                return;
            }

            values[StringTable.BidStrategyType] = biddingScheme.ToBiddingSchemeBulkString();

            var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;

            if (inheritFromParentBiddingScheme != null)
            {
                values[StringTable.InheritedBidStrategyType] = inheritFromParentBiddingScheme.InheritedBidStrategyType;
            }
        }
Ejemplo n.º 4
0
        private static void CsvToCoOpSetting(RowValues values, BulkAdGroup c)
        {
            values.TryGetValue(StringTable.BidOption, out string bidOptionRowValue);
            values.TryGetValue(StringTable.BidBoostValue, out string bidBoostValueRowValue);
            values.TryGetValue(StringTable.MaximumBid, out string maximumBidRowValue);

            var bidOptionValue     = bidOptionRowValue?.ParseOptional <BidOption>();
            var bidBoostValueValue = bidBoostValueRowValue?.ParseOptional <double>();
            var maximumBidValue    = maximumBidRowValue?.ParseOptional <double>();

            if (bidOptionValue != null || bidBoostValueValue != null || maximumBidValue != null)
            {
                var setting = new CoOpSetting
                {
                    BidBoostValue = bidBoostValueValue,
                    BidMaxValue   = maximumBidValue,
                    BidOption     = bidOptionValue,
                    Type          = "CoOpSetting"
                };

                c.AddSetting(setting);
            }
        }