/// <summary> /// Prices for row. /// </summary> /// <param name="row">The row.</param> /// <returns></returns> public double PriceForRow(UPSEOrderRow row) { double basePrice = this.BasePriceForRow(row); if (this.ComputePriceForQuantity1 && basePrice == 0) { UPSERowPricing rowPricing = this.RowPricingForRow(row); if (rowPricing.HasUnitPrice) { return(rowPricing.UnitPriceForQuantityRowPrice(1, 0)); } } return(basePrice); }
private UPSEPrice PricingForRow(UPSEOrderRow row) { if (row.Pricing != null) { return(row.Pricing); } UPSERowPricing rowPricing = this.RowPricingForRow(row); if (rowPricing != null) { row.Pricing = rowPricing.Price; } return(row.Pricing); }
/// <summary> /// Prices for row. /// </summary> /// <param name="row">The row.</param> /// <returns></returns> public UPSERowPricing PriceForRow(UPSERow row) { UPSERowPricing rowPricing; if (!string.IsNullOrEmpty(this.PricingItemNumber)) { string itemNumber = null; if (!string.IsNullOrEmpty(this.SerialEntry.ItemNumberFunctionName)) { itemNumber = row.ValueForFunctionName(this.SerialEntry.ItemNumberFunctionName); } if (itemNumber == null) { return(null); } rowPricing = this.rowPricingForArticle.ValueOrDefault(itemNumber); if (rowPricing != null) { return(rowPricing); } UPSEPrice price = this.priceForArticle.ValueOrDefault(itemNumber); string rowRecordId = row.RowRecordId; if (price == null) { Dictionary <string, object> dataDictionary = row.SourceFunctionValues(); price = new UPSEPrice(StringExtensions.InfoAreaIdRecordId(this.SerialEntry.SourceInfoAreaId, rowRecordId), dataDictionary, this); } if (price != null) { rowPricing = new UPSERowPricing(price, this, rowRecordId); if (this.rowPricingForArticle == null) { this.rowPricingForArticle = new Dictionary <string, UPSERowPricing>(); } this.rowPricingForArticle[itemNumber] = rowPricing; return(rowPricing); } } else { string rowRecordId = row.RowRecordId; rowPricing = this.rowPricingForArticle.ValueOrDefault(rowRecordId); if (rowPricing != null) { return(rowPricing); } UPSEPrice price = this.priceForArticle.ValueOrDefault(rowRecordId); if (price == null) { Dictionary <string, object> dataDictionary = row.SourceFunctionValues(); price = new UPSEPrice(StringExtensions.InfoAreaIdRecordId(this.SerialEntry.SourceInfoAreaId, rowRecordId), dataDictionary, this); } if (price != null) { rowPricing = new UPSERowPricing(price, this, rowRecordId); if (this.rowPricingForArticle == null) { this.rowPricingForArticle = new Dictionary <string, UPSERowPricing>(); } this.rowPricingForArticle[rowRecordId] = rowPricing; return(rowPricing); } } return(null); }