/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingBulkVolume"/> class. /// </summary> /// <param name="resultRow">The result row.</param> /// <param name="bulkVolumes">The bulk volumes.</param> public UPSEPricingBulkVolume(UPCRMResultRow resultRow, UPSEPricingBulkVolumes bulkVolumes) { this.BulkVolumes = bulkVolumes; this.MaxVolumeIndex = 0; List <double> quantityScale = new List <double>(10); this.Data = resultRow.ValuesWithFunctions(); this.ItemNumber = this.Data.ValueOrDefault(this.BulkVolumes.ItemNumberFunctionName) as string; double lastNumber = 0; for (int i = 0; i < 10; i++) { string valueForKey = this.Data.ValueOrDefault($"Quantity{i}") as string; if (!string.IsNullOrEmpty(valueForKey) && valueForKey != "0") { this.MaxVolumeIndex = i; lastNumber = Convert.ToDouble(valueForKey, System.Globalization.CultureInfo.InvariantCulture); } quantityScale.Add(lastNumber); } this.QuantityScale = quantityScale; }
/// <summary> /// Pricings the bulk volumes did fail with error. /// </summary> /// <param name="bulkVolumes">The bulk volumes.</param> /// <param name="error">The error.</param> public void PricingBulkVolumesDidFailWithError(UPSEPricingBulkVolumes bulkVolumes, Exception error) { this.TheDelegate?.PricingDidFailWithError(this, error); }
/// <summary> /// Pricings the bulk volumes did finish with success. /// </summary> /// <param name="bulkVolumes">The bulk volumes.</param> /// <param name="result">The result.</param> public void PricingBulkVolumesDidFinishWithSuccess(UPSEPricingBulkVolumes bulkVolumes, object result) { this.HandleBulkVolumesResult(); }