您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 银行卡系统
  所属分类: C++
  开发工具:
  文件大小: 3mb
  下载次数: 0
  上传时间: 2012-01-15
  提 供 者: wjh627******
 详细说明: void CBankDlg::SetFace(int i) {//设置界面 switch(i) { case 0://初始银行界面 SetMainFace(true); break; case 1://开户界面 SetMainFace(false); GetDlgItem(IDC_LABLE1)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE4)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE5)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT4)->ShowWindow(SW_SHOW); break; case 2: SetMainFace(false); GetDlgItem(IDC_LABLE1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE5)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON7)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT5)->ShowWindow(SW_SHOW); break; case 3: SetMainFace(false); GetDlgItem(IDC_LABLE1)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_LABLE2)->SetWindowText("卡号:"); GetDlgItem(IDC_LABLE3)->SetWindowText("密码:"); GetDlgItem(IDC_LABLE4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE5)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT4)->ShowWindow(SW_HIDE); break; } } void CBankDlg::SetMainFace(bool show) {//设置银行主界面 if(show == true) { GetDlgItem(IDC_BUTTON7)->ShowWindow(SW_HIDE);//确定键隐藏 GetDlgItem(IDC_LABLE1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LABLE5)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT5)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_SHOW); } else { GetDlgItem(IDC_EDIT5)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTTON7)->ShowWindow(SW_SHOW); } } void CBankDlg::OnCancel() {//返回按钮 // TODO: Add your control notification handler code here CEdit *ed = (CEdit*)GetDlgItem(IDC_EDIT2); ed->SetPasswordChar(TEXT(0)); ed->SetLimitText(NULL); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; m_edit4data = 0; UpdateData(FALSE); SetFace(0); } void CBankDlg::OnExit() {//退出按钮 // TODO: Add your control notification handler code here this->GetParent()->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT1)->EnableWindow(TRUE); CDialog::OnOK(); } void CBankDlg::OnAddAccount() {//开户 // TODO: Add your control notification handler code here CEdit *ed = (CEdit*)GetDlgItem(IDC_EDIT2); ed->SetPasswordChar(TEXT('*')); ed->SetLimitText(6); SetFace(1); m_sure = 1; } void CBankDlg::OnDestoryAccount() {//销户 // TODO: Add your control notification handler code here SetFace(3); m_sure = 2; } void CBankDlg::OnReportLoss() {//挂失 // TODO: Add your control notification handler code here SetFace(3); m_sure = 3; } void CBankDlg::OnUnFreeze() {//接触冻结 // TODO: Add your control notification handler code here SetFace(3); m_sure = 4; } void CBankDlg::OnOK() {//确定键 // TODO: Add your control notification handler code here UpdateData(TRUE); switch(m_sure) { case 1: {//开户 if(m_edit1data == "" || m_edit2data == "" || m_edit3data == "") { MessageBox("资料不完整,请完善!","警告",MB_OK|MB_ICONWARNING); } else { if(m_edit2data.GetLength() < 6) { MessageBox("密码不足6位!","警告",MB_OK|MB_ICONWARNING); m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); } else { for(int i= 0;i<6;i++) { if(m_edit2data[i] <'0' || m_edit2data[i] >'9') {//非数字 m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); MessageBox("密码为0~9数字组成的六位数!","警告",MB_OK|MB_ICONWARNING); return; } } if(m_edit3data != m_edit2data) {//两次输入的密码不一致 m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); MessageBox("两次输入的密码不一致,请检查后重新输入!","错误",MB_OK|MB_ICONERROR); } else {//检查钱是否合理 if(m_edit4data < 0) {//不合理 m_edit2data = ""; m_edit3data = ""; m_edit4data = 0; UpdateData(FALSE); MessageBox("输入金额值非法!","错误",MB_OK|MB_ICONERROR); } else {//合理,可以开户 CString cardID;//卡号 int cardtemp; CDatabase db; CBank bank(&db;); CString strSql = "SELECT * FROM bank"; bank.Open(AFX_DB_USE_DEFAULT_TYPE,strSql); if(bank.GetRecordCount() == 0) { cardID="100000"; } else { bank.MoveLast();//移到最后一条记录,取出卡号 cardtemp = atoi(bank.m_cardNum); cardtemp++; db.Close();//关闭数据库 cardID.Format("%d",cardtemp); } CDatabase dbx; dbx.Open(_T("bank")); CString strFormat = "INSERT INTO bank VALUES ('%s','%s','%s',%f,%d)"; strSql.Format(strFormat,cardID,m_edit2data,m_edit1data,m_edit4data,1); dbx.ExecuteSQL(strSql); dbx.Close(); MessageBox("开户成功!","操作成功",MB_OK|MB_ICONINFORMATION); SetFace(2); CString str="您的账户信息如下:";//显示信息字符串 str += "\r\n"; str += " 卡号:"+cardID+"\r\n"; str += " 密码:"+m_edit2data+"\r\n"; CString strmoney = ""; strmoney.Format(" 余额:%f",m_edit4data); str += strmoney+"\r\n"; CTime nowtime = CTime::GetCurrentTime(); CString strtime = nowtime.Format("%Y年%m月%d日 %H:%M:%S"); str += " 开户时间:"+strtime+"\r\n"; GetDlgItem(IDC_EDIT5)->SetWindowText(str); //清空数据 } } } } } break; case 2://销户 if(m_edit1data == "" || m_edit2data == "" || m_edit3data == "" ) { MessageBox("资料不完整,请完善!","警告",MB_OK|MB_ICONWARNING); } else { CDatabase db; CBank bank(&db;); CString strSql; strSql.Format("SELECT * FROM bank WHERE cardNum = '%s'" , m_edit2data); bank.Open(AFX_DB_USE_DEFAULT_TYPE,strSql); if(bank.GetRecordCount() == 0) {//没有找到对应的信息 MessageBox("卡号不存在,无需销户!","警告",MB_OK|MB_ICONWARNING); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); OnCancel(); } else { if((bank.m_userID != m_edit1data) || (bank.m_passWord != m_edit3data)) { MessageBox("你输入的信息与账号不符,不能销户,请检查后重新输入!","警告",MB_OK|MB_ICONWARNING); db.Close(); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); return; } else {//销户 db.Close(); CDatabase dbx; dbx.Open(_T("bank")); strSql.Format("DELETE FROM bank WHERE bank.cardNum = '%s'",m_edit2data); dbx.ExecuteSQL(strSql); dbx.Close(); MessageBox("销户成功!","操作成功",MB_OK|MB_ICONINFORMATION); OnCancel(); } } } break; case 3://挂失 if(m_edit1data == "" || m_edit2data == "" || m_edit3data == "" ) { MessageBox("资料不完整,请完善!","警告",MB_OK|MB_ICONWARNING); } else { CDatabase db; CBank bank(&db;); CString strSql; strSql.Format("SELECT * FROM bank WHERE cardNum = '%s'" , m_edit2data); bank.Open(AFX_DB_USE_DEFAULT_TYPE,strSql); if(bank.GetRecordCount() == 0) {//没有找到对应的信息 MessageBox("卡号不存在,无需挂失!","警告",MB_OK|MB_ICONWARNING); OnCancel(); } else { if((bank.m_userID != m_edit1data) || (bank.m_passWord != m_edit3data)) { MessageBox("你输入的信息与账号不符,不能挂失,请检查后重新输入!","警告",MB_OK|MB_ICONWARNING); db.Close(); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); return; } else {//挂失 if(bank.m_positive == 0) {//已经冻结,无需挂失 MessageBox("你的账号已经挂失,无需重复挂失!","警告",MB_OK|MB_ICONWARNING); db.Close(); OnCancel(); } else { db.Close(); int active = FALSE; CDatabase dbx; dbx.Open(_T("bank")); strSql.Format("UPDATE bank SET positive = '%d' WHERE cardNum = '%s'",active,m_edit2data); dbx.ExecuteSQL(strSql); dbx.Close();//关闭数据库 MessageBox("挂失成功!","操作成功",MB_OK|MB_ICONINFORMATION); OnCancel(); } } } } break; case 4://接触挂失 if(m_edit1data == "" || m_edit2data == "" || m_edit3data == "" ) { MessageBox("资料不完整,请完善!","警告",MB_OK|MB_ICONWARNING); } else { CDatabase db; CBank bank(&db;); CString strSql; strSql.Format("SELECT * FROM bank WHERE cardNum = '%s'" , m_edit2data); bank.Open(AFX_DB_USE_DEFAULT_TYPE,strSql); if(bank.GetRecordCount() == 0) {//没有找到对应的信息 MessageBox("卡号不存在,不能解除挂失!","警告",MB_OK|MB_ICONWARNING); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); return; } else { if((bank.m_userID != m_edit1data) || (bank.m_passWord != m_edit3data)) { MessageBox("你输入的信息与账号不符,不能解除挂失,请检查后重新输入!","警告",MB_OK|MB_ICONWARNING); db.Close(); m_edit1data = ""; m_edit2data = ""; m_edit3data = ""; UpdateData(FALSE); return; } else {//解挂 if(bank.m_positive == 1) {//已经冻结,无需挂失 MessageBox("你的账号已经解除挂失,无需重复解除!","警告",MB_OK|MB_ICONWARNING); db.Close(); OnCancel(); } else { db.Close(); int active = TRUE; CDatabase dbx; dbx.Open(_T("bank")); strSql.Format("UPDATE bank SET positive = '%d' WHERE cardNum = '%s'",active,m_edit2data); dbx.ExecuteSQL(strSql); dbx.Close();//关闭数据库 MessageBox("解除挂失成功!","操作成功",MB_OK|MB_ICONINFORMATION); OnCancel(); } } } } break; } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 银行卡系统 智能IC卡
 输入关键字,在本站1000多万海量源码库中尽情搜索: