public SubagentCommission(Modificants modificants)
		{
			Value = modificants.Value;
			RelativeValue = modificants.RelativeValue;
			Currency = modificants.Currency;
			CurrencyConverter = modificants.CurrencyConverter;
		}
Beispiel #2
0
        /// <summary>
        /// Возврашает модификанту, входяшую в ограничения
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public virtual Modificants Normalize(Money price)
        {
            var result = new Modificants
            {
                Value             = this.Value,
                RelativeValue     = this.RelativeValue,
                Currency          = this.Currency ?? price.Currency,
                CurrencyConverter = this.CurrencyConverter ?? price.CurrencyConverter
            };

            if (result.Currency != price.Currency)
            {
                price = result.CurrencyConverter.Convert(price, result.Currency);
            }

            double currentProfit = base.Calc(price).Value;

            if (currentProfit < MinProfit)
            {
                result.Value += MinProfit - currentProfit;
            }
            if (currentProfit > MaxProfit)
            {
                result.Value -= currentProfit - MaxProfit;
            }

            return(result);
        }
Beispiel #3
0
		/// <summary>
		/// Возврашает модификанту, входяшую в ограничения
		/// </summary>
		/// <param name="price"></param>
		/// <returns></returns>
		public virtual Modificants Normalize(Money price)
		{
			var result = new Modificants
			{
				Value = this.Value,
				RelativeValue = this.RelativeValue,
				Currency = this.Currency ?? price.Currency,
				CurrencyConverter = this.CurrencyConverter ?? price.CurrencyConverter
			};

			if (result.Currency != price.Currency)
				price = result.CurrencyConverter.Convert(price, result.Currency);

			double currentProfit = base.Calc(price).Value;
			if (currentProfit < MinProfit)
			{
				result.Value += MinProfit - currentProfit;
			}
			if (currentProfit > MaxProfit)
			{
				result.Value -= currentProfit - MaxProfit;
			}
			
			return result;
		}
Beispiel #4
0
 public SubagentCommission(Modificants modificants)
 {
     Value             = modificants.Value;
     RelativeValue     = modificants.RelativeValue;
     Currency          = modificants.Currency;
     CurrencyConverter = modificants.CurrencyConverter;
 }
Beispiel #5
0
 static Modificants()
 {
     MAX_VALUE = new Modificants {
         Value = Double.MaxValue, RelativeValue = Double.MaxValue
     };
     MIN_VALUE = new Modificants {
         Value = Double.MinValue, RelativeValue = Double.MinValue
     };
 }
Beispiel #6
0
		static Modificants()
		{
			MAX_VALUE = new Modificants { Value = Double.MaxValue, RelativeValue = Double.MaxValue };
			MIN_VALUE = new Modificants { Value = Double.MinValue, RelativeValue = Double.MinValue };
		}