public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, Int32 count) { return(new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(count)); }
public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, params Decimal[] distributions) { return(new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(distributions)); }
public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, Decimal distribution) { return new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(distribution); }
public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, Int32 count) { return new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(count); }
public MoneyDistributor(Money amountToDistribute, FractionReceivers receiver, RoundingPlaces precision) { _toDistribute = amountToDistribute; _receiver = receiver; _precision = precision; }
public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, Decimal distribution1, Decimal distribution2) { return(new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(distribution1, distribution2)); }
public Money Round(RoundingPlaces places, MidpointRoundingRule rounding, out Money remainder) { Int64 unit; var placesExponent = getExponentFromPlaces(places); var fraction = roundFraction(placesExponent, rounding, out unit); var units = _units + unit; remainder = new Money(0, _decimalFraction - fraction, Asset); return(new Money(units, fraction, Asset)); }
private static Int32 getExponentFromPlaces(RoundingPlaces places) { switch (places) { case RoundingPlaces.Zero: return(0); case RoundingPlaces.One: return(1); case RoundingPlaces.Two: return(2); case RoundingPlaces.Three: return(3); case RoundingPlaces.Four: return(4); case RoundingPlaces.Five: return(5); case RoundingPlaces.Six: return(6); case RoundingPlaces.Seven: return(7); case RoundingPlaces.Eight: return(8); case RoundingPlaces.Nine: return(9); default: throw new ArgumentOutOfRangeException("places"); } }
public Money Round(RoundingPlaces places, MidpointRoundingRule rounding = MidpointRoundingRule.ToEven) { Money remainder; return(Round(places, rounding, out remainder)); }