Esempio n. 1
0
        public CompositeMoneyRateSchedule(CompositeMoneyRateSchedule original)
            : base(original)
        {
            CompositeMoneyRateBracket newRate;

            foreach (CompositeMoneyRateBracket br in original.Brackets)
            {
                this.Brackets.Add(newRate = new CompositeMoneyRateBracket(br));
                newRate.Schedule          = this;
            }
        }
Esempio n. 2
0
        //public override void Persist(Context context)
        //{
        //    if (null != base.Title)
        //        base.Title.Save(context);

        //    context.PersistenceSession.SaveOrUpdate(this);
        //    foreach (BracketedMoneyRate sr in this.Brackets)
        //    {
        //        sr.Schedule = this;
        //        context.PersistenceSession.SaveOrUpdate(sr);
        //    }
        //}

        public virtual Money ApplyRate(Money amount, MoneyRateRounding rounding,
                                       out CompositeMoneyRateBracket bracket)
        {
            bracket = this.GetBracket(amount);
            if (null == bracket)
            {
                return(new Money(0m, amount.Currency));
            }
            else
            {
                return((Money)bracket.Rate.Apply(amount - bracket.LowerBound, rounding));
            }
        }
Esempio n. 3
0
 public CompositeMoneyRateBracket(CompositeMoneyRateBracket original)
     : base(original)
 {
 }