예제 #1
0
        private void readStudentSheetButton_Click(object sender, EventArgs e)
        {
            AccountLoader accountLoader = new AccountLoader();

            try
            {
                ResetStatusLabel();
                importFileName = accountLoader.GetExcelSheetFullPath(currentStudentInComboBox.CustomerNo);
                var dataSet = accountLoader.ExcelToDataSet(currentStudentInComboBox);
                appointmentOverviewTable        = dataSet.Tables["Terminübersicht"];
                balancesTable                   = dataSet.Tables["Saldenliste"];
                appointmentsGridView.DataSource = appointmentOverviewTable;
                balanceGridView.DataSource      = balancesTable;
            }
            catch (Exception ex)
            {
                statusLabel.Text = ex.ToString();
            }
        }
예제 #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();
            }
        }
예제 #3
0
        private void importGeorgeAccountEntriesButton_Click(object sender, EventArgs e)
        {
            var georgeFilePath    = georgeFilePathTextBox.Text;
            var accountLoader     = new AccountLoader();
            var bankAccountList   = accountLoader.CsvToGeorgeAccountList(georgeFilePath, ',');
            var bankAccountWriter = new BankAccountWriter();

            foreach (var entry in bankAccountList)
            {
                try
                {
                    bankAccountWriter.AddGeorgeAccountEntry(entry);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    //throw;
                }
            }
        }