public void Remove(Account account) { string sql = "DELETE FROM accounts WHERE id=:id"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters[":id"] = account.Id; database.Execute(sql, parameters); }
private void editButton_Click(object sender, EventArgs e) { Account account = new Account(); account.Id = (long)accountListGrid.CurrentRow.Cells["id"].Value; account.Load(DatabaseFactory.Default); currentAccount = account; Form accountSaveForm = new AccountSaveForm(account); accountSaveForm.FormClosing += new FormClosingEventHandler(accountSaveForm_FormClosing); accountSaveForm.ShowDialog(); }
public ReloanSaveForm(Account account, Loan loan = null) { this.account = account; this.originalLoan = loan; this.loan = cloneOriginalLoan(loan); reloan = new Reloan(DatabaseFactory.Default, originalLoan); InitializeComponent(); loadLoanSelector(); }
public LoanViewForm(Account account) { InitializeComponent(); this.account = account; Text = account.Name + " Loans"; accountLoans = new AccountLoans(DatabaseFactory.Default, account); accountLoans.StartDate = LoanBookForm.TimelineStartDate; accountLoans.EndDate = LoanBookForm.TimelineEndDate; accountLoans.IncludeClosedLoans = true; }
private void saveButton_Click(object sender, EventArgs e) { if (account == null) { account = new Account(); } account.Name = nameInput.Text; account.Remarks = remarksInput.Text; account.Save(DatabaseFactory.Default); if (AccountSaved != null) { AccountSaved(); } Close(); }
public PaymentHistoryForm(Account account, Loan loan = null) { this.account = account; this.loan = loan; InitializeComponent(); if (loan == null) { Text = account.Name + " Payment History For All Loans"; menuStrip.Visible = false; } else { Text = account.Name + " Payment History For " + loan.ToString(); } }
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"; }
public LoanSaveForm(Account account, Loan loan = null) { if (loan == null) { loan = defaultLoan(); } this.account = account; this.loan = loan; this.loan.Account = account; principalError = new ErrorProvider(this); termError = new ErrorProvider(this); interestError = new ErrorProvider(this); processingFeeError = new ErrorProvider(this); InitializeComponent(); loadLoan(loan); }
public DataTable AccountLoans(Account account, bool includeClosedLoans = true) { database.BeginTransaction(); createAccountLoanViews(); string[] columns = {"id", "taken_date", "start_date", "principal", "term", "interest", "monthly_due", "total_payable", "payment_count", "total_payments", "balance", "processing_fee", "reloan_fee", "profit", "remarks" }; string columnList = String.Join(", ", columns); string condition; Dictionary<string, object> parameters = new Dictionary<string, object>(); constructAccountLoansCondition(account, out condition, parameters, includeClosedLoans); string sql = string.Format("SELECT {0} FROM {1} WHERE {2} ORDER BY taken_date", columnList, accountLoansViewName, condition); DataTable results = this.database.Query(sql, parameters); database.Rollback(); return results; }
private void loadAccount(Account account) { nameInput.Text = account.Name; remarksInput.Text = account.Remarks; this.account = account; }
public AccountSaveForm(Account account) { InitializeComponent(); Text = "Edit Account"; loadAccount(account); }
private void transactionButton_Click(object sender, EventArgs e) { Account account = new Account(); account.Id = (long)accountListGrid.CurrentRow.Cells["id"].Value; account.Load(DatabaseFactory.Default); Form transactionsForm = new TransactionsForm(account); transactionsForm.MdiParent = MdiParent; transactionsForm.Show(); }
public TransactionsForm(Account account) { InitializeComponent(); this.account = account; Text = account.Name + " Transaction History"; }
private Account selectedAccount() { Account account = new Account(); account.Id = long.Parse(summaryGrid.CurrentRow.Cells["id"].Value.ToString()); account.Name = summaryGrid.CurrentRow.Cells["name"].Value.ToString(); return account; }
public AccountTransactions(Account account) { this.account = account; }
public virtual void Load() { string sql = "SELECT * FROM loans WHERE id=:id"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters[":id"] = Id; DataTable result = database.Query(sql, parameters); if (result.Rows.Count == 1) { DataRow row = result.Rows[0]; Principal = (decimal)row["principal"]; Type = (Loan.LoanType)int.Parse(row["type"].ToString()); if (Type == LoanType.AmortizedPayment) { Term = int.Parse(row["term"].ToString()); } InterestRate = (decimal)row["interest"]; TakenDate = (DateTime)row["taken_date"]; StartDate = (DateTime)row["start_date"]; processingFee = (decimal)row["processing_fee"]; //reloanFee = (decimal)row["reloan_fee"]; if (row["remarks"].GetType() != typeof(System.DBNull)) { Remarks = (string)row["remarks"]; } else { Remarks = ""; } Account loanAccount = new Account(); loanAccount.Id = (long)row["account_id"]; loanAccount.Load(database); Account = loanAccount; return; } throw new ApplicationException("Unable to load loan"); }
private void constructAccountLoansCondition(Account account, out string condition, Dictionary<string, object> parameters, bool includeClosedLoans = true) { List<string> conditionList = new List<string>(); conditionList.Add("account_id = :accountId"); parameters[":accountId"] = account.Id; if (!includeClosedLoans) { conditionList.Add("is_closed != 1"); } condition = string.Join(" AND ", conditionList.ToArray()); }