📄 feetimechangeadddlg.cpp
字号:
// feetimechangeaddDlg.cpp : implementation file
//
#include "stdafx.h"
#include "fee.h"
#include "feetimechangeaddDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CfeetimechangeaddDlg dialog
CfeetimechangeaddDlg::CfeetimechangeaddDlg(CWnd* pParent /*=NULL*/)
: CDialog(CfeetimechangeaddDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CfeetimechangeaddDlg)
m_bincity = FALSE;
m_bincountry = FALSE;
m_binlong = FALSE;
m_boutcity = FALSE;
m_boutcountry = FALSE;
m_boutlong = FALSE;
m_bspec = FALSE;
m_strstartyear = _T("");
m_strendday = _T("");
m_strendmonth = _T("");
m_strendyear = _T("");
m_strstartday = _T("");
m_strstartmonth = _T("");
m_uintdecper = 0;
m_strdayhourend = _T("");
m_strdayminuteend = _T("");
m_strdayminutestart = _T("");
m_strdaysecondend = _T("");
m_strdaysecondstart = _T("");
m_strdayhourstart = _T("");
//}}AFX_DATA_INIT
}
void CfeetimechangeaddDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CfeetimechangeaddDlg)
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_INCITY, m_bincity);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_INCOUNTRY, m_bincountry);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_INLONG, m_binlong);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_OUTCITY, m_boutcity);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_OUTCOUNTRY, m_boutcountry);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_OUTLONG, m_boutlong);
DDX_Check(pDX, IDC_CHECK_FEETIMECHANGE_SPEC, m_bspec);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHAGE_STARTYEAR, m_strstartyear);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_ENDDAY, m_strendday);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_ENDMONTH, m_strendmonth);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_ENDYEAR, m_strendyear);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_STARTDAY, m_strstartday);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_STARTMONTH, m_strstartmonth);
DDX_Text(pDX, IDC_EDIT1_FEETIMECHANGE_DECPERCENT, m_uintdecper);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYHOUREND, m_strdayhourend);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYMINUTEEND, m_strdayminuteend);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYMINUTESTART, m_strdayminutestart);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYSECONDEND, m_strdaysecondend);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYSECONDSTART, m_strdaysecondstart);
DDX_CBString(pDX, IDC_COMBO_FEETIMECHANGE_DAYHOURSTART, m_strdayhourstart);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CfeetimechangeaddDlg, CDialog)
//{{AFX_MSG_MAP(CfeetimechangeaddDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CfeetimechangeaddDlg message handlers
/*
enum { IDD = IDD_DIALOG_FEETIMECHANGE_ADD };
BOOL m_bincity;
BOOL m_bincountry;
BOOL m_binlong;
BOOL m_boutcity;
BOOL m_boutcountry;
BOOL m_boutlong;
BOOL m_bspec;
CString m_strstartyear;
CString m_strendday;
CString m_strendmonth;
CString m_strendyear;
CString m_strstartday;
CString m_strstartmonth;
int m_uintdecper;
CString m_strdayhourend;
CString m_strdayminuteend;
CString m_strdayminutestart;
CString m_strdaysecondend;
CString m_strdaysecondstart;
CString m_strdayhourstart;
*/
void CfeetimechangeaddDlg::OnOK()
{
UpdateData(TRUE);
// TODO: Add extra validation here
if ((m_bincity!=TRUE)&&\
(m_bincountry!=TRUE)&&\
(m_binlong!=TRUE)&&\
(m_boutcity!=TRUE)&&\
(m_boutcountry!=TRUE)&&\
(m_boutlong!=TRUE)&&\
(m_bspec!=TRUE))
{
AfxMessageBox("The changed office direction property cannot be blank");
return;
}
if (m_uintdecper==0)
{
AfxMessageBox("The changed fee cannot be 0");
return;
}
if (m_uintdecper>100)
{
AfxMessageBox("The changed fee cannot be larger than 100");
return;
}
if ((m_strdaysecondstart=="")||(m_strdayminutestart=="")||(m_strdayhourstart=="")||\
(m_strstartday=="")||(m_strstartmonth=="")||(m_strstartyear=="")||\
(m_strdaysecondend=="")||(m_strdayminuteend=="")||(m_strdayhourend=="")||\
(m_strendday=="")||(m_strendmonth=="")||(m_strendyear==""))
{
AfxMessageBox("The changed time cannot be blank");
return;
}
HRESULT result;
CString strSql,strTemp,strstartdate,strstarttime,strenddate,strendtime;
strstartdate=m_strstartyear+"-"+m_strstartmonth+"-"+m_strstartday;
strenddate=m_strendyear+"-"+m_strendmonth+"-"+m_strendday;
strstarttime=m_strdayhourstart+":"+m_strdayminutestart+":"+m_strdaysecondstart;
strendtime=m_strdayhourend+":"+m_strdayminuteend+":"+m_strdaysecondend;
long lyear,lmonth,lday;
long flag;
lyear=atol(m_strstartyear);
lmonth=atol(m_strstartmonth);
lday=atol(m_strstartday);
if (lyear<2000)
flag=1;
if (lmonth<1||lmonth>12)
flag=1;
if (lday<1||lday>31)
flag=1;
if (lmonth==1||lmonth==3||lmonth==5||lmonth==7||lmonth==8||lmonth==10||lmonth==12)
{
if (lday>31)
{
flag=1;
}
}
if (lmonth==4||lmonth==6||lmonth==9||lmonth==11)
{
if (lday>30)
{
flag=1;
}
}
if(lmonth==2)
{
if ((lyear%4)==0)
{
if (lday>29)
{
flag=1;
}
}
else
{
if (lday>28)
{
flag=1;
}
}
}
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
flag=0;
lyear=atol(m_strendyear);
lmonth=atol(m_strendmonth);
lday=atol(m_strendday);
if (lyear<2000)
flag=1;
if (lmonth<1||lmonth>12)
flag=1;
if (lday<1||lday>31)
flag=1;
if (lmonth==1||lmonth==3||lmonth==5||lmonth==7||lmonth==8||lmonth==10||lmonth==12)
{
if (lday>31)
{
flag=1;
}
}
if (lmonth==4||lmonth==6||lmonth==9||lmonth==11)
{
if (lday>30)
{
flag=1;
}
}
if(lmonth==2)
{
if ((lyear%4)==0)
{
if (lday>29)
{
flag=1;
}
}
else
{
if (lday>28)
{
flag=1;
}
}
}
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
long lhour,lminute,lsecond;
flag=0;
lhour=atol(m_strdayhourstart);
lminute=atol(m_strdayminutestart);
lsecond=atol(m_strdaysecondstart);
if (lhour>=24)
{
flag=1;
}
if (lminute>=60)
{
flag=1;
}
if (lsecond>=60)
{
flag=1;
}
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
flag=0;
lhour=atol(m_strdayhourend);
lminute=atol(m_strdayminuteend);
lsecond=atol(m_strdaysecondend);
if (lhour>=24)
{
flag=1;
}
if (lminute>=60)
{
flag=1;
}
if (lsecond>=60)
{
flag=1;
}
if (flag==1)
{
AfxMessageBox("timeset error");
return;
}
CFeeApp* pApp=(CFeeApp *)AfxGetApp();
strSql.Format("select * from feetimechange");
result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
pApp->m_pjifeiConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open feetimechange table");
}
else
{
pApp->m_pjifeiRecordset->AddNew();
strTemp=strstartdate;
if (strTemp!="")
pApp->m_pjifeiRecordset->PutCollect("feetimechangestartdate",_variant_t(strTemp));
strTemp=strstarttime;
if (strTemp!="")
pApp->m_pjifeiRecordset->PutCollect("feedaychangestarttime",_variant_t(strTemp));
strTemp=strenddate;
if (strTemp!="")
pApp->m_pjifeiRecordset->PutCollect("feetimechangeenddate",_variant_t(strTemp));
strTemp=strendtime;
if (strTemp!="")
pApp->m_pjifeiRecordset->PutCollect("feedaychangeendtime",_variant_t(strTemp));
strTemp.Format("%d",m_uintdecper);
pApp->m_pjifeiRecordset->PutCollect("feetimechangedecper",_variant_t(strTemp));
long lkind;
lkind=0;
if (m_bincountry==TRUE)
lkind|=1;
if (m_bincity==TRUE)
lkind|=2;
if (m_boutcountry==TRUE)
lkind|=4;
if (m_boutcity==TRUE)
lkind|=8;
if (m_binlong==TRUE)
lkind|=0x10;
if (m_boutlong==TRUE)
lkind|=0x20;
if (m_bspec==TRUE)
lkind|=0x40;
strTemp.Format("%d",lkind);
pApp->m_pjifeiRecordset->PutCollect("feetimechangekind",_variant_t(strTemp));
pApp->m_pjifeiRecordset->Update();
}
pApp->m_pjifeiRecordset->Close();
CDialog::OnOK();
}
void CfeetimechangeaddDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -