コード例 #1
0
        private void addExpense()
        {
            bool validInput = true;



            if (expenseAmount.Value < 0)
            {
                validInput = false;
                // error here
            }

            if (expenseNameTextBox.Text == "")
            {
                validInput = false;
                // error here
            }

            if (expenseNameTextBox.Text != this.expenseNameTextBox.Text || expenseAmount.Value != this.expenseDetails.getAmount())
            { // update or insertS
                if (validInput)
                {
                    controller = new ExpenseModule(Util.CONNECTION_DETAILS.CONNECITION_STRING, "");
                    this.expenseDetails.setExpenseName(expenseNameTextBox.Text);
                    this.expenseDetails.setAmount((int)expenseAmount.Value);
                    controller.addExpense(this.expenseDetails);
                    //controller.addExpense()
                }
            }
        }
コード例 #2
0
 private void addExpenseButton_Click(object sender, EventArgs e)
 {
     if (user.getFlat().getIsManager() >= 3)
     {
         this.addExpense();
         controller = new ExpenseModule(Util.CONNECTION_DETAILS.CONNECITION_STRING, "");
         controller.addExpense(this, regularActive, expenses.Last().GetExpenseDetails());
     }
 }