コード例 #1
0
		public SubagentCommission(Modificants modificants)
		{
			Value = modificants.Value;
			RelativeValue = modificants.RelativeValue;
			Currency = modificants.Currency;
			CurrencyConverter = modificants.CurrencyConverter;
		}
コード例 #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);
        }
コード例 #3
0
ファイル: Profit.cs プロジェクト: MuteLab/nemo.travel.SDK
		/// <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;
		}
コード例 #4
0
 public SubagentCommission(Modificants modificants)
 {
     Value             = modificants.Value;
     RelativeValue     = modificants.RelativeValue;
     Currency          = modificants.Currency;
     CurrencyConverter = modificants.CurrencyConverter;
 }
コード例 #5
0
 static Modificants()
 {
     MAX_VALUE = new Modificants {
         Value = Double.MaxValue, RelativeValue = Double.MaxValue
     };
     MIN_VALUE = new Modificants {
         Value = Double.MinValue, RelativeValue = Double.MinValue
     };
 }
コード例 #6
0
		static Modificants()
		{
			MAX_VALUE = new Modificants { Value = Double.MaxValue, RelativeValue = Double.MaxValue };
			MIN_VALUE = new Modificants { Value = Double.MinValue, RelativeValue = Double.MinValue };
		}