Ejemplo n.º 1
0
 public static decimal?RoundMonetaryAmount(decimal?v, MonetaryAmountType amountType = MonetaryAmountType.NotSet)
 {
     if (v.HasValue)
     {
         return(RoundMonetaryAmount(v.Value, amountType));
     }
     return(null);
 }
Ejemplo n.º 2
0
        public static decimal RoundMonetaryAmount(decimal v, MonetaryAmountType amountType = MonetaryAmountType.NotSet)
        {
            int digits = 2;

            switch (amountType)
            {
            case MonetaryAmountType.MonetaryValue:
                digits = 4;
                break;
            }
            return(Math.Round(v, digits, MidpointRounding.AwayFromZero));
        }