📄 orderdialog.cpp
字号:
// OrderDialog.cpp : implementation file
//
#include "stdafx.h"
#include "order.h"
#include "OrderDialog.h"
#include "RoomRecordset.h"
#include "ListRecordset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COrderDialog dialog
COrderDialog::COrderDialog(CWnd* pParent /*=NULL*/)
: CDialog(COrderDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(COrderDialog)
m_odate = _T("");
m_odays = 0;
m_oid = _T("");
m_oname = _T("");
m_opid = _T("");
m_osex = _T("");
//}}AFX_DATA_INIT
}
void COrderDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COrderDialog)
DDX_Text(pDX, IDC_ODATE, m_odate);
DDX_Text(pDX, IDC_ODAYS, m_odays);
DDX_Text(pDX, IDC_OID, m_oid);
DDX_Text(pDX, IDC_ONAME, m_oname);
DDX_Text(pDX, IDC_OPID, m_opid);
DDV_MaxChars(pDX, m_opid, 18);
DDX_Text(pDX, IDC_OSEX, m_osex);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COrderDialog, CDialog)
//{{AFX_MSG_MAP(COrderDialog)
ON_BN_CLICKED(IDC_ORDERROOM, OnOrderroom)
ON_BN_CLICKED(IDC_RESET, OnReset)
ON_BN_CLICKED(IDC_EXIT, OnExit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COrderDialog message handlers
void COrderDialog::OnOrderroom()
{
// TODO: Add your control notification handler code here
//////property
CRoomRecordset rrs;
CListRecordset lrs;
CEdit *pEditOid=(CEdit*)this->GetDlgItem(IDC_OID);
///////operatio订房操作
UpdateData(TRUE);
if(m_odate.IsEmpty()||m_odays==0||m_oid.IsEmpty()||m_oname.IsEmpty()||m_opid.IsEmpty()||m_osex.IsEmpty())
{
MessageBox("请填写完整信息!");
return;
}
rrs.Open();
if(rrs.CheckRoomId(m_oid)==1)//写入房间信息数据库
{
// CString price;
rrs.m_strFilter="rid='"+m_oid+"'";
rrs.Requery();
//rrs.GetFieldValue(2,price);
rrs.Edit();
rrs.m_rbdate=m_odate;
rrs.m_rdays=m_odays;
rrs.m_rname=m_oname;
rrs.m_rsex=m_osex;
rrs.m_rstate="Y";
rrs.Update();
lrs.Open();/////////////写入订单数据库
lrs.AddNew();
lrs.m_obtime=m_odate;
lrs.m_odays=m_odays;
lrs.m_oname=m_oname;
//lrs.m_oprice=price;
lrs.m_opeopleid=m_opid;
lrs.m_oroomid=m_oid;
lrs.m_osex=m_osex;
if(lrs.Update())
MessageBox("订房成功!");
else
MessageBox("订房信息写入失败!");
}
else
{
MessageBox("请输入有效的房间号");
pEditOid->SetWindowText("");
pEditOid->SetFocus();
}
}
void COrderDialog::OnReset() ///////////////////////重置操作
{
// TODO: Add your control notification handler code here
m_odate.Empty();
m_odays=0;
m_oid.Empty();
m_oname.Empty();
m_opid.Empty();
m_osex.Empty();
UpdateData(FALSE);
}
//DEL void COrderDialog::OnExit()
//DEL {
//DEL // TODO: Add your control notification handler code here
//DEL // this->OnCancel();
//DEL // HWND hwnd=this->m_hWnd;
//DEL // this->ShowWindow(SW_HIDE);
//DEL // CWnd* pWnd=GetParent();
//DEL // ::SendMessage(hwnd,WM_CLOSE,0,0);
//DEL }
void COrderDialog::OnExit() /////////////退出
{
// TODO: Add your control notification handler code here
COrderDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -