Exemple #1
0
        public string sumProp(long nSum, string sGender, string sCase)
        {
            if (!_caseses.ContainsKey(sCase) || !_genders.ContainsKey(sGender))
            {
                throw new InvalidDataException();
            }

            var caseVal   = _caseses[sCase];
            var genderVal = _genders[sGender];

            if (nSum == 0)
            {
                return(_zeroDictionary.GetStringTranscription(caseVal, genderVal));
            }

            var resultContainer = new StringBuilder();

            if (nSum < 0)
            {
                var minusText = _minusDictionary.GetStringTranscription(caseVal, genderVal);
                resultContainer.Append(minusText);
                resultContainer.Append(" ");
                nSum *= -1;
            }
            var numberText = _numericalParser.ParseNumber(nSum, caseVal, genderVal);

            resultContainer.Append(numberText);
            return(resultContainer.ToString());
        }
Exemple #2
0
        public string GetStringTranscription(char digit, Cases caseVal, Genders genderVal)
        {
            if (!char.IsDigit(digit))
            {
                throw new InvalidDataException();
            }

            switch (digit)
            {
            case '0':
                return("");

            case '1':
                return(_oneDictionary.GetStringTranscription(caseVal, genderVal));

            case '2':
                return(_twoDictionary.GetStringTranscription(caseVal, genderVal));

            default:
                return(_otherDigits[digit][caseVal]);
            }
        }