📄 routintedlg.cpp
字号:
// RoutInteDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TRS.h"
#include "RoutInteDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRoutInteDlg dialog
CRoutInteDlg::CRoutInteDlg(CWnd* pParent /*=NULL*/)
: CDialog(CRoutInteDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRoutInteDlg)
m_strStation = _T("");
//}}AFX_DATA_INIT
}
void CRoutInteDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRoutInteDlg)
DDX_Control(pDX, IDC_LIST_ROUT_INTE, m_listRoutInte);
DDX_Text(pDX, IDC_EDIT_ROUT_INTE, m_strStation);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRoutInteDlg, CDialog)
//{{AFX_MSG_MAP(CRoutInteDlg)
ON_BN_CLICKED(ID_BTN_ROUT_INTE_ADD, OnBtnRoutInteAdd)
ON_BN_CLICKED(ID_BTN_ROUT_INTE_CHECK, OnBtnRoutInteCheck)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRoutInteDlg message handlers
void CRoutInteDlg::OnBtnRoutInteAdd()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_strStation.IsEmpty())
{
MessageBox("站点名不能为空!");
return;
}
m_listRoutInte.AddString(m_strStation);
m_strStation = "";
UpdateData(false);
CWnd::GetDlgItem(IDC_EDIT_ROUT_INTE)->SetFocus();
}
void CRoutInteDlg::OnBtnRoutInteCheck()
{
// TODO: Add your control notification handler code here
CString location,strSQL;
CDBVariant numAvail;
CRecordset rs(&(((CTRSApp*)AfxGetApp())->db));
for(int i=0;i<m_listRoutInte.GetCount();i++)
{
m_listRoutInte.GetText(i,location);
strSQL = "select numAvail from HOTELS where location='"+location+"'";
rs.Open(CRecordset::forwardOnly,strSQL);
if(!rs.IsEOF())
{
rs.GetFieldValue("numAvail",numAvail);
if(numAvail.m_lVal <= 0)
{
MessageBox(location+"缺少宾馆!");
rs.Close();
return;
}
else
{
rs.Close();
}
}
else
{
MessageBox("缺少"+location+"的信息!");
rs.Close();
return;
}
strSQL = "select numAvail from CARS where location='"+location+"'";
rs.Open(CRecordset::forwardOnly,strSQL);
if(!rs.IsEOF())
{
rs.GetFieldValue("numAvail",numAvail);
if(numAvail.m_lVal <= 0)
{
MessageBox(location+"缺少宾馆!");
rs.Close();
return;
}
else
{
rs.Close();
}
}
else
{
MessageBox("缺少"+location+"的信息!");
rs.Close();
return;
}
}
MessageBox("路径完整!");
m_listRoutInte.ResetContent();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -