Ejemplo n.º 1
0
        public virtual void Add(CompositeMoney other)
        {
            if (null == other)
            {
                return;
            }

            if (null == this.FixedAmount)
            {
                this.FixedAmount = new MoneyBuilder(other.FixedAmount);
            }
            else
            {
                this.FixedAmount.Add(FixedAmount);
            }

            if (null == this.VariableAmount)
            {
                this.VariableAmount = new MoneyBuilder(other.VariableAmount);
            }
            else
            {
                this.VariableAmount.Add(VariableAmount);
            }
        }
Ejemplo n.º 2
0
 public static MoneyBuilder operator -(MoneyBuilder mb, Money b)
 {
     if (null == mb)
     {
         mb = new MoneyBuilder();
     }
     mb.Deduct(b);
     return(mb);
 }
Ejemplo n.º 3
0
 public void Add(MoneyBuilder m)
 {
     if (Object.ReferenceEquals(null, m))
     {
         return;
     }
     if (this.isEmpty)
     {
         this.isEmpty  = false;
         this.amount   = m.amount;
         this.currency = m.Currency;
     }
     else if (this.Currency == m.Currency)
     {
         this.amount += m.amount;
     }
     else
     {
         throw new iSabayaException(Messages.MoneyDifferentCurrencies);
     }
 }
Ejemplo n.º 4
0
 public static Money ToMoney(this MoneyBuilder mb)
 {
     return(null == mb ? null : mb.ToMoneyIfNotEmpty());
 }