private void SubmitCheck( IDataProvider provider ) { int accountId = int.Parse( ddlAccount.SelectedValue ); IAccount account = provider.GetAccount( accountId ); if( account == null ) throw new ApplicationException( "Account " + accountId + " not found in data storage." ); IAccount expenseAccount = provider.GetAccount( 2 ); if( expenseAccount == null ) throw new ApplicationException( "Expense account not found in data storage." ); this.trans = provider.NewTransaction(); trans.Amount = Convert.ToDecimal( txtAmount.Text ); trans.TransactionDate = DateTime.Parse( txtDate.Text ); trans.Payee = txtPayee.Text; if( txtMemo.Text.Length > 0 ) trans.Memo = txtMemo.Text; trans.IsEstimated = chkEstimated.Checked; ILineItem credit = trans.NewLineItem(); credit.SetAccount( account ); credit.Amount = trans.Amount; credit.Category = null; credit.Memo = trans.Memo; if( txtNumber.Text.Length > 0 ) credit.Number = txtNumber.Text; credit.TransactionType = TransactionType.Credit; credit.IsTaxRelated = this.chkDeductible.Checked; ILineItem debit = trans.NewLineItem(); debit.SetAccount( expenseAccount ); debit.Amount = credit.Amount; debit.Category = txtCategory.Text; debit.TransactionType = TransactionType.Debit; debit.IsTaxRelated = this.chkDeductible.Checked; }