コード例 #1
0
        public void Init()
        {
            IAccountBase checking;
            IAccountBase credit;

            IIncome salary;
            IIncome bonus;

            //annuals
            IHardBill carRegistration;

            //monthlys
            IHardBill electricity;
            IHardBill cable;

            DateTime startingDate = new DateTime(2020, 1, 1);

            //create accounts
            checking = new CheckingAccount("checking", 5000, startingDate);
            credit   = new CreditCard("credit", 0, startingDate);

            //create income
            salary = new Income("salary", 2500, IncomeFrequencyEnum.BiWeekly, checking, new DateTime(2020, 1, 10));
            bonus  = new Income("bonus", 1500, IncomeFrequencyEnum.BiAnnualy, checking, new DateTime(2020, 1, 10));

            //annuals
            carRegistration = new HardBill("carRegistration", 1000, new DateTime(2020, 12, 31), HardBillFrequencyEnum.Annualy, credit, false);

            //monthlys
            electricity = new HardBill("electricity", 150, new DateTime(2020, 1, 15), HardBillFrequencyEnum.Monthly, checking, true);
            cable       = new HardBill("cable", 75, new DateTime(2020, 1, 20), HardBillFrequencyEnum.Monthly, credit, true);

            yearTop = new YearTop();
            yearTop.InitializeYear();

            //wire up top
            yearTop.AddAccount(checking);
            yearTop.AddAccount(credit);

            yearTop.AddIncomeSource(salary);
            yearTop.AddIncomeSource(bonus);

            yearTop.AddHardBill(carRegistration);
            yearTop.AddSoftBill("vacation", 7500, true);

            yearTop.AddHardBill(electricity);
            yearTop.AddHardBill(cable);
            yearTop.AddSoftBill("food", 500, false);
            yearTop.AddSoftBill("gas", 100, false);
        }
コード例 #2
0
 private void NewAccount_Added(object sender, NewAccountAddedEventArgs e)
 {
     if (e.NewAccount != null)
     {
         _year.RemoveAccount(e.NewAccount.Name);
         _year.AddAccount(e.NewAccount);
     }
     RefreshPage();
 }