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); } }
public static MoneyBuilder operator -(MoneyBuilder mb, Money b) { if (null == mb) { mb = new MoneyBuilder(); } mb.Deduct(b); return(mb); }
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); } }
public static Money ToMoney(this MoneyBuilder mb) { return(null == mb ? null : mb.ToMoneyIfNotEmpty()); }