예제 #1
0
        private void ImportAccountingButton_Click(object sender, EventArgs e)
        {
            var balanceImporter = new BalanceImporter(balancesTable);
            var debitEntries    = balanceImporter.ReadDebits(currentStudentInComboBox.CustomerNo, importFileName, importRefId);

            debitsGridView.DataSource = debitEntries;

            var paymentEntries = balanceImporter.ReadPayments(currentStudentInComboBox.CustomerNo, importFileName, importRefId);

            paymentsGridView.DataSource = paymentEntries;

            tabControl1.SelectedTab = AccountingTabPage;
        }
예제 #2
0
        private void ImportAllAccountingsButton_Click(object sender, EventArgs e)
        {
            var studentReader = new StudentReader();
            var debitWriter   = new DebitWriter();
            var paymentWriter = new PaymentWriter();
            var sb            = new StringBuilder();

            var allStudents = studentReader.GetActiveStudentsForComboBox();

            try
            {
                foreach (var customer in allStudents)
                {
                    var accountLoader = new AccountLoader();
                    var excelFilePath = accountLoader.GetExcelSheetFullPath(customer.CustomerNo);
                    if (excelFilePath.Contains("not found"))
                    {
                        sb.AppendLine(excelFilePath);
                        continue;
                    }
                    var dataSet = accountLoader.ExcelToDataSet(excelFilePath);
                    balancesTable = dataSet.Tables["Saldenliste"];
                    var balanceImporter = new BalanceImporter(balancesTable);
                    var debitEntries    = balanceImporter.ReadDebits(customer.CustomerNo, excelFilePath, customer.Id);
                    foreach (var debit in debitEntries)
                    {
                        debitWriter.AddDebit(debit);
                    }

                    var paymentEntries = balanceImporter.ReadPayments(customer.CustomerNo, excelFilePath, customer.Id);
                    foreach (var payment in paymentEntries)
                    {
                        paymentWriter.AddPayment(payment);
                    }
                }
            }
            finally
            {
                Console.WriteLine(sb.ToString());
                informationsTextBox.Text = sb.ToString();
            }
        }