//public Income(Income i) //{ // Name = i.Name; // PaydayAmount = i.PaydayAmount; // PaydayFrequency = i.PaydayFrequency; // DepositAccount = AccountBaseFactory.CopyAccountBase(i.DepositAccount); // FirstDeposit = i.FirstDeposit; // NextDeposit = i.NextDeposit; // NumPaydaysPaidThisYear = i.NumPaydaysPaidThisYear; //} public void MakeDeposits(DateTime date) { var cal = new GregorianCalendar(); if (date < NextDeposit) { return; } //todo: maybe make the deposit only happen if it's during the week while (NextDeposit <= date) { DepositAccount.NewCreditTransaction(new Transaction() { Description = Name, Date = NextDeposit, Amount = PaydayAmount }); NextDeposit = NextDeposit.AddDays((double)PaydayFrequency * 7); NumPaydaysPaidThisYear++; if (cal.GetYear(NextDeposit) > cal.GetYear(FirstDeposit)) { break; //passing into next year. for now keep this confined to a single year } } }