Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
                }
            }
        }