예제 #1
0
        /// -------------------------------------------------------------
        ///
        public void newGoalAction()
        {
            Render.setStatus("savings/debt", false);
            string input         = InputHandler.processInput("Goal type");
            bool   isSavingsGoal = false;

            if (input.ToLower().Equals("savings"))
            {
                isSavingsGoal = true;
            }

            Render.setStatus("Enter " + (isSavingsGoal ? "savings" : "debt") + " goal details", false);
            string      title  = InputHandler.processInput("Title");
            double      amount = InputHandler.processNumberInput("Amount", 0);
            FinanceItem goal   = new FinanceItem(title, amount);

            if (isSavingsGoal)
            {
                this.currentBudget.savingsGoals.Add(goal);
            }
            else
            {
                this.currentBudget.debtGoals.Add(goal);
            }
        }
예제 #2
0
        /// -------------------------------------------------------------
        ///
        public void newItemAction()
        {
            Render.setStatus("New budget item", false);
            string itemTitle  = InputHandler.processInput("Title");
            double itemAmount = InputHandler.processNumberInput("Amount", 0);

            currentBudget.monthlyBudgetItems.Add(new FinanceItem(itemTitle, itemAmount));
        }
예제 #3
0
        /// -------------------------------------------------------------
        ///
        public void newLoanAction()
        {
            Render.setStatus("New loan", false);
            string title          = InputHandler.processInput("Title");
            string abr            = InputHandler.processInput("Abr (3 letters)");
            double amount         = InputHandler.processNumberInput("Amount", 0);
            double interest       = InputHandler.processNumberInput("Interest %", 0);
            double monthlyPayment = InputHandler.processNumberInput("Monthly payment", 0);

            currentBudget.addLoan(new Loan(title, abr, amount, interest, monthlyPayment));
        }
예제 #4
0
        /// -------------------------------------------------------------
        ///
        public void editItemAction()
        {
            Render.setStatus("Which budget item to edit?", false);
            string      itemName = InputHandler.processInput("Title");
            FinanceItem editItem = currentBudget.getItem(itemName);

            if (editItem != null)
            {
                Render.setStatus("Edit item (" + editItem.title + ")", false);
                editItem.amount = InputHandler.processNumberInput("Amount", editItem.amount);
            }
        }
예제 #5
0
        /// -------------------------------------------------------------
        ///
        public void editLoanAction()
        {
            Render.setStatus("Which loan to edit?", false);
            string abr      = InputHandler.processInput("Loan abr.");
            Loan   editLoan = currentBudget.getLoan(abr);

            if (editLoan != null)
            {
                Render.setStatus("Edit loan (" + editLoan.title + ")", false);
                editLoan.amount             = InputHandler.processNumberInput("Amount", editLoan.amount);
                editLoan.interestPercentage = InputHandler.processNumberInput("Interest %", editLoan.interestPercentage);
                editLoan.monthlyPayment     = InputHandler.processNumberInput("Monthly payment", editLoan.monthlyPayment);
                currentBudget.refreshLoanBudgetItems(editLoan);
            }
        }
예제 #6
0
        /// -------------------------------------------------------------
        ///
        public override void handleCommand(string command)
        {
            switch (command)
            {
            case "years":
                this.isMonthBased = false;
                break;

            case "months":
                this.isMonthBased = true;
                break;

            case "periods":
                Render.setStatus("Number of periods", false);
                this.periods = (int)InputHandler.processNumberInput("Periods", this.periods);
                break;
            }
        }
예제 #7
0
 /// -------------------------------------------------------------
 ///
 public void editSavingsAction()
 {
     Render.setStatus("Edit savings", false);
     currentBudget.currentSavings    = InputHandler.processNumberInput("Savings amount", currentBudget.currentSavings);
     currentBudget.savingsGrowthRate = InputHandler.processNumberInput("Growth rate", currentBudget.savingsGrowthRate);
 }