/// <summary> /// Loads the conditions. /// </summary> public void LoadConditions() { if (!this.conditionsLoaded) { this.AllConditionArray = this.PriceProvider.ConditionsForDataRowRecordId(this.Price.DataDictionary, this.RowRecordId); this.conditions = this.AllConditionArray?.Count > 0 ? this.AllConditionArray?[0] : null; if (this.conditions != null) { this.BundleConditions = ((UPSEPricingCondition)this.conditions).BundlePricing; if (this.BundleConditions != null) { this.currentConditions = this.BundleConditions; this.BundleConditions.AddArticleRecordId(this.RowRecordId); this.BundleIdentification = this.BundleConditions.RecordIdentification; } else { this.currentConditions = this.conditions; } } this.conditionsLoaded = true; } }
/// <summary> /// Discounts the information for quantity row price. /// </summary> /// <param name="quantity">The quantity.</param> /// <param name="priceWithoutDiscount">The price without discount.</param> /// <returns></returns> public UPSEPricingDiscountInfo DiscountInfoForQuantityRowPrice(int quantity, double priceWithoutDiscount) { UPSEPricingConditionBase current = this.currentConditions; if (current == null || !current.HasDiscount) { return(null); } return(current.DiscountInfoForQuantityRowPrice(quantity, priceWithoutDiscount)); }
/// <summary> /// Frees the goods for quantity row price. /// </summary> /// <param name="quantity">The quantity.</param> /// <param name="priceWithoutDiscount">The price without discount.</param> /// <returns></returns> public int FreeGoodsForQuantityRowPrice(int quantity, double priceWithoutDiscount) { UPSEPricingConditionBase current = this.currentConditions; if (current == null || !current.HasFreeGoods) { return(0); } return(current.FreeGoodsForQuantityRowPrice(quantity, priceWithoutDiscount)); }
/// <summary> /// Currents the conditions with positions. /// </summary> /// <param name="positions">The positions.</param> /// <returns></returns> public UPSEPricingConditionBase CurrentConditionsWithPositions(List <UPSERow> positions) { if (!this.conditionsLoaded) { this.LoadConditions(); } this.currentConditions = this.BundleConditions != null ? this.BundleConditions.BundlePricingForRowRecordIdPositions(this.RowRecordId, positions) : this.Conditions; return(this.currentConditions); }