📄 water.cpp
字号:
// WATER.cpp : implementation file
//
#include "stdafx.h"
#include "atm.h"
#include "WATER.h"
#include "WaterUser.h"
#include "Ref.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////水费用户////////////////////////////////////////////////
// WATER dialog
WATER::WATER(CWnd* pParent /*=NULL*/)
: CDialog(WATER::IDD, pParent)
{
//{{AFX_DATA_INIT(WATER)
m_WATER = _T("");
//}}AFX_DATA_INIT
}
void WATER::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(WATER)
DDX_Control(pDX, IDC_EDIT1, m_WATEREDIT);
DDX_Text(pDX, IDC_EDIT1, m_WATER);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(WATER, CDialog)
//{{AFX_MSG_MAP(WATER)
ON_BN_CLICKED(IDCORRECT, OnCorrect)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// WATER message handlers
void WATER::OnCorrect()
{
// TODO: Add your control notification handler code here
m_WATEREDIT.SetWindowText("");
}
void WATER::OnOK()
{
// TODO: Add extra validation here
KillTimer(0);
CSuggest suggestdlg;
UpdateData(TRUE);
if(CurrentAcnt *pCyrntAcnt=CurrentAcnt::searchAccount(CEnterPaswd::m_password)) //搜寻检测用户密码
{
if(WaterUser* ptCPhoneU=WaterUser::searchwateruser(m_WATER)) //搜索检测电话用户
{
double remain=pCyrntAcnt->AcntBalan();
double pcost=ptCPhoneU->Getcost();
if(pcost>remain) //余额不足
{
suggestdlg.m_suggest="余额不足";
suggestdlg.DoModal();
}
else //交费成功
{
remain-=pcost;
pCyrntAcnt->reloadbalance(remain);
ptCPhoneU->reloadcost(0); //话费清零
CPrint2 print2dlg; //打印凭条
print2dlg.DoModal();
CDialog::OnOK();
Ref ref;
ref.Refresh(pCyrntAcnt->GetacntNo(),remain,pcost,"交水费");
}
}
else //查无此号
{
suggestdlg.m_suggest="查无此号";
suggestdlg.DoModal();
}
}
else
{
CPassworderror passerrordlg; //密码错误
passerrordlg.DoModal();
CEnterPaswd enterpaswdlg;
enterpaswdlg.m_password=""; //重输密码
enterpaswdlg.DoModal();
CDialog::OnOK();
}
m_WATER="";
UpdateData(FALSE);
}
void WATER::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
Beep(1000,500);
KillTimer(0);
CAlarm alarmdlg;
alarmdlg.DoModal();
CDialog::OnTimer(nIDEvent);
}
BOOL WATER::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
switch(pMsg->message)
{
case WM_KEYUP:SetTimer(0,15000,NULL);break;
case WM_KEYDOWN:KillTimer(0);break;
}
return CDialog::PreTranslateMessage(pMsg);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -