private void FillOut(AccountsChartDto accountsChart, ExcelFile excelFile)
        {
            int i = 5;

            foreach (var account in accountsChart.Accounts)
            {
                excelFile.SetCell($"C{i}", account.Number);
                excelFile.SetCell($"D{i}", account.Name);
                if (account.LastLevel)
                {
                    excelFile.SetCell($"E{i}", "*");
                }
                excelFile.SetCell($"F{i}", account.Sector);
                excelFile.SetCell($"G{i}", account.Role.ToString());
                excelFile.SetCell($"H{i}", account.UsesSector ? "Sí": "No");
                excelFile.SetCell($"I{i}", account.UsesSubledger ? "Sí" : "No");
                excelFile.SetCell($"J{i}", account.Type);
                excelFile.SetCell($"K{i}", account.DebtorCreditor.ToString());
                excelFile.SetCell($"L{i}", account.StartDate);
                i++;
            }

            if (!accountsChart.WithSectors)
            {
                excelFile.RemoveColumn("F");
            }
        }
        public void Should_Get_Accounts()
        {
            AccountsChartDto accountsChart = _usecases.GetAccounts(TestingConstants.ACCOUNTS_CHART_UID);


            Assert.Equal(TestingConstants.ACCOUNTS_CHART_UID, accountsChart.UID);
        }
Exemplo n.º 3
0
        public SingleObjectModel GetAccounts([FromUri] string accountsChartUID)
        {
            using (var usecases = AccountsChartUseCases.UseCaseInteractor()) {
                AccountsChartDto accountsChart = usecases.GetAccounts(accountsChartUID);

                return(new SingleObjectModel(base.Request, accountsChart));
            }
        }
Exemplo n.º 4
0
        public SingleObjectModel SearchAccounts([FromUri] string accountsChartUID,
                                                [FromBody] AccountsSearchCommand searchCommand)
        {
            base.RequireBody(searchCommand);

            using (var usecases = AccountsChartUseCases.UseCaseInteractor()) {
                AccountsChartDto accountsChart = usecases.SearchAccounts(accountsChartUID, searchCommand);

                return(new SingleObjectModel(base.Request, accountsChart));
            }
        }
        public void Should_Search_Accounts()
        {
            var searchCommand = new AccountsSearchCommand {
                Date        = new DateTime(2005, 10, 23),
                FromAccount = "1000",
                ToAccount   = "5000",
                Keywords    = "Circulante",
            };

            AccountsChartDto accountsChart = _usecases.SearchAccounts(TestingConstants.ACCOUNTS_CHART_UID,
                                                                      searchCommand);

            Assert.Equal(TestingConstants.ACCOUNTS_CHART_UID, accountsChart.UID);
        }
Exemplo n.º 6
0
        public SingleObjectModel GetAccountsInExcelFile([FromUri] string accountsChartUID,
                                                        [FromBody] AccountsSearchCommand searchCommand)
        {
            base.RequireBody(searchCommand);

            using (var usecases = AccountsChartUseCases.UseCaseInteractor()) {
                AccountsChartDto accountsChart = usecases.SearchAccounts(accountsChartUID, searchCommand);

                var excelExporter = new ExcelExporter();

                ExcelFileDto excelFileDto = excelExporter.Export(accountsChart, searchCommand);

                return(new SingleObjectModel(base.Request, excelFileDto));
            }
        }
Exemplo n.º 7
0
        public ExcelFileDto Export(AccountsChartDto accountsChart,
                                   AccountsSearchCommand searchCommand)
        {
            Assertion.AssertObject(accountsChart, "accountsChart");
            Assertion.AssertObject(searchCommand, "searchCommand");

            var templateUID = $"AccountsChartTemplate";

            var templateConfig = ExcelTemplateConfig.Parse(templateUID);

            var creator = new AccountsChartExcelFileCreator(templateConfig);

            ExcelFile excelFile = creator.CreateExcelFile(accountsChart);

            return(ExcelFileMapper.Map(excelFile));
        }
        internal ExcelFile CreateExcelFile(AccountsChartDto accountsChart)
        {
            Assertion.AssertObject(accountsChart, "accountsChart");

            var excelFile = new ExcelFile(_templateConfig);

            excelFile.Open();

            excelFile.SetCell($"A2", _templateConfig.Title);

            FillOut(accountsChart, excelFile);

            excelFile.Save();

            excelFile.Close();

            return(excelFile);
        }