Exemplo n.º 1
0
		public SubagentCommission(Modificants modificants)
		{
			Value = modificants.Value;
			RelativeValue = modificants.RelativeValue;
			Currency = modificants.Currency;
			CurrencyConverter = modificants.CurrencyConverter;
		}
Exemplo n.º 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);
        }
Exemplo n.º 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;
		}
Exemplo n.º 4
0
 public SubagentCommission(Modificants modificants)
 {
     Value             = modificants.Value;
     RelativeValue     = modificants.RelativeValue;
     Currency          = modificants.Currency;
     CurrencyConverter = modificants.CurrencyConverter;
 }
Exemplo n.º 5
0
 static Modificants()
 {
     MAX_VALUE = new Modificants {
         Value = Double.MaxValue, RelativeValue = Double.MaxValue
     };
     MIN_VALUE = new Modificants {
         Value = Double.MinValue, RelativeValue = Double.MinValue
     };
 }
Exemplo n.º 6
0
		static Modificants()
		{
			MAX_VALUE = new Modificants { Value = Double.MaxValue, RelativeValue = Double.MaxValue };
			MIN_VALUE = new Modificants { Value = Double.MinValue, RelativeValue = Double.MinValue };
		}