轉帳功能ui
1.DAL--cardinfo增長Exists方法--查詢某個卡號是否存在blog
/// <summary>ci
/// 是否存在該記錄get
/// </summary>string
public bool Exists(string cardID)it
{date
StringBuilder strSql = new StringBuilder();select
strSql.Append("select count(1) from cardinfo");方法
strSql.Append(" where cardID='" + cardID + "'");im
return DbHelperSQL.Exists(strSql.ToString());
}
2.BLL--cardinfo增長ZhuanZhang方法
public bool ZhuanZhang(string CardoutID,string CardInInID,decimal MoneyNum)
{
if (!dal.Exists(CardInInID)) { return false; } //接收方卡號不存在
bool isok = false;
if (UpdateBalance(CardoutID, -MoneyNum,"給"+ CardInInID+"轉帳支出"))
{
isok = true;
if (!UpdateBalance(CardInInID, MoneyNum,"收"+ CardoutID+"的轉賬"))
{
isok = false;
UpdateBalance(CardoutID, MoneyNum,"撤銷給"+CardInInID + "轉帳");
}
}
return isok;
}
3.WinF--Transfer窗體
1)爲窗體類增長卡號字段
2)編寫轉帳按鈕單擊方法
代碼以下:
4.WinF--main窗體---編寫轉帳菜單項代碼