【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“FittingInfo.cpp”一文,供大家参考学习
// FittingInfo.cpp: implementation of the CFittingInfo class.
//
// 1 FittingId int 配件序号 Identity = Yes Allow Null = False 主键
// 2 TypeId int 类型编号 Allow Null = False
// 3 MarkId int 品牌编号 Allow Null = False
// 4 Std varchar(200) 型号规格 Allow Null = False
// 5 Productor varchar(200) 厂商 Allow Null = False
// 6 UnitPrice float 单价 Allow Null = False
// 7 InPrice float 进价 Allow Null = False
// 8 Maintain varchar(50) 保修期 Allow Null = False
// 9 ProviderId int 供应商编号 Allow Null = True
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "QuoteManage.h"
#include "FittingInfo.h"
#include "ADOConn.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFittingInfo::CFittingInfo()
{
FittingId = 0;
TypeId = 0;
MarkId = 0;
Std = "";
Productor = "";
UnitPrice = 0;
InPrice = 0;
Maintain = "";
ProviderId = 0;
}
CFittingInfo::~CFittingInfo()
{
}
// 判断在推荐表中是否存在某配件编号
int CFittingInfo::HaveRecFit(CString paraId)
{
//连接数据库
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//设置SELECT语句
_bstr_t vSQL;
vSQL = "SELECT * FROM RecommendInfo WHERE FittingId = " + paraId;
//执行SELECT语句
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
if (m_pRecordset->adoEOF)
return -1;
else
return 1;
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 判断在详单表中是否存在某配件编号
int CFittingInfo::HaveDetFit(CString paraId)
{
//连接数据库
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//设置SELECT语句
_bstr_t vSQL;
vSQL = "SELECT * FROM DetailQuote WHERE FittingId = " + paraId;
//执行SELECT语句
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
if (m_pRecordset->adoEOF)
return -1;
else
return 1;
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 判断是否存在供应商编号
int CFittingInfo::HaveProvider(CString paraId)
{
//连接数据库
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//设置SELECT语句
_bstr_t vSQL;
vSQL = "SELECT * FROM FittingInfo WHERE ProviderId = " + paraId;
//执行SELECT语句
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
if (m_pRecordset->adoEOF)
return -1;
else
return 1;
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 判断是否存在类型(品牌)编号
int CFittingInfo::HaveTypeId(CString paraTId,int iFlag)
{
//连接数据库
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//设置SELECT语句
_bstr_t vSQL;
if (iFlag == 0)
vSQL = "SELECT * FROM FittingInfo WHERE TypeId = " + paraTId;
else
vSQL = "SELECT * FROM FittingInfo WHERE MarkId = " + paraTId;
//执行SELECT语句
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
if (m_pRecordset->adoEOF)
return -1;
else
return 1;
//断开与数据库的连接
m_AdoConn.ExitConnect();
}
// 根据配件序号得到其他信息
void CFittingInfo::GetInfo(CString paraId)
{
//连接数据库
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
//设置SELECT语句
_bstr_t vSQL;
vSQL = "SELECT * FROM FittingInfo WHERE FittingId = " + paraId;
//执行SELETE语句
_RecordsetPtr m_pRecordset;
m_pRecordset = m_AdoConn.GetRecordSet(vSQL);
//返回各列的值
if (m_pRecordset->adoEOF)
CFittingInfo();
else
{
FittingId = atol(paraId);
TypeId = atol((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("TypeId"));
MarkId = atol((LPCTSTR)(_bstr_t)m_pRecordset-