예제 #1
0
        private void editAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Account account = selectedAccount();

            account.Load(DatabaseFactory.Default);
            Form editAccountForm = new AccountSaveForm(account);

            editAccountForm.Show();
        }
예제 #2
0
 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();
 }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }
예제 #5
0
파일: Loan.cs 프로젝트: jsmnlcbls/Loanbook
        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");
        }
예제 #6
0
파일: Loan.cs 프로젝트: jsmnlcbls/Loanbook
        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");
        }
예제 #7
0
        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();
        }