private void LoadNextStatement(object sender, EventArgs e) { //Save current statement info as event BankStatementEntry entry = bankStatements[_statementN]; labelEntryNumber.Content = _statementN.ToString(); if (bills.ContainsKey(entry.DescriptionMSG)) { string billReference = entry.DescriptionMSG; //entry.InternalAccount = _internalAccounts.FirstOrDefault(s => s.Contains(bills[entry.DescriptionMSG].Internal_Account)); entry.DescriptionMSG = string.Format("{0} {1}", bills[billReference].Customer, bills[billReference].Description); //SelectedAccount = entry.InternalAccount; paidBills.Add(bills[billReference].Bill_n); } Debug.WriteLine(entry.Amount.ToString("N2")); Debug.WriteLine(entry.Amount); textBoxDescriptor.Text = entry.DescriptionMSG; textBlckBankStatement.Text = string.Format("Bank statement info:\nMessage: {0}\nSender: \n{1}\nSum: {2}\nDate: {3}\n", entry.DescriptionMSG, entry.FromTo, entry.Amount.ToString("N2"), entry.Date); }
private void SaveOntoLedgerFile() { BankStatementEntry entry = bankStatements[_statementN]; string internalAccount = SelectedAccount.Split(' ')[0]; Debug.WriteLine(internalAccount); Debug.WriteLine(SelectedAccount); string ledgerEntryTemplate = "\n\t\t\tevent {0}\n\t\t\t\tdate {1}\n\t\t\t\t\"{2}\"\n\t\t\t\t\n\t\t\t\t\t{3}\n\t\t\t\t\t\tmoney {4}00\n\t\t\t\t\t{5}\n\t\t\t\t\t\tmoney {6}00"; _ledgerEntry = string.Format(ledgerEntryTemplate, _eventN, entry.Date, textBoxDescriptor.Text, "10003", entry.Amount, internalAccount, entry.Amount * -1); Debug.WriteLine(_ledgerEntry); File.AppendAllText(_ledgerName, _ledgerEntry); }
private void BtnLoadBankStatements_Click(object sender, RoutedEventArgs e) { textBlckBankStatement.Text = _ledgerName; string bankStatementsFileName = GetFilename("Lataa tiliote"); if (bankStatementsFileName != "") { foreach (string line in File.ReadLines(bankStatementsFileName, Encoding.GetEncoding("iso-8859-1")).Skip(1)) { Debug.WriteLine(line); BankStatementEntry bankStatementEntry = new BankStatementEntry(); bankStatementEntry.initBankStatementEntry(line); bankStatements.Add(bankStatementEntry); } bankStatements.Reverse(); CheckPreRequisites(InformationFlags.Bankstatements); } else { MessageBox.Show("Lasku listaa ei saatu auki"); } }