private Payment defaultPayment() { Payment payment = new Payment(DatabaseFactory.Default); payment.PaymentDate = DateTime.Now; payment.Amount = 0; payment.Remarks = ""; return payment; }
public void Remove(Payment payment) { string sql = "DELETE FROM payments WHERE id=:id"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters[":id"] = payment.Id; database.Execute(sql, parameters); }
public PaymentForm(Account account, Loan loan = null, Payment payment = null) { this.account = account; this.loan = loan; if (payment == null) { payment = defaultPayment(); } this.payment = payment; this.payment.Account = account; this.payment.Loan = loan; paymentError = new ErrorProvider(this); loanError = new ErrorProvider(this); InitializeComponent(); Text = "Payment Form"; }
private void form_PaymentSaved(Payment payment) { refreshForm(); }
private void loadLoanSelector(Payment initialPayment = null) { if (this.loan == null) { AccountLoans loanList = new AccountLoans(DatabaseFactory.Default, account); loanList.IncludeClosedLoans = false; foreach (Loan loan in loanList) { loanSelector.Items.Add(loan); } } else { loanSelector.Items.Add(loan); loanSelector.SelectedItem = loan; } }
private void shortTermReloanSave() { Payment payment = new Payment(database); payment.Account = originalLoan.Account; payment.Loan = originalLoan; payment.Amount = originalLoan.Balance; payment.PaymentDate = DateTime.Now; if (string.IsNullOrEmpty(payment.Remarks)) { payment.Remarks = "Reloan payment"; } if (string.IsNullOrEmpty(reloan.Remarks)) { reloan.Remarks = "Reloan"; } reloan.Id = 0; try { database.BeginTransaction(); originalLoan.MarkClosed(); payment.Save(); reloan.Save(); database.Commit(); } catch (DatabaseException exception) { database.Rollback(); } }
private void form_PaymentSaved(Payment payment) { form_UpdateForm(); }
private Payment selectedPayment() { Payment payment = new Payment(DatabaseFactory.Default); payment.Id = long.Parse(historyGrid.CurrentCell.OwningRow.Cells["id"].Value.ToString()); payment.Account = account; payment.Loan = loan; payment.Load(); return payment; }
void paymentForm_PaymentSaved(Payment payment) { loadPaymentHistory(); dispatchFormUpdatedEvent(); }