InfoSet.cpp
上传用户:sunh8215
上传日期:2010-02-13
资源大小:1616k
文件大小:14k
- // InfoSet.cpp : implementation file
- //
- #include "stdafx.h"
- #include "qq.h"
- #include "InfoSet.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CGuestInfoSet
- IMPLEMENT_DYNAMIC(CGuestInfoSet, CRecordset)
- CGuestInfoSet::CGuestInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CGuestInfoSet)
- m_HandCode = _T("");
- m_Name = _T("");
- m_GuestType = _T("");
- m_Sex = _T("");
- m_Certificate = _T("");
- m_CertifyCode = _T("");
- // m_StartTime=_T("");
- m_IsMember = FALSE;
- m_IsMaster = FALSE;
- m_GroupID = _T("");
- m_GuestNum = 0;
- m_RoomNum = _T("");
- m_RoomCode = _T("");
- m_nFields = 12;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CGuestInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CGuestInfoSet::GetDefaultSQL()
- {
- return _T("[GuestInfo]");
- }
- void CGuestInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CGuestInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[HandCode]"), m_HandCode);
- RFX_Text(pFX, _T("[Name]"), m_Name);
- RFX_Text(pFX, _T("[GuestType]"), m_GuestType);
- RFX_Text(pFX, _T("[Sex]"), m_Sex);
- RFX_Text(pFX, _T("[Certificate]"), m_Certificate);
- RFX_Text(pFX, _T("[CertifyCode]"), m_CertifyCode);
- RFX_Bool(pFX, _T("[IsMember]"), m_IsMember);
- RFX_Bool(pFX, _T("[IsMaster]"), m_IsMaster);
- RFX_Text(pFX, _T("[GroupID]"), m_GroupID);
- RFX_Long(pFX, _T("[GuestNum]"), m_GuestNum);
- RFX_Text(pFX, _T("[RoomNum]"), m_RoomNum);
- RFX_Text(pFX, _T("[RoomCode]"), m_RoomCode);
- // RFX_Text(pFX, _T("[StartTime]"),m_StartTime);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CGuestInfoSet diagnostics
- #ifdef _DEBUG
- void CGuestInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CGuestInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CRoomInfoSet
- IMPLEMENT_DYNAMIC(CRoomInfoSet, CRecordset)
- CRoomInfoSet::CRoomInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CRoomInfoSet)
- m_RoomCode = _T("");
- m_RoomType = _T("");
- m_Floor = 0;
- m_Phone = _T("");
- m_RoomStatus = _T("");
- m_PriceType = FALSE;
- m_Price = 0.0f;
- m_nFields = 7;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CRoomInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CRoomInfoSet::GetDefaultSQL()
- {
- return _T("[RoomInfo]");
- }
- void CRoomInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CRoomInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[RoomCode]"), m_RoomCode);
- RFX_Text(pFX, _T("[RoomType]"), m_RoomType);
- RFX_Int(pFX, _T("[Floor]"), m_Floor);
- RFX_Text(pFX, _T("[Phone]"), m_Phone);
- RFX_Text(pFX, _T("[RoomStatus]"), m_RoomStatus);
- RFX_Bool(pFX, _T("[PriceType]"), m_PriceType);
- RFX_Single(pFX, _T("[Price]"), m_Price);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CRoomInfoSet diagnostics
- #ifdef _DEBUG
- void CRoomInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CRoomInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- //////////////////////////////////////////////////////////////////////
- // CCreateBillCode Class
- //////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- //int CCreateBillCode::m_BillNum=0;
- CCreateBillCode::CCreateBillCode()
- {
- // m_BillNum++;
- }
- CCreateBillCode::~CCreateBillCode()
- {
- }
- CString CCreateBillCode::GenereBillCode()
- {//产生帐单号码
- long n=0;
- CBillInfoSet m_BillInfoSet;
- if(!m_BillInfoSet.Open())
- {
- AfxMessageBox("打开数据库失败!");
- return CString("");
- }
- // long n=m_BillInfoSet.GetRecordCount();
- //不要调用GetRecordCount()函数会得到错误的结果
- m_BillInfoSet.MoveFirst();//移动到第一条记录
- while (!m_BillInfoSet.IsEOF())
- {
- n++;
- m_BillInfoSet.MoveNext();//移动到下一条记录
- }
- m_BillInfoSet.Close(); //关闭数据库
- CTime time=CTime::GetCurrentTime();
- CString str=time.Format("%H%M");
- CString strBillCode;
- strBillCode.Format("%ld",n+1);
- strBillCode="B"+str+strBillCode;
- return strBillCode;
- }
- CString CCreateBillCode::GenereBillCodeForCheckOut()
- {//为结帐帐单产生帐单号码
- //产生帐单号码
- long n=0;
- CBillCheckoutInfoSet m_BillCheckoutInfoSet;
- if(!m_BillCheckoutInfoSet.Open())
- {
- AfxMessageBox("打开数据库失败!");
- return CString("");
- }
- // long n=m_BillInfoSet.GetRecordCount();
- //不要调用GetRecordCount()函数会得到错误的结果
- m_BillCheckoutInfoSet.MoveFirst();//移动到第一条记录
- while (!m_BillCheckoutInfoSet.IsEOF())
- {
- n++;
- m_BillCheckoutInfoSet.MoveNext();//移动到下一条记录
- }
- m_BillCheckoutInfoSet.Close(); //关闭数据库
- CTime time=CTime::GetCurrentTime();
- CString str=time.Format("%H%M%S");
- CString strBillCode;
- strBillCode.Format("%ld",n+1);
- strBillCode="B"+str+strBillCode;
- return strBillCode;
- }
- //////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////
- // CBillInfoSet
- IMPLEMENT_DYNAMIC(CBillInfoSet, CRecordset)
- CBillInfoSet::CBillInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CBillInfoSet)
- m_BillCode = _T("");
- m_HandCode = _T("");
- m_Sum = 0;
- m_Paid = 0;
- m_Rebate = _T("");
- m_Striked = FALSE;
- m_nFields = 6;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CBillInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CBillInfoSet::GetDefaultSQL()
- {
- return _T("[BillInfo]");
- }
- void CBillInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CBillInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[BillCode]"), m_BillCode);
- RFX_Text(pFX, _T("[HandCode]"), m_HandCode);
- RFX_Long(pFX, _T("[Sum]"), m_Sum);
- RFX_Long(pFX, _T("[Paid]"), m_Paid);
- RFX_Text(pFX, _T("[Rebate]"), m_Rebate);
- RFX_Bool(pFX, _T("[Striked]"), m_Striked);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CBillInfoSet diagnostics
- #ifdef _DEBUG
- void CBillInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CBillInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CServerInfoSet
- IMPLEMENT_DYNAMIC(CServerInfoSet, CRecordset)
- CServerInfoSet::CServerInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CServerInfoSet)
- m_ServerName = _T("");
- m_ServerPrice = 0.0f;
- m_nFields = 2;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CServerInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CServerInfoSet::GetDefaultSQL()
- {
- return _T("[ServerInfo]");
- }
- void CServerInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CServerInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[ServerName]"), m_ServerName);
- RFX_Single(pFX, _T("[ServerPrice]"), m_ServerPrice);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CServerInfoSet diagnostics
- #ifdef _DEBUG
- void CServerInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CServerInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CFoodInfoSet
- IMPLEMENT_DYNAMIC(CFoodInfoSet, CRecordset)
- CFoodInfoSet::CFoodInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CFoodInfoSet)
- m_FoodName = _T("");
- m_FoodPrice = 0.0f;
- m_nFields = 2;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CFoodInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CFoodInfoSet::GetDefaultSQL()
- {
- return _T("[FoodInfo]");
- }
- void CFoodInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CFoodInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[FoodName]"), m_FoodName);
- RFX_Single(pFX, _T("[FoodPrice]"), m_FoodPrice);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CFoodInfoSet diagnostics
- #ifdef _DEBUG
- void CFoodInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CFoodInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEmployerInfoSet
- IMPLEMENT_DYNAMIC(CEmployerInfoSet, CRecordset)
- CEmployerInfoSet::CEmployerInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CEmployerInfoSet)
- m_EmployerCode = _T("");
- m_Name = _T("");
- m_Depart = _T("");
- m_nFields = 3;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CEmployerInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CEmployerInfoSet::GetDefaultSQL()
- {
- return _T("[EmployerInfo]");
- }
- void CEmployerInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CEmployerInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[EmployerCode]"), m_EmployerCode);
- RFX_Text(pFX, _T("[Name]"), m_Name);
- RFX_Text(pFX, _T("[Depart]"), m_Depart);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEmployerInfoSet diagnostics
- #ifdef _DEBUG
- void CEmployerInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CEmployerInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CBillContentInfoSet
- IMPLEMENT_DYNAMIC(CBillContentInfoSet, CRecordset)
- CBillContentInfoSet::CBillContentInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CBillContentInfoSet)
- m_BillCode = _T("");
- m_BillContent = _T("");
- m_nFields = 2;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CBillContentInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CBillContentInfoSet::GetDefaultSQL()
- {
- return _T("[BillContentInfo]");
- }
- void CBillContentInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CBillContentInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[BillCode]"), m_BillCode);
- RFX_Text(pFX, _T("[BillContent]"), m_BillContent);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CBillContentInfoSet diagnostics
- #ifdef _DEBUG
- void CBillContentInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CBillContentInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CBillCheckoutInfoSet
- IMPLEMENT_DYNAMIC(CBillCheckoutInfoSet, CRecordset)
- CBillCheckoutInfoSet::CBillCheckoutInfoSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CBillCheckoutInfoSet)
- m_BillCode = _T("");
- m_HandCode = _T("");
- m_Sum = _T("");
- m_nFields = 5;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CBillCheckoutInfoSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CBillCheckoutInfoSet::GetDefaultSQL()
- {
- return _T("[BillCheckoutInfo]");
- }
- void CBillCheckoutInfoSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CBillCheckoutInfoSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[BillCode]"), m_BillCode);
- RFX_Text(pFX, _T("[HandCode]"), m_HandCode);
- RFX_Date(pFX, _T("[StartTime]"), m_StartTime);
- RFX_Date(pFX, _T("[EndTime]"), m_EndTime);
- RFX_Text(pFX, _T("[Sum]"), m_Sum);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CBillCheckoutInfoSet diagnostics
- #ifdef _DEBUG
- void CBillCheckoutInfoSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CBillCheckoutInfoSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////
- // CDestineRoomSet
- IMPLEMENT_DYNAMIC(CDestineRoomSet, CRecordset)
- CDestineRoomSet::CDestineRoomSet(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CDestineRoomSet)
- m_BillCode = _T("");
- m_Certificate = _T("");
- m_CeritifyCode = _T("");
- m_DestinerName = _T("");
- m_DestinerSex = _T("");
- m_DestineMoney = _T("");
- m_DestineTime = _T("");
- m_DestineEndTime = _T("");
- m_DestineRoomCode = _T("");
- m_nFields = 9;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CDestineRoomSet::GetDefaultConnect()
- {
- return _T("ODBC;DSN=酒店管理系统");
- }
- CString CDestineRoomSet::GetDefaultSQL()
- {
- return _T("[RoomDestine]");
- }
- void CDestineRoomSet::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CDestineRoomSet)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Text(pFX, _T("[BillCode]"), m_BillCode);
- RFX_Text(pFX, _T("[Certificate]"), m_Certificate);
- RFX_Text(pFX, _T("[CeritifyCode]"), m_CeritifyCode);
- RFX_Text(pFX, _T("[DestinerName]"), m_DestinerName);
- RFX_Text(pFX, _T("[DestinerSex]"), m_DestinerSex);
- RFX_Text(pFX, _T("[DestineMoney]"), m_DestineMoney);
- RFX_Text(pFX, _T("[DestineTime]"), m_DestineTime);
- RFX_Text(pFX, _T("[DestineEndTime]"), m_DestineEndTime);
- RFX_Text(pFX, _T("[DestineRoomCode]"), m_DestineRoomCode);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CDestineRoomSet diagnostics
- #ifdef _DEBUG
- void CDestineRoomSet::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CDestineRoomSet::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG