/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingSet"/> class. /// </summary> /// <param name="configName">Name of the configuration.</param> /// <param name="scaleConfigName">Name of the scale configuration.</param> /// <param name="bundleConfigName">Name of the bundle configuration.</param> /// <param name="bundleScaleConfigName">Name of the bundle scale configuration.</param> /// <param name="pricing">The pricing.</param> /// <param name="theDelegate">The delegate.</param> public UPSEPricingSet(string configName, string scaleConfigName, string bundleConfigName, string bundleScaleConfigName, UPSEPricing pricing, UPSEPricingSetDelegate theDelegate) { this.fastRequest = ServerSession.CurrentSession.IsEnterprise; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; this.ConfigSearchAndList = configStore.SearchAndListByName(configName); this.ConfigFieldControl = this.ConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.ConfigSearchAndList.FieldGroupName) : null; if (this.ConfigFieldControl == null) { throw new InvalidOperationException("ConfigFieldControl is null"); } this.TheDelegate = theDelegate; this.Pricing = pricing; if (!string.IsNullOrEmpty(scaleConfigName)) { this.ScaleConfigSearchAndList = configStore.SearchAndListByName(scaleConfigName); this.ScaleConfigFieldControl = this.ScaleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.ScaleConfigSearchAndList.FieldGroupName) : null; } if (!string.IsNullOrEmpty(bundleConfigName)) { this.BundleConfigSearchAndList = configStore.SearchAndListByName(bundleConfigName); this.BundleConfigFieldControl = this.BundleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.BundleConfigSearchAndList.FieldGroupName) : null; if (!string.IsNullOrEmpty(bundleScaleConfigName)) { this.BundleScaleConfigSearchAndList = configStore.SearchAndListByName(bundleScaleConfigName); this.BundleScaleConfigFieldControl = this.BundleScaleConfigSearchAndList != null?configStore.FieldControlByNameFromGroup("List", this.BundleScaleConfigSearchAndList.FieldGroupName) : null; } } }
/// <summary> /// Initializes a new instance of the <see cref="UPSERowPricing"/> class. /// </summary> /// <param name="price">The price.</param> /// <param name="priceProvider">The price provider.</param> /// <param name="rowRecordId">The row record identifier.</param> public UPSERowPricing(UPSEPrice price, UPSEPricing priceProvider, string rowRecordId) { this.Price = price; this.PriceProvider = priceProvider; this.RowRecordId = rowRecordId; this.bundleConditionsLoaded = false; this.conditionsLoaded = false; this.currentConditionsLoaded = false; }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingConditionBase"/> class. /// </summary> /// <param name="row">The row.</param> /// <param name="fieldControl">The field control.</param> /// <param name="pricing">The pricing.</param> public UPSEPricingConditionBase(UPCRMResultRow row, FieldControl fieldControl, UPSEPricing pricing) : base(row, fieldControl, pricing) { }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingSet"/> class. /// </summary> /// <param name="configName">Name of the configuration.</param> /// <param name="scaleConfigName">Name of the scale configuration.</param> /// <param name="pricing">The pricing.</param> /// <param name="theDelegate">The delegate.</param> public UPSEPricingSet(string configName, string scaleConfigName, UPSEPricing pricing, UPSEPricingSetDelegate theDelegate) : this(configName, scaleConfigName, null, null, pricing, theDelegate) { }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingBase"/> class. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="dataDictionary">The data dictionary.</param> /// <param name="pricing">The pricing.</param> public UPSEPricingBase(string recordIdentification, Dictionary <string, object> dataDictionary, UPSEPricing pricing) { this.RecordIdentification = recordIdentification; this.DataDictionary = dataDictionary; this.Pricing = pricing; this.Currency = Convert.ToInt32(this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_CURRENCY)); int currency = Convert.ToInt32(this.DataDictionary.ValueOrDefault("Currency")); this.ExchangeRate = 1.0f; if (currency > 0 && currency != this.Pricing.Currency) { this.ExchangeRate = this.Pricing.CurrencyConversion.ExchangeRateFromCodeToCode(currency, this.Pricing.Currency); if (this.ExchangeRate == 0.0) { this.ExchangeRate = 1.0f; } } string value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_MINQUANTITY) as string; if (!string.IsNullOrEmpty(value)) { this.MinQuantity = Convert.ToInt32(value); this.HasQuantityBoundaries = this.MinQuantity > 0; } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_MAXQUANTITY) as string; if (!string.IsNullOrEmpty(value)) { this.MaxQuantity = Convert.ToInt32(value); this.HasQuantityBoundaries = this.HasQuantityBoundaries || (this.MaxQuantity > 0); } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_FREEGOODS) as string; if (!string.IsNullOrEmpty(value)) { this.FreeGoods = Convert.ToInt32(value); this.HasFreeGoods = this.FreeGoods > 0; } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_MINPRICE) as string; if (!string.IsNullOrEmpty(value)) { this.MinEndPrice = Convert.ToDouble(value, System.Globalization.CultureInfo.InvariantCulture) * this.ExchangeRate; this.HasPriceBoundaries = this.MinEndPrice != 0; } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_MAXPRICE) as string; if (!string.IsNullOrEmpty(value)) { this.MaxEndPrice = Convert.ToDouble(value, System.Globalization.CultureInfo.InvariantCulture) * this.ExchangeRate; this.HasPriceBoundaries = this.HasPriceBoundaries || this.MaxEndPrice != 0; } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_DISCOUNT) as string; if (!string.IsNullOrEmpty(value)) { this.Discount = Convert.ToDouble(value, System.Globalization.CultureInfo.InvariantCulture); this.HasDiscount = this.Discount != 0; } value = this.DataDictionary.ValueOrDefault(Constants.FUNCTIONNAME_UNITPRICE) as string; if (!string.IsNullOrEmpty(value)) { this.UnitPrice = Convert.ToDouble(value, System.Globalization.CultureInfo.InvariantCulture) * this.ExchangeRate; this.HasUnitPrice = this.UnitPrice != 0; } }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingBase"/> class. /// </summary> /// <param name="row">The row.</param> /// <param name="fieldControl">The field control.</param> /// <param name="pricing">The pricing.</param> public UPSEPricingBase(UPCRMResultRow row, FieldControl fieldControl, UPSEPricing pricing) : this(row.RecordIdentificationAtIndex(0), fieldControl.FunctionNames(row), pricing) { }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingBase"/> class. /// </summary> /// <param name="row">The row.</param> /// <param name="fieldControl">The field control.</param> /// <param name="pricing">The pricing.</param> public UPSEBundlePricingScale(UPCRMResultRow row, FieldControl fieldControl, UPSEPricing pricing) : base(row, fieldControl, pricing) { }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPricingBase"/> class. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="dataDictionary">The data dictionary.</param> /// <param name="pricing">The pricing.</param> public UPSEBundlePricingScale(string recordIdentification, Dictionary <string, object> dataDictionary, UPSEPricing pricing) : base(recordIdentification, dataDictionary, pricing) { }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPrice"/> class. /// </summary> /// <param name="row">The row.</param> /// <param name="recordId">The record identifier.</param> /// <param name="pricing">The pricing.</param> public UPSEPrice(UPCRMResultRow row, string recordId, UPSEPricing pricing) : this(row?.RootRecordIdentification, row?.ValuesWithFunctions(), pricing) { this.ArticleRecordId = recordId; }
/// <summary> /// Initializes a new instance of the <see cref="UPSEPrice"/> class. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="dataDictionary">The data dictionary.</param> /// <param name="pricing">The pricing.</param> public UPSEPrice(string recordIdentification, Dictionary <string, object> dataDictionary, UPSEPricing pricing) : base(recordIdentification, dataDictionary, pricing) { this.ArticleRecordId = recordIdentification.RecordId(); if (pricing.BulkVolumes != null) { this.FillScalesFromDataDictionary(dataDictionary); } }