internal override void ProcessMappingsToRowValues(RowValues rowValues, bool excludeReadonlyData)
 {
     foreach (var pair in Values)
     {
         rowValues[pair.Key] = pair.Value;
     }
 }
 internal override void ProcessMappingsFromRowValues(RowValues values)
 {
     values.ConvertToEntity(this, Mappings);
 }
        public void WriteObjectRow(BulkObject bulkObject, bool excludeReadonlyData)
        {            
            var values = new RowValues();

            bulkObject.WriteToRowValues(values, excludeReadonlyData);

            values[StringTable.Type] = _bulkObjectFactory.GetBulkRowType(bulkObject);

            _streamWriter.WriteLine(_formatter.FormatCsvRow(values.Columns));
        }
        internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
        {
            ValidatePropertyNotNull(NegativeKeywordList, "NegativeKeywordList");

            this.ConvertToValues(values, Mappings);
        }
        internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
        {
            ValidatePropertyNotNull(Keyword, "Keyword");

            this.ConvertToValues(values, Mappings);

            if (!excludeReadonlyData)
            {
                QualityScoreData.WriteToRowValuesIfNotNull(QualityScoreData, values);

                PerformanceData.WriteToRowValuesIfNotNull(PerformanceData, values);
            }
        }
        private static void ConditionsToRowValues(BulkCampaignProductScope c, RowValues values)
        {
            if (c.CampaignCriterion.Criterion == null)
            {
                return;
            }

            var product = (ProductScope)c.CampaignCriterion.Criterion;

            if (product.Conditions == null)
            {
                return;
            }

            ProductConditionHelper.AddRowValuesFromConditions(product.Conditions, values);
        }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            CampaignCriterion = new CampaignCriterion
            {
                Criterion = new ProductScope
                {
                    Type = typeof(ProductScope).Name,
                },
                Type = typeof(CampaignCriterion).Name,
            };

            values.ConvertToEntity(this, Mappings);
        }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            RemarketingList = new RemarketingList { };

            values.ConvertToEntity(this, Mappings);
        }
        internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
        {
            ValidatePropertyNotNull(RemarketingList, "RemarketingList");

            this.ConvertToValues(values, Mappings);
        }
        internal static PerformanceData ReadFromRowValuesOrNull(RowValues values)
        {
            var performanceData = new PerformanceData();

            performanceData.ReadFromRowValues(values);

            return performanceData.HasAnyValues ? performanceData : null;            
        }
 internal static void WriteToRowValuesIfNotNull(PerformanceData performanceData, RowValues values)
 {
     if (performanceData != null)
     {
         performanceData.WriteToRowValues(values);
     }
 }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            NegativeCampaignCriterion = new NegativeCampaignCriterion()
            {
                Criterion = new Webpage()
                {
                    Parameter = new WebpageParameter(),
                    Type = typeof(Webpage).Name,
                },
                Type = typeof(NegativeCampaignCriterion).Name
            };

            values.ConvertToEntity(this, Mappings);
        }
示例#13
0
        public RowValues ReadNextRow()
        {
            if (_mappings == null)
            {
                _mappings = Headers.Select((i, h) => new { key = i, value = h }).ToDictionary(x => x.key, x => x.value);
            }

            if (!ReadNextRecord())
            {
                return null;
            }

            if (Columns == null)
            {
                return null;
            }

            var rowValues = new RowValues(Columns, _mappings);

            return rowValues;
        }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            values.ConvertToEntity(this, Mappings);

            PerformanceData = PerformanceData.ReadFromRowValuesOrNull(values);
        }
 /// <summary>
 /// Read object data from a single row.
 /// </summary>
 /// <example>
 /// SingleLineBulkEntity: reads entity fields.
 /// BulkError: reads error fields.
 /// BulkEntityIdentifier: reads identifier fields (Id, status etc.).
 /// </example>
 /// <param name="values"></param>
 internal virtual void ReadFromRowValues(RowValues values)
 {
     throw new NotSupportedException();
 }
示例#16
0
 /// <summary>
 /// Read object data from a single row.                
 /// </summary>
 /// <example>
 /// SingleLineBulkEntity: reads entity fields.
 /// BulkError: reads error fields.
 /// BulkEntityIdentifier: reads identifier fields (Id, status etc.).
 /// </example>
 /// <param name="values"></param>
 internal virtual void ReadFromRowValues(RowValues values)
 {
     throw new NotSupportedException();
 }
        private static void RowValuesToConditions(RowValues values, BulkCampaignProductScope c)
        {
            var product = (ProductScope)c.CampaignCriterion.Criterion;

            product.Conditions = new List<ProductCondition>();

            ProductConditionHelper.AddConditionsFromRowValues(values, product.Conditions);
        }
示例#18
0
 /// <summary>
 /// Writes object data to a single row.        
 /// </summary>
 /// <example>
 /// SingleLineBulkEntity: writes entity fields.
 /// BulkEntityIdentifier: writes identifier fields (Id, status etc.)
 /// </example>
 /// <param name="values"></param>
 /// <param name="excludeReadonlyData"></param>
 internal virtual void WriteToRowValues(RowValues values, bool excludeReadonlyData)
 {
     throw new NotSupportedException();
 }
        internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
        {
            ValidatePropertyNotNull(CampaignCriterion, typeof(CampaignCriterion).Name);

            this.ConvertToValues(values, Mappings);
        }
        internal static QualityScoreData ReadFromRowValuesOrNull(RowValues values)
        {
            var qualityScoreData = new QualityScoreData();

            qualityScoreData.ReadFromRowValues(values);

            return qualityScoreData.HasAnyValues ? qualityScoreData : null;
        }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            NegativeKeywordList = new NegativeKeywordList { Type = "NegativeKeywordList" };

            values.ConvertToEntity(this, Mappings);
        }
 internal static void WriteToRowValuesIfNotNull(QualityScoreData qualityScoreData, RowValues values)
 {
     if (qualityScoreData != null)
     {
         qualityScoreData.WriteToRowValues(values);
     }
 }
示例#23
0
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            Keyword = new Keyword();

            values.ConvertToEntity(this, Mappings);

            QualityScoreData = QualityScoreData.ReadFromRowValuesOrNull(values);

            PerformanceData = PerformanceData.ReadFromRowValuesOrNull(values);            
        }        
 private void ReadFromRowValues(RowValues values)
 {
     values.ConvertToEntity(this, Mappings);
 }
        private void WriteFormatVersion()
        {
            var versionRow = new RowValues();

            versionRow[StringTable.Type] = StringTable.SemanticVersion;
            versionRow[StringTable.Name] = BulkServiceManager.FormatVersion;

            _streamWriter.WriteLine(_formatter.FormatCsvRow(versionRow.Columns));
        }
 private void WriteToRowValues(RowValues values)
 {
     this.ConvertToValues(values, Mappings);
 }
 internal override void ProcessMappingsFromRowValues(RowValues rowValues)
 {
     Values = rowValues.ToDictionary();
 }
        internal override void ProcessMappingsFromRowValues(RowValues values)
        {
            SiteLink = new SiteLink();

            Identifier.ReadFromRowValues(values);

            values.ConvertToEntity(this, Mappings);
        }
示例#29
0
 internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
 {
     this.ConvertToValues(values, Mappings);
 }
        internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData)
        {
            ValidatePropertyNotNull(SiteLink, "SiteLink");
            
            Identifier.WriteToRowValues(values, excludeReadonlyData);

            this.ConvertToValues(values, Mappings);
        }
        public BulkObject CreateBulkObject(RowValues values)
        {
            string type;

            if (!values.TryGetValue(StringTable.Type, out type))
            {
                throw new InvalidOperationException(ErrorMessages.TypeColumnNotFound);
            }

            if (type.EndsWith("Error"))
            {
                return new BulkError();
            }

            Func<BulkObject> additionalObjectFunc;

            if (AdditionalObjectMap.TryGetValue(type, out additionalObjectFunc))
            {
                return additionalObjectFunc();
            }

            EntityInfo info;

            if (!IndividualEntityMap.TryGetValue(type, out info))
            {
                return new UnknownBulkEntity();
            }            

            if (values[StringTable.Status] == "Deleted" &&
                !string.IsNullOrEmpty(info.DeleteAllColumnName) &&
                string.IsNullOrEmpty(values[info.DeleteAllColumnName]))
            {
                return info.CreateIdentifierFunc();
            }

            return info.CreateFunc();
        }
示例#32
0
 internal override void ReadFromRowValues(RowValues values)
 {
     values.ConvertToEntity(this, Mappings);
 }