Beispiel #1
0
        public void Run()
        {
            SetupNLog();

            var userHandler = new UserHandler();

            if (userHandler.UserHasChosenExternalFile())
            {
                string path     = userHandler.GetUserFilePath();
                string fileType = DetermineFileType(path);
                HandleUserRequestsUsingTransactionsFile(path, fileType);
            }
            else
            {
                string path     = userHandler.ReturnFilePathForUserChosenYear();
                string fileType = DetermineFileType(path);
                HandleUserRequestsUsingTransactionsFile(path, fileType);
            }
        }
Beispiel #2
0
        private void HandleUserRequestsUsingTransactionsFile(string path, string fileType)
        {
            var transactionsGeneratorFactory = new TransactionsGeneratorFactory();
            var transactionsGenerator        = transactionsGeneratorFactory.ReturnGenerator(path, fileType);
            var listOfTransactions           = transactionsGenerator.GenerateTransactions(path);

            if (listOfTransactions.Count() != 0)
            {
                var accounts = new Accounts(listOfTransactions);
                accounts.PrintAccounts();

                var userHandler = new UserHandler();
                userHandler.HandleUserTransactionPrintingRequests(listOfTransactions);

                if (userHandler.WantsToExport())
                {
                    userHandler.ExportAsXML(listOfTransactions);
                }
            }
        }