private void HandleBundleScaleResult(UPCRMResult result) { int count = result.RowCount; if (count > 0) { for (int i = 0; i < count; i++) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i); string bundleRecordIdentification = row.RecordIdentificationAtIndex(1); if (!string.IsNullOrEmpty(bundleRecordIdentification)) { UPSEBundlePricing root = this.bundleDictionary.ValueOrDefault(row.RecordIdentificationAtIndex(1)); if (root != null) { UPSEBundlePricingScale bundleScale = new UPSEBundlePricingScale(row, this.BundleScaleConfigFieldControl, this.Pricing); root.AddScale(bundleScale); } } } } this.FinishedLoadingSuccessfully(); }
/// <summary> /// Initializes a new instance of the <see cref="UPSEComputedBundlePricing"/> class. /// </summary> /// <param name="bundlePricing">The bundle pricing.</param> /// <param name="rowRecordId">The row record identifier.</param> /// <param name="rows">The rows.</param> public UPSEComputedBundlePricing(UPSEBundlePricing bundlePricing, string rowRecordId, List <UPSERow> rows) : base(bundlePricing.RecordIdentification, bundlePricing.DataDictionary, null) { this.OtherQuantity = 0; this.RowRecordId = rowRecordId; bool reduceByPrice = bundlePricing.HasPriceBoundaries; foreach (UPSERow row in rows) { if (row.RowRecordId == this.RowRecordId || row.RowPricing.BundleConditions.RecordIdentification != this.RecordIdentification) { continue; } if (this.otherPositions == null) { this.otherPositions = new List <UPSERow> { row }; } else { this.otherPositions.Add(row); } if (reduceByPrice) { this.OtherEndPrice += row.EndPriceWithoutDiscount; } else { this.OtherQuantity += (int)row.Quantity; } } if (reduceByPrice) { if (this.OtherEndPrice == 0) { this.scales = bundlePricing.Scales; } else if (bundlePricing.Scales.Count > 0) { List <UPSEPricingBase> scaleArray = new List <UPSEPricingBase>(); foreach (UPSEBundlePricingScale scale in bundlePricing.Scales) { UPSEBundlePricingScale adjustedScale = scale.BundlePricingByReducingPrice(this.OtherEndPrice); if (adjustedScale != null) { scaleArray.Add(adjustedScale); } } this.scales = scaleArray; } } else if (this.OtherQuantity == 0) { this.scales = bundlePricing.Scales; } else if (bundlePricing.Scales.Count > 0) { List <UPSEPricingBase> scaleArray = new List <UPSEPricingBase>(); foreach (UPSEBundlePricingScale scale in bundlePricing.Scales) { UPSEBundlePricingScale adjustedScale = scale.BundlePricingByReducingQuantity(this.OtherQuantity); if (adjustedScale != null) { scaleArray.Add(adjustedScale); } } this.scales = scaleArray; } }