📄 feedirectionlistdlg.cpp
字号:
// feedirectionListDlg.cpp : implementation file
//
#include "stdafx.h"
#include "fee.h"
#include "feedirectionListDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CfeedirectionListDlg dialog
CfeedirectionListDlg::CfeedirectionListDlg(CWnd* pParent /*=NULL*/)
: CDialog(CfeedirectionListDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CfeedirectionListDlg)
m_strfeelistdirection = _T("");
m_flofeeliststartfee = 0;
m_uintfeeliststarttime = 0;
m_flofeeliststepfee = 0;
m_uintfeeliststeptime = 0;
m_strfeelistdirectionkind = _T("");
m_flofeelistaddfee = 0;
//}}AFX_DATA_INIT
}
void CfeedirectionListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CfeedirectionListDlg)
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LISTDIRECTION, m_strfeelistdirection);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LISTSTARTFE, m_flofeeliststartfee);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LISTSTARTTIME, m_uintfeeliststarttime);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LISTSTEPFEE, m_flofeeliststepfee);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LISTSTEPTIME, m_uintfeeliststeptime);
DDX_CBString(pDX, IDC_COMBO_FEEDIRECTION_DIRECRIONKIND, m_strfeelistdirectionkind);
DDX_Text(pDX, IDC_EDIT_FEEDIRECTION_LIST_ADDFEE, m_flofeelistaddfee);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CfeedirectionListDlg, CDialog)
//{{AFX_MSG_MAP(CfeedirectionListDlg)
ON_BN_CLICKED(ID_FEEDIRECTIONLIST_MODIFY, OnFeedirectionlistModify)
ON_BN_CLICKED(ID_FEEDIRECTIONLIST_DELETE, OnFeedirectionlistDelete)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CfeedirectionListDlg message handlers
void CfeedirectionListDlg::OnFeedirectionlistModify()
{
// TODO: Add your control notification handler code here
HRESULT result;
// TODO: Add your control notification handler code here
CString strSql,strTemp;
CString olddirection,olddirectionkind;
UINT oldstarttime,oldsteptime;
UINT oldstartfee,oldendfee;
olddirection=m_strfeelistdirection;
olddirectionkind=m_strfeelistdirectionkind;
oldstarttime=m_uintfeeliststarttime;
oldstartfee=m_flofeeliststartfee;
oldsteptime=m_uintfeeliststeptime;
oldendfee=m_flofeeliststepfee;
UpdateData(TRUE);
CFeeApp* pApp;
pApp=(CFeeApp *)AfxGetApp();
strSql.Format("select * from feedirection where feedirection='%s'",\
olddirection);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open feedirection table");
}
if(!pApp->m_pjifeiRecordset->adoEOF)
{
strTemp=m_strfeelistdirection;
pApp->m_pjifeiRecordset->PutCollect("feedirection",_variant_t(strTemp));
strTemp=m_strfeelistdirectionkind;
pApp->m_pjifeiRecordset->PutCollect("feedirectionkind",_variant_t(strTemp));
strTemp.Format("%d",m_uintfeeliststarttime);
pApp->m_pjifeiRecordset->PutCollect("feestarttime",_variant_t(strTemp));
strTemp.Format("%d",m_flofeeliststartfee);
pApp->m_pjifeiRecordset->PutCollect("feestartfee",_variant_t(strTemp));
strTemp.Format("%d",m_uintfeeliststeptime);
pApp->m_pjifeiRecordset->PutCollect("feesteptime",_variant_t(strTemp));
strTemp.Format("%d",m_flofeeliststepfee);
pApp->m_pjifeiRecordset->PutCollect("feestepfee",_variant_t(strTemp));
strTemp.Format("%d",m_flofeelistaddfee);
pApp->m_pjifeiRecordset->PutCollect("feeaddfee",_variant_t(strTemp));
pApp->m_pjifeiRecordset->Update();
AfxMessageBox("Modified successfully");
}
else
{
AfxMessageBox("The record to modify does not exist");
}
pApp->m_pjifeiRecordset->Close();
CDialog::OnOK();
}
void CfeedirectionListDlg::OnFeedirectionlistDelete()
{
// TODO: Add your control notification handler code here
HRESULT result;
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CString strSql,strTemp;
CString olddirection,olddirectionkind;
UINT oldstarttime,oldsteptime;
UINT oldstartfee,oldendfee;
olddirection=m_strfeelistdirection;
olddirectionkind=m_strfeelistdirectionkind;
oldstarttime=m_uintfeeliststarttime;
oldstartfee=m_flofeeliststartfee;
oldsteptime=m_uintfeeliststeptime;
oldendfee=m_flofeeliststepfee;
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
strSql.Format("select * from feedirection where feedirection='%s'",\
olddirection);
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)
{
}
else
{
pApp->m_pjifeiRecordset->Close();
AfxMessageBox("The record does not exist");
return;
}
pApp->m_pjifeiRecordset->Close();
strSql.Format("delete * from feedirection where feedirection='%s'",\
olddirection);
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open telephone table");
}
AfxMessageBox("Deleted successfully");
CDialog::OnOK();
}
void CfeedirectionListDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -