コード例 #1
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (textBoxLoanId.Text != null && textBoxAmount.Text != null)
            {
                decimal decimalAmount;
                if ((new Regex(@"^\d+$").Match(textBoxLoanId.Text).Success) && decimal.TryParse(textBoxAmount.Text, out decimalAmount))
                {
                    databaseService.AddLoanTransaction(new LoanPaymentVO(-1, Convert.ToInt32(textBoxLoanId.Text), Convert.ToDouble(textBoxAmount.Text)));

                    WindowManager.navigateToForm(this, this.GetType(), typeof(Homescreen));
                }
            }
            else
            {
                MessageBox.Show("Invalid Loan Id or Amount.  Please try again.");
            }
        }