Beispiel #1
0
        private void button13_Click(object sender, EventArgs e)
        {
            float balance    = DAO.get_balance(acwithdraw.Accid);
            float newbalance = float.Parse(textBox1.Text.ToString());

            Console.WriteLine(balance);
            if (balance - newbalance > 0)
            {
                newbalance = balance - newbalance;
                if (DAO.deposit(acwithdraw.Accid, newbalance))
                {
                    MessageBox.Show("取款成功!\n现金账户余额:" + newbalance);
                }
                else
                {
                    MessageBox.Show("取款成功!\n现金账户余额:" + balance);
                }
            }
            else
            {
                string accounttype = DAO.get_accounttype(acwithdraw.Accid);
                Console.WriteLine(accounttype);
                float limit = DAO.get_limit(acwithdraw.Accid);
                if (String.Equals(accounttype, "信用卡"))
                {
                    DialogResult r1 = MessageBox.Show("现金余额不足,是否使用信用卡额度", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (r1.ToString() == "Yes")
                    {
                        if (limit + balance > newbalance)
                        {
                            if (DAO.deposit(acwithdraw.Accid, 0))
                            {
                                limit = limit - (newbalance - balance);
                                if (DAO.quota(acwithdraw.Accid, limit))
                                {
                                    MessageBox.Show("取款成功!\n现金账户余额:0\n信用卡余额:" + limit);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("信用卡余额不足!");
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("取款失败!\n当前账户余额:" + balance);
                }
            }
        }