Пример #1
0
        private static void CsvToBiddingScheme(RowValues values, BulkKeyword 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.Keyword.BiddingScheme = new InheritFromParentBiddingScheme
                {
                    InheritedBidStrategyType = inheritedBidStrategyTypeRowValue,
                    Type = "InheritFromParent",
                };
            }
            else
            {
                c.Keyword.BiddingScheme = biddingScheme;
            }
        }
        private static void BiddingSchemeToCsv(BulkKeyword c, RowValues values)
        {
            var biddingScheme = c.Keyword.BiddingScheme;

            if (biddingScheme == null)
            {
                return;
            }

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

            var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;
            if (inheritFromParentBiddingScheme != null)
            {
                values[StringTable.InheritedBidStrategyType] = inheritFromParentBiddingScheme.InheritedBidStrategyType;
            }
        }