public Person(string aName, Debt intial) { name = aName; //debt = aDebt; DebtEntry.Add(intial); Debt = intial.Amount; }
void OpenHandler() { Debtors.Clear(); string filePath = null; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == true) { filePath = openFileDialog.FileName; using (StreamReader reader = new StreamReader(filePath)) { string inputFromFile; while ((inputFromFile = reader.ReadLine()) != null) { string[] words = inputFromFile.Split(","); Debtor openDebtor = new Debtor(words[0], 0); for (int i = 1; i < words.Length - 1; i += 2) { Debt openDebt = new Debt(words[i], double.Parse(words[i + 1])); openDebtor.DebtsList.Add(openDebt); } Debtors.Add(openDebtor); } } } }
private void AddDebt() { var debt = new Debt { Amount = debtAmount, Date = DateTime.Now }; Debts.Add(debt); Debter.DebtList.Add(debt); Debter.Indebted += debtAmount; }