📄 feedirectionadddlg.cpp
字号:
// feedirectionAddDlg.cpp : implementation file
//
#include "stdafx.h"
#include "fee.h"
#include "feedirectionAddDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CfeedirectionAddDlg dialog
CfeedirectionAddDlg::CfeedirectionAddDlg(CWnd* pParent /*=NULL*/)
: CDialog(CfeedirectionAddDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CfeedirectionAddDlg)
m_uintaddsteptime = 0;
m_stradddirection = _T("");
m_floaddstartfee = 0;
m_uintaddstarttime = 0;
m_floaddstepfee = 0;
m_stradddirectionkind = _T("");
m_floaddaddfee = 0;
//}}AFX_DATA_INIT
}
void CfeedirectionAddDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CfeedirectionAddDlg)
DDX_Text(pDX, IDC_EDIT_FEEDIRECITION_ADDSTEPTIME, m_uintaddsteptime);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_ADDDIRECTION, m_stradddirection);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_ADDSTARTFEE, m_floaddstartfee);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_ADDSTARTTIME, m_uintaddstarttime);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_ADDSTEPFEE, m_floaddstepfee);
DDX_CBString(pDX, IDC_COMBO_FEEDIRECTION_ADDDIRECTIONKIND, m_stradddirectionkind);
DDX_Text(pDX, IDC_EDIT_FEEDIRECITION_ADDADDFEE, m_floaddaddfee);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CfeedirectionAddDlg, CDialog)
//{{AFX_MSG_MAP(CfeedirectionAddDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CfeedirectionAddDlg message handlers
void CfeedirectionAddDlg::OnOK()
{
UpdateData(TRUE);
// TODO: Add extra validation here
if (m_stradddirection=="")
{
AfxMessageBox("The charging office direction cannot be blank");
return;
}
/*
if (m_stradddirectionkind=="")
{
AfxMessageBox("The charging office direction property cannot be blank");
return;
}
if (m_uintaddstarttime==0)
{
AfxMessageBox("The start time cannot be 0");
return;
}
if (m_floaddstartfee==0)
{
AfxMessageBox("The start charge rate cannot be 0");
return;
}
if (m_uintaddsteptime==0)
{
AfxMessageBox("The step time cannot be 0");
return;
}
if (m_floaddstepfee==0)
{
AfxMessageBox("The step charge rate cannot be 0");
return;
}
*/
HRESULT result;
CString strSql,strTemp;
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
strSql.Format("select * from feedirection where feedirection='%s'",m_stradddirection);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open telephone table");
}
if (!pApp->m_pjifeiRecordset->adoEOF)
{
// AfxMessageBox("This charging office direction has existed");
// pApp->m_pjifeiRecordset->Close();
// return;
}
else
{
pApp->m_pjifeiRecordset->AddNew();
}
strTemp=m_stradddirection;
pApp->m_pjifeiRecordset->PutCollect("feedirection",_variant_t(strTemp));
strTemp=m_stradddirectionkind;
/*
if (strTemp=="Intra-cell rura")
strTemp="1";
if (strTemp=="Intra-cell local")
strTemp="2";
if (strTemp=="Inter-cell rural")
strTemp="4";
if (strTemp=="Inter-cell local")
strTemp="8";
if (strTemp=="Toll")
strTemp="16";
if (strTemp=="International")
strTemp="32";
if (strTemp=="Special")
strTemp="64";
*/
pApp->m_pjifeiRecordset->PutCollect("feedirectionkind",_variant_t(strTemp));
strTemp.Format("%d",m_uintaddstarttime);
pApp->m_pjifeiRecordset->PutCollect("feestarttime",_variant_t(strTemp));
strTemp.Format("%d",m_uintaddsteptime);
pApp->m_pjifeiRecordset->PutCollect("feesteptime",_variant_t(strTemp));
strTemp.Format("%d",m_floaddstartfee);
pApp->m_pjifeiRecordset->PutCollect("feestartfee",_variant_t(strTemp));
strTemp.Format("%d",m_floaddstepfee);
pApp->m_pjifeiRecordset->PutCollect("feestepfee",_variant_t(strTemp));
strTemp.Format("%d",m_floaddaddfee);
pApp->m_pjifeiRecordset->PutCollect("feeaddfee",_variant_t(strTemp));
pApp->m_pjifeiRecordset->Update();
pApp->m_pjifeiRecordset->Close();
CDialog::OnOK();
}
void CfeedirectionAddDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -