⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guajie.cpp

📁 一个简单的银行管理程序 VC++实现
💻 CPP
字号:
// GuaJie.cpp : implementation file
//

#include "stdafx.h"
#include "BankSystem.h"
#include "GuaJie.h"
#include "BankSystemDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGuaJie dialog


CGuaJie::CGuaJie(CWnd* pParent /*=NULL*/)
	: CDialog(CGuaJie::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGuaJie)
	m_strUser = _T("");
	m_strID = _T("");
	m_strPassW = _T("");
	//}}AFX_DATA_INIT
}


void CGuaJie::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGuaJie)
	DDX_Text(pDX, IDC_EDIT1, m_strUser);
	DDX_Text(pDX, IDC_EDIT2, m_strID);
	DDX_Text(pDX, IDC_EDIT3, m_strPassW);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGuaJie, CDialog)
	//{{AFX_MSG_MAP(CGuaJie)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGuaJie message handlers

void CGuaJie::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);
	CBankSystemApp * pApp = (CBankSystemApp*)AfxGetApp();
	CBankSystemDlg * m_pMain = (CBankSystemDlg*)pApp->m_pMainWnd;
	
	_RecordsetPtr m_pRecordset;
	_ConnectionPtr m_pConnection=m_pMain->m_pConnection;
	CString strSQL,strID,strPassW;
	_variant_t varStatus;

	bool b=m_strUser.IsEmpty();
	if(m_strUser.IsEmpty()||m_strID.IsEmpty()||m_strPassW.IsEmpty())
	{
		AfxMessageBox("请填写详细信息!");
		return;
	}
	strSQL="SELECT * FROM Acount where 账号=";
	strSQL+=m_strUser;
	m_pRecordset.CreateInstance(__uuidof(Recordset));
	m_pRecordset->Open(_variant_t(strSQL),m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
	if(m_pRecordset->adoEOF)
	{
		AfxMessageBox("查无此纪录!");
		return;
	}
	if(m_pMain->m_bGuashi)   //挂失
	{
		strID=(LPCSTR)_bstr_t(m_pRecordset->GetCollect("身份证"));
		strPassW=(LPCSTR)_bstr_t(m_pRecordset->GetCollect("密码"));
		if(m_strID==strID&&m_strPassW==strPassW)
		{
			varStatus=_variant_t("挂失");
			m_pRecordset->PutCollect("状态",varStatus);
			AfxMessageBox("挂失成功!");
		}
		else 
		{
			AfxMessageBox("用户信息不正确!");
		}
	}
	if(m_pMain->m_bJiegua)   //解挂
	{
		strID=(LPCSTR)_bstr_t(m_pRecordset->GetCollect("身份证"));
		strPassW=(LPCSTR)_bstr_t(m_pRecordset->GetCollect("密码"));
		if(m_strID==strID&&m_strPassW==strPassW)
		{
			varStatus=_variant_t("正常");
			m_pRecordset->PutCollect("状态",varStatus);
			AfxMessageBox("成功!");
		}
		else 
		{
			AfxMessageBox("用户信息不正确!");
		}
	}

	m_pRecordset->Update();	
	m_pRecordset->Close();
	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -