internal override void ProcessMappingsToRowValues(RowValues rowValues, bool excludeReadonlyData) { foreach (var pair in Values) { rowValues[pair.Key] = pair.Value; } }
/// <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 void ReadFromRowValues(RowValues values) { values.ConvertToEntity(this, 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) { SiteLink = new SiteLink(); Identifier.ReadFromRowValues(values); values.ConvertToEntity(this, Mappings); }
internal override void ProcessMappingsFromRowValues(RowValues values) { AdGroup = new AdGroup { AdDistribution = 0 }; values.ConvertToEntity(this, Mappings); QualityScoreData = QualityScoreData.ReadFromRowValuesOrNull(values); PerformanceData = PerformanceData.ReadFromRowValuesOrNull(values); }
internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData) { this.ConvertToValues(values, Mappings); if (!excludeReadonlyData) { PerformanceData.WriteToRowValuesIfNotNull(PerformanceData, values); } }
internal override void ProcessMappingsFromRowValues(RowValues values) { ProductConditionCollection = new ProductConditionCollection { Conditions = new List<ProductCondition>() }; Identifier.ReadFromRowValues(values); values.ConvertToEntity(this, Mappings); }
private static void BudgetToCsv(BulkCampaign c, RowValues values) { var budgetType = c.Campaign.BudgetType; if (budgetType == null) { return; } values[StringTable.Budget] = budgetType == BudgetLimitType.DailyBudgetAccelerated || budgetType == BudgetLimitType.DailyBudgetStandard ? c.Campaign.DailyBudget.ToBulkString() : c.Campaign.MonthlyBudget.ToBulkString(); }
private static void CsvToBudget(RowValues values, BulkCampaign c) { string budgetTypeRowValue; BudgetLimitType? budgetType; if (!values.TryGetValue(StringTable.BudgetType, out budgetTypeRowValue) || (budgetType = budgetTypeRowValue.ParseOptional<BudgetLimitType>()) == null) { return; } string budgetRowValue; if (!values.TryGetValue(StringTable.Budget, out budgetRowValue)) { return; } var budgetValue = budgetRowValue.ParseOptional<double>(); c.Campaign.BudgetType = budgetType; if (budgetType == BudgetLimitType.DailyBudgetAccelerated || budgetType == BudgetLimitType.DailyBudgetStandard) { c.Campaign.DailyBudget = budgetValue; } else { c.Campaign.MonthlyBudget = budgetValue; } }
internal override void ProcessMappingsFromRowValues(RowValues values) { Campaign = new Campaign(); values.ConvertToEntity(this, Mappings); QualityScoreData = QualityScoreData.ReadFromRowValuesOrNull(values); PerformanceData = PerformanceData.ReadFromRowValuesOrNull(values); }
internal static void WriteToRowValuesIfNotNull(PerformanceData performanceData, RowValues values) { if (performanceData != null) { performanceData.WriteToRowValues(values); } }
/// <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> internal virtual void WriteToRowValues(RowValues values) { throw new NotSupportedException(); }
internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData) { this.ConvertToValues(values, Mappings); }
private static void RowValuesToConditions(RowValues values, BulkCampaignProductScope c) { var product = (ProductScope)c.CampaignCriterion.Criterion; product.Conditions = new List<ProductCondition>(); ProductConditionHelper.AddConditionsFromRowValues(values, product.Conditions); }
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 ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData) { ValidatePropertyNotNull(ProductConditionCollection, "ProductConditionCollection"); ValidatePropertyNotNull(ProductConditionCollection.Conditions, "ProductConditionCollection.Conditions"); Identifier.WriteToRowValues(values, excludeReadonlyData); this.ConvertToValues(values, Mappings); }
internal override void ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData) { ValidatePropertyNotNull(CampaignCriterion, typeof(CampaignCriterion).Name); this.ConvertToValues(values, Mappings); }
internal override void ProcessMappingsFromRowValues(RowValues values) { values.ConvertToEntity(this, Mappings); PerformanceData = PerformanceData.ReadFromRowValuesOrNull(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 ProcessMappingsToRowValues(RowValues values, bool excludeReadonlyData) { ValidatePropertyNotNull(AdGroup, "AdGroup"); this.ConvertToValues(values, Mappings); if (!excludeReadonlyData) { QualityScoreData.WriteToRowValuesIfNotNull(QualityScoreData, values); PerformanceData.WriteToRowValuesIfNotNull(PerformanceData, values); } }
internal override void ProcessMappingsToRowValues(RowValues values) { base.ProcessMappingsToRowValues(values); 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(); }
internal static void WriteToRowValuesIfNotNull(QualityScoreData qualityScoreData, RowValues values) { if (qualityScoreData != null) { qualityScoreData.WriteToRowValues(values); } }
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; }
private void WriteToRowValues(RowValues values) { this.ConvertToValues(values, Mappings); }
private static void RowValuesToConditions(RowValues values, BulkProductConditionCollection c) { ProductConditionHelper.AddConditionsFromRowValues(values, c.ProductConditionCollection.Conditions); }
/// <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(); }
private static void ConditionsToRowValues(BulkProductConditionCollection c, RowValues values) { ProductConditionHelper.AddRowValuesFromConditions(c.ProductConditionCollection.Conditions, values); }
internal override void ProcessMappingsFromRowValues(RowValues values) { values.ConvertToEntity(this, Mappings); }
internal override void ReadFromRowValues(RowValues values) { values.ConvertToEntity(this, Mappings); }