public void PayOff(DateTime date, SimulationDebtAccount debt) { switch (debt.Type) { case DebtType.Revolving: { // a revolving debt doesn't get paid off, it just // becomes inelligible to be a snowball target if (debt.SetState(SimulationDebtAccountState.None)) { AddNotice(date, $"{debt.Name} balance to {0m:C2}"); } break; } default: { // any other debt type gets paid off and added // to the snowball if (debt.SetState(SimulationDebtAccountState.PaidOff)) { AddNotice(date, $"{debt.Name} paid off"); if (IsSnowball) { // add the debt payment to the snowball AddToSnowball(date, debt.Payment); } } break; } } }
private static bool?CanBeSnowballTarget(SimulationDebtAccount debt) { if (debt == null) { return(null); } return(debt.State == SimulationDebtAccountState.Due); }
private static int GetDebtOrder(SimulationDebtAccount debt, SnowBallSetup setup, int defaultOrder) { int index = Array.IndexOf(setup.DebtOrder, debt.Id); if (index < 0) { index = defaultOrder; } return(index); }