Пример #1
0
        private Account BuildAccount(List <Digit> digits)
        {
            var statusCode    = string.Empty;
            var checksum      = -1;
            var accountNumber = string.Join("", digits.Select(digit => digit.Value).ToArray());

            if (accountNumber.Contains("?"))
            {
                statusCode = "ILL";
            }
            else
            {
                var service = new AccountVerificationService();
                checksum = service.GetAccountChecksum(accountNumber);
                if (!checksum.Equals(0))
                {
                    statusCode = "ERR";
                }
            }
            return(new Account
            {
                AccountNumber = accountNumber,
                CheckSum = checksum,
                StatusCode = statusCode,
                Digits = digits
            });
        }
        private bool IsValidAccountNumber(string accountNumber)
        {
            if (accountNumber.Contains("?"))
            {
                return(false);
            }
            var service = new AccountVerificationService();

            return(service.AccountIsValid(accountNumber));
        }
Пример #3
0
 private Account BuildAccount(List<Digit> digits)
 {
     var statusCode = string.Empty;
     var checksum = -1;
     var accountNumber = string.Join("", digits.Select(digit => digit.Value).ToArray());
     if (accountNumber.Contains("?"))
     {
         statusCode = "ILL";
     }
     else
     {
         var service = new AccountVerificationService();
         checksum = service.GetAccountChecksum(accountNumber);
         if (!checksum.Equals(0)) statusCode = "ERR";
     }
     return new Account
     {
         AccountNumber = accountNumber,
         CheckSum = checksum,
         StatusCode = statusCode,
         Digits = digits
     };
 }
 private bool IsValidAccountNumber(string accountNumber)
 {
     if (accountNumber.Contains("?")) return false;
     var service = new AccountVerificationService();
     return service.AccountIsValid(accountNumber);
 }