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

📄 clientinfoset.cpp

📁 用VC写的监控中心后台程序。 代码全
💻 CPP
字号:
// ClientinfoSet.cpp : implementation file
//

#include "stdafx.h"
#include "GpsSC.h"
#include "ClientinfoSet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClientinfoSet

IMPLEMENT_DYNAMIC(CClientinfoSet, CRecordset)

CClientinfoSet::CClientinfoSet(CDatabase* pdb)
	: CRecordset(pdb)
{
	//{{AFX_FIELD_INIT(CClientinfoSet)
	m_ID = 0;
	m_ClientName = _T("");
	m_ClientAge = _T("");
	m_ClientUnits = _T("");
	m_ClientDuty = _T("");
	m_ClientIDcard = _T("");
	m_ClientDrivelicence = _T("");
	m_ClientPhone = _T("");
	m_ClientPassword = _T("");
	m_CarNumber = _T("");
	m_CarType = _T("");
	m_CarColor = _T("");
	m_CarEngine = _T("");
	m_BatholithNo = _T("");
	m_CarPhone = _T("");
	m_nFields = 15;
	//}}AFX_FIELD_INIT
	m_nDefaultType = snapshot;
}


CString CClientinfoSet::GetDefaultConnect()
{
	return _T("ODBC;DSN=CenterDataBase");
}

CString CClientinfoSet::GetDefaultSQL()
{
	return _T("[Clientinfo]");
}

void CClientinfoSet::DoFieldExchange(CFieldExchange* pFX)
{
	//{{AFX_FIELD_MAP(CClientinfoSet)
	pFX->SetFieldType(CFieldExchange::outputColumn);
	RFX_Long(pFX, _T("[ID]"), m_ID);
	RFX_Text(pFX, _T("[客户姓名]"), m_ClientName);
	RFX_Text(pFX, _T("[客户年龄]"), m_ClientAge);
	RFX_Text(pFX, _T("[客户单位]"), m_ClientUnits);
	RFX_Text(pFX, _T("[客户职务]"), m_ClientDuty);
	RFX_Text(pFX, _T("[客户身份证号码]"), m_ClientIDcard);
	RFX_Text(pFX, _T("[客户驾驶证号码]"), m_ClientDrivelicence);
	RFX_Text(pFX, _T("[客户联系电话]"), m_ClientPhone);
	RFX_Text(pFX, _T("[客户密码]"), m_ClientPassword);
	RFX_Text(pFX, _T("[车牌号码]"), m_CarNumber);
	RFX_Text(pFX, _T("[车辆型号]"), m_CarType);
	RFX_Text(pFX, _T("[车辆颜色]"), m_CarColor);
	RFX_Text(pFX, _T("[发动机编号]"), m_CarEngine);
	RFX_Text(pFX, _T("[底盘编号]"), m_BatholithNo);
	RFX_Text(pFX, _T("[车载电话号码]"), m_CarPhone);
	//}}AFX_FIELD_MAP
}

/////////////////////////////////////////////////////////////////////////////
// CClientinfoSet diagnostics

#ifdef _DEBUG
void CClientinfoSet::AssertValid() const
{
	CRecordset::AssertValid();
}

void CClientinfoSet::Dump(CDumpContext& dc) const
{
	CRecordset::Dump(dc);
}
#endif //_DEBUG

void CClientinfoSet::FindCarPhone(CString strItemText, CString &strCarPhone)
{
	try
	{
		if(!IsOpen())
			Open();
		if(!IsEOF())
			MoveFirst();
		else
			return;
		while(!IsEOF())
		{
			if((m_ClientName==strItemText)||(m_CarNumber==strItemText))
			{
				strCarPhone=m_CarPhone;
				break;
			}
			MoveNext();
		}
	}
	catch(CDBException *Exp)
	{
		AfxMessageBox(Exp->m_strError);
	}
}

void CClientinfoSet::FindCarNumberAndPhone(CString strItemText, CString &strCarNumber, CString &strCarPhone)
{
	try
	{
		if(!IsOpen())
			Open();
		if(!IsEOF())
			MoveFirst();
		else
			return;
		while(!IsEOF())
		{
			if((m_ClientName==strItemText)||(m_CarNumber==strItemText))
			{
				strCarNumber=m_CarNumber;
				strCarPhone	=m_CarPhone;
				break;
			}
			MoveNext();
		}
	}
	catch(CDBException *Exp)
	{
		AfxMessageBox(Exp->m_strError);
	}
}

void CClientinfoSet::FindClientinfo(CString strCarPhone, CString &strClientName, CString &strCarNumber)
{
	try
	{
		if(!IsOpen())
			Open();
		if(!IsEOF())
			MoveFirst();
		else
			return;
		while(!IsEOF())
		{
			if(m_CarPhone==strCarPhone)
			{
				strClientName	=m_ClientName;
				strCarNumber	=m_CarNumber;
				break;
			}
			MoveNext();
		}
	}
	catch(CDBException *Exp)
	{
		AfxMessageBox(Exp->m_strError);
	}
}

CString	CClientinfoSet::GetPassword(CString strCarPhone)
{
	try
	{
		if(!IsOpen())
			Open();
		if(!IsEOF())
			MoveFirst();
		while(!IsEOF())
		{
			if(m_ClientPhone==strCarPhone)
				return m_ClientPassword;
			MoveNext();
		}
	}
	catch(CDBException *Exp)
	{
		AfxMessageBox(Exp->m_strError);
	}
	return "";
}

void CClientinfoSet::FindCarPswAndNO(CString strItemText,CString &strCarNO,CString &strCarPassword)
{
	try
	{
		if(!IsOpen())
			Open();
		if(!IsEOF())
			MoveFirst();
		else
			return;
		while(!IsEOF())
		{
			if((m_ClientName==strItemText)||(m_CarNumber==strItemText))
			{
				strCarPassword	=m_ClientPassword;
				strCarNO		=m_CarPhone;
				break;
			}
			MoveNext();
		}
	}
	catch(CDBException *Exp)
	{
		AfxMessageBox(Exp->m_strError);
	}
}

⌨️ 快捷键说明

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