/// <summary> /// 50 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn1_Click(object sender, EventArgs e) { int number = Convert.ToInt32(btn1.Text); number = 50; //返回用户当前总余额 int usernum = bankbll.Withdrawal(sum(), number); if (usernum >= 0) { int SumNumber = usernum - number; if (SumNumber < 0) { MessageBox.Show("取款失败,卡内余额不足!"); } else { bool usernumber = bankbll.Withdrawals(sum(), SumNumber); if (usernumber == true) { //1、用户表记录 string time = DateTime.Now.ToString(); //2、如果操作成功则在记录表中记录当前卡号的操作 RecordingInfo recordingInfo = new RecordingInfo(); recordingInfo.Timet = time; recordingInfo.Details = "取款" + number.ToString() + "金额"; recordingInfo.Card_Number = sum().ToString(); bool record = recordingbll.WithdrawalRecord(recordingInfo); MessageBox.Show("取款:" + number.ToString() + "取款时间:" + time + "成功"); } } } }