private void btnOk_Click(object sender, EventArgs e) { MoneyDataSet.AccountsRow account = cbAccount.SelectedItem as MoneyDataSet.AccountsRow; double amount = account.Balance - ((double)numBalance.Value); MoneyDataSet.TransactionsRow preCreate = keeper.PreCreateTransaction(keeper.GetTransactionType(MoneyDataSet.IDs.TransactionTypes.Correction), Resources.Labels.AccountCorrectionLabel, tbDescription.Text, DateTime.Now, account, amount); ValidationResult result = keeper.Validate(transaction: preCreate); if (!result.Success) { if (result.PreventAction) { MessageBox.Show(String.Format(Resources.Labels.TransactionValidationErrorsFoundFormat, result.Message), Resources.Labels.TransactionValidationTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (MessageBox.Show(String.Format(Resources.Labels.TransactionValidationWarningsFoundFormat, result.Message), Resources.Labels.TransactionValidationTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { return; } } } keeper.CreateTransaction(preCreate, ttbTags.Tags); this.DialogResult = DialogResult.OK; this.Close(); }