private void button13_Click_1(object sender, EventArgs e) { float balance1 = DAO.get_balance(acwithdraw.Accid); float balance2 = DAO.get_balance(acwithdraw1.Accid); Console.WriteLine(balance1); float transferbalance = float.Parse(textBox1.Text.ToString()); if (balance1 - transferbalance > 0) { float newbalance = balance1 - transferbalance; if (DAO.deposit(acwithdraw.Accid, balance1 - transferbalance) && DAO.deposit(acwithdraw1.Accid, balance2 + transferbalance)) { MessageBox.Show("转账成功!\n当前现金账户余额:" + newbalance); } else { MessageBox.Show("转账失败!\n当前现金账户余额:" + balance1); } } else { MessageBox.Show("余额不足!\n当前现金账户余额:" + balance1); } }
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); } } }
private void button13_Click(object sender, EventArgs e) { float balance = DAO.get_balance(acdeposit.Accid); Console.WriteLine(balance); float newbalance = balance + float.Parse(textBox1.Text.ToString()); if (DAO.deposit(acdeposit.Accid, newbalance)) { MessageBox.Show(" 存款成功!\n现金账户余额:" + newbalance); } else { MessageBox.Show(" 存款失败!\n现金账户余额:" + balance); } }