private void editAccountToolStripMenuItem_Click(object sender, EventArgs e) { Account account = selectedAccount(); account.Load(DatabaseFactory.Default); Form editAccountForm = new AccountSaveForm(account); editAccountForm.Show(); }
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(); }
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 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"); }
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"); }