Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Account"/> class.
        /// </summary>
        /// <param name="accountNumberTypeString">The type of the account.</param>
        /// <param name="accountInfo">The raw information of the account.</param>
        /// <param name="accountNameInfo">The raw information about the name.</param>
        public Account(string accountNumberTypeString, string accountInfo, string accountNameInfo)
        {
            Helpers.ValidateStringLength(accountInfo, 37, "Account");
            Helpers.ValidateStringLength(accountNameInfo, 61, "AccountNameInfo");

            var(accountIsIban, accountNumber, accountCurrency, accountCountry) =
                AddAccountInfo(accountInfo, accountNumberTypeString);
            NumberType  = new AccountNumberType(accountNumberTypeString);
            Name        = new AccountName(accountNameInfo.Substring(0, 26));
            Description = new AccountDescription(accountNameInfo.Substring(26, 35));
            Number      = new AccountNumber(accountNumber, accountIsIban);
            Currency    = new Currency(accountCurrency);
            Country     = new Country(accountCountry);
        }
Esempio n. 2
0
        internal ValidateProcesoBanco VerificarProcesoAnterio(AccountDescription info, int Year, int Month)
        {
            var January      = 1;
            var December     = 12;
            var _beforeMonth = Month == January ? December : Month - 1;
            var _beforeYear  = _beforeMonth == 12 ? Year - 1 : Year;

            var procesoBanco = Find(info.BancoCuenta, Year, Month);

            if (!procesoBanco.Exist())
            {
                var procesoBancoAnterior = Find(info.BancoCuenta, _beforeYear, _beforeMonth);

                if (!procesoBancoAnterior.Exist())
                {
                    return new ValidateProcesoBanco
                           {
                               Error = $"No se encontró el proceso en el mes {HelperExtensions.NombreDelMes(_beforeMonth)} para el banco {info.Descripcion}"
                           }
                }
                ;


                if (procesoBancoAnterior.Exist() && procesoBancoAnterior.IsInitialBalance() && !procesoBancoAnterior.IsClosed())
                {
                    return new ValidateProcesoBanco
                           {
                               Error = $"El proceso en el mes {HelperExtensions.NombreDelMes(_beforeMonth)} para el banco {info.Descripcion} no esta procesado"
                           }
                }
                ;
            }
            return(new ValidateProcesoBanco {
                successed = true, saldoAnterior = procesoBanco.SaldoFinal
            });
        }
    }