Пример #1
0
        private void Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
            AccountBoard accountBoard = new AccountBoard(account);

            accountBoard.Show();
        }
Пример #2
0
        private void Determine_Click(object sender, EventArgs e)
        {
            float amount = keyBoard.GetAmount();

            //Console.WriteLine(amount);
            if (amount == 0)
            {
                MessageBox.Show("请输入不为0的数字!");
                return;
            }
            int result = DAO.Access(account, status, amount);

            switch (result)
            {
            case -1:
                MessageBox.Show("账户金额变动失败!");
                break;

            case 0:
                this.Close();
                DAO.GetAccount(account);
                AccountBoard accountBoard = new AccountBoard(account);
                accountBoard.Show();
                break;

            case 1:
                MessageBox.Show(String.Format("存款金额{0}超过权限({1}元)!", amount.ToString(), authority.Draw.ToString()));
                break;

            case 2:
                MessageBox.Show(String.Format("取款金额{0}后超过信用额({1}元)!", amount.ToString(), authority.Loan.ToString()));
                break;
            }
        }
Пример #3
0
        private void AccountView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row     = this.accountView.Rows[this.accountView.CurrentRow.Index];
            Account         account = new Account(row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), Convert.ToInt16(row.Cells[2].Value), Convert.ToBoolean(row.Cells[3].Value), Convert.ToSingle(row.Cells[4].Value), Convert.ToInt16(row.Cells[5].Value), user.UserId.ToString(), Convert.ToSingle(row.Cells[6].Value));

            this.Close();
            AccountBoard accountBoard = new AccountBoard(account);

            accountBoard.Show();
        }
Пример #4
0
        private void Determine_Click(object sender, EventArgs e)
        {
            float amount = keyBoard.GetAmount();

            //Console.WriteLine(amount);
            if (account.Balance < 0)
            {
                MessageBox.Show("您已负债,不能转账!");
                return;
            }
            if (amount == 0)
            {
                MessageBox.Show("请输入不为0的数字!");
                return;
            }
            if (inUser.Checked || allUser.Checked)
            {
                if (inUser.Checked)
                {
                    if (accountList.SelectedIndex == -1)
                    {
                        MessageBox.Show("请选择!");
                        return;
                    }
                    else
                    {
                        tarAccount.AccountID = accountList.SelectedValue.ToString().Trim();
                    }
                }
                else
                {
                    if (account.AccountID == tarAccountID.Text.ToString().Trim())
                    {
                        MessageBox.Show("账户ID不能相同");
                        return;
                    }
                    else
                    {
                        if (DAO.GetAccount(new Account(tarAccountID.Text.ToString().Trim())).AccountName == null)
                        {
                            MessageBox.Show(String.Format("找不到这个账户ID({0})!", tarAccountID.Text.ToString().Trim()));
                            return;
                        }
                        else
                        {
                            tarAccount.AccountID = tarAccountID.Text.ToString().Trim();
                        }
                    }
                }
                DAO.GetAccount(tarAccount);
                int result = DAO.Transfer(account, tarAccount, amount);
                switch (result)
                {
                case -1:
                    MessageBox.Show(String.Format("转账失败!{0}->{1}", account.AccountID, tarAccount.AccountID));
                    break;

                case 0:
                    MessageBox.Show(String.Format("转账{0}成功!{1}->{2}", amount, account.AccountID, tarAccount.AccountID));
                    this.Close();
                    DAO.GetAccount(account);
                    AccountBoard accountBoard = new AccountBoard(account);
                    accountBoard.Show();
                    break;

                case 1:
                    MessageBox.Show(String.Format("转账数额{0}超过取款限制{1}元!", amount, DAO.AccessAuthority(account.Grade).Draw));
                    break;

                case 2:
                    MessageBox.Show(String.Format("转账数额{0}后源账户余额小于0!", amount));
                    break;
                }
            }
            else
            {
                MessageBox.Show("请选择转账方式!");
            }
        }