Ejemplo n.º 1
0
        public static string Convert(decimal number, Currency currency = Currency.NONE, bool stems = false)
        {
            var options = new NumberToTextOptions
            {
                Stems    = stems,
                Currency = currency,
            };

            return(CommonConvert(PrepareNumbers(number), options));
        }
Ejemplo n.º 2
0
        private static string CommonConvert(IEnumerable <int> numbers, NumberToTextOptions options)
        {
            var algorithm = GetAlgorithm(options.Currency);

            algorithm.Dictionaries = options.Dictionary ?? _kernel.Get <IDictionaries>();
            algorithm.Numbers      = numbers;
            algorithm.Options      = options;

            return(algorithm.Build());
        }
Ejemplo n.º 3
0
        public static string Convert(long number, Currency currency = Currency.NONE, bool stems = false)
        {
            var options = new NumberToTextOptions
            {
                Stems    = stems,
                Currency = currency,
            };

            return(CommonConvert(new[] { number }, options));
        }
Ejemplo n.º 4
0
        private static string CommonConvert(IEnumerable <long> numbers, NumberToTextOptions options)
        {
            var currencyDeflation = CurrencyDeflationFactory.GetCurrencyDeflation(options.Currency);

            var dictionary = options.Dictionary;

            if (dictionary == null)
            {
                dictionary = options.Stems
                    ? new PolishWithsStemsDictionary()
                    : (ICurrencyDictionary) new PolishDictionary();
            }

            var algorithm = new CurrencyAlgorithm(dictionary, currencyDeflation, options.SplitDecimal, options.Stems);

            return(algorithm.Build(numbers));
        }
Ejemplo n.º 5
0
 public static string Convert(decimal number, NumberToTextOptions options)
 {
     return(CommonConvert(PrepareNumbers(number), options));
 }
Ejemplo n.º 6
0
 public static string Convert(int number, NumberToTextOptions options)
 {
     return(CommonConvert(new[] { number }, options));
 }
Ejemplo n.º 7
0
 public static string Convert(int number, NumberToTextOptions options)
 {
     return(Convert((long)number, options));
 }