コード例 #1
0
        public async Task RegisterInPayments(string directory, DateTimeOffset date)
        {
            var fileToImport = new BankStatementFile(directory, date);

            if (!fileToImport.Exists())
            {
                return;
            }

            using (dataStore)
            {
                foreach (var txLine in fileToImport.Read())
                {
                    var account = await dataStore.PolicyAccounts.FindByNumber(txLine.AccountNumber);

                    account?.InPayment(txLine.Amount, txLine.AccountingDate);

                    dataStore.PolicyAccounts.Update(account);
                }

                fileToImport.MarkProcessed();

                await dataStore.CommitChanges();
            }
        }
コード例 #2
0
        public void RegisterInPayments(string directory, DateTimeOffset date)
        {
            var fileToImport = new BankStatementFile(directory, date);

            if (!fileToImport.Exists())
            {
                return;
            }

            using (uow)
            {
                fileToImport
                .Read()
                .ForEach(bs => uow.PolicyAccounts.FindByNumber(bs.AccountNumber)?.InPayment(bs.Amount, bs.AccountingDate));

                fileToImport.MarkProcessed();

                uow.CommitChanges();
            }
        }