public void AddDebt(string lender, int value) { Debt debt = (Debt)Memory.Find("Debt_" + lender); if (debt == null) { debt = new Debt(this); debt.Lender = lender; fMemory.Add("Debt_" + lender, debt); } debt.Value += value; }
public int GetDebt(string aLender) { Debt debt = (Debt)fMemory.Find("Debt_" + aLender); int result; if (debt == null) { result = 0; } else { result = debt.Value; } return(result); }
public void SubDebt(string lender, int value) { Debt debt = (Debt)Memory.Find("Debt_" + lender); if (debt != null) { if (debt.Value > value) { debt.Value -= value; } else { fMemory.Delete("Debt_" + lender); } } }