📄 loaddialog.cpp
字号:
// LoadDialog.cpp : implementation file
//
#include "stdafx.h"
#include "银行系统.h"
#include "LoadDialog.h"
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// LoadDialog dialog
LoadDialog::LoadDialog(CWnd* pParent /*=NULL*/)
: CDialog(LoadDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(LoadDialog)
m_account = 0;
m_password = 0;
m_name = _T("");
m_base = 0.0;
m_waiter = _T("");
m_outdate = _T("");
m_type = -1;
//}}AFX_DATA_INIT
time_t temp = time(NULL);
m_outdate = ctime(&temp);
}
void LoadDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LoadDialog)
DDX_Text(pDX, IDC_EDIT1, m_account);
DDX_Text(pDX, IDC_EDIT2, m_password);
DDV_MinMaxLong(pDX, m_password, 1000000, 9999999);
DDX_Text(pDX, IDC_EDIT3, m_name);
DDX_Text(pDX, IDC_EDIT8, m_base);
DDX_CBString(pDX, IDC_COMBO1, m_waiter);
DDX_Text(pDX, IDC_EDIT6, m_outdate);
DDX_Radio(pDX, IDC_RADIO1, m_type);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(LoadDialog, CDialog)
//{{AFX_MSG_MAP(LoadDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LoadDialog message handlers
void LoadDialog::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
if(m_account < 1000||m_account > 9999)
{
MessageBox("账号错误","错误");
return;
}
if(m_base <= 0||m_base > 9999999)
{
MessageBox("本金错误","错误");
return;
}
if(m_name == _T(""))
{
MessageBox("请输入姓名","错误");
return;
}
if(m_password < 1000000||m_password > 9999999)
{
MessageBox("请输入7位密码","错误");
return;
}
if(m_type == -1)
{
MessageBox("请选择储种","错误");
return;
}
if(m_waiter == _T(""))
{
MessageBox("请选择营业员","错误");
return;
}
double m_interest;
int i = MyDoc->manage.DoLoad(m_account,m_name,m_type,m_password,m_base,m_interest,time(NULL),m_waiter);
if(i == 0)
{
MessageBox("此客户不存在!!!","错误");
return;
}
if(i == 1)
{
MessageBox("密码错误!!!","错误");
return;
}
if(i == 2)
{
MessageBox("此帐户已挂失!!!","错误");
return;
}
if(i == 3)
{
MessageBox("此帐户未到期!!!","警告");
}
if(i == 5)
{
MessageBox("与原储金不符,无法取款!!!","错误");
return;
}
//将账号转变为字符串
char *account = new char[6];
account = ltoa(m_account,account,10);
//将本金转变为字符串
double base = m_base;
long bz = (long)floor(base);
long bs = (long)((base-bz)*100);
char *cbz = new char[10];
cbz = ltoa(bz,cbz,10);
CString zbz(cbz);
char *cbs = new char[10];
cbs = ltoa(bs,cbs,10);
CString sbs(cbs);
//将总金额转变为字符串。
double total = m_interest + m_base;
long tz = (long)floor(total);
long ts = (long)((total-tz)*100);
char *ctz = new char[10];
ctz = ltoa(tz,ctz,10);
CString ztz(ctz);
char *cts = new char[10];
cts = ltoa(ts,cts,10);
CString sts(cts);
//将利息转变位字符串
double interest = m_interest;
long iz = (long)floor(interest);
long is = (long)((interest-iz)*100);
char *ciz = new char[10];
ciz = ltoa(iz,ciz,10);
CString ziz(ciz);
char *cis = new char[10];
cis = ltoa(is,cis,10);
CString sis(cis);
//
int ntype = 0;
switch(m_type)
{
case 0:ntype = 1;break;
case 1:ntype = 3;break;
case 2:ntype = 5;break;
}
char *type = new char[2];
type = ltoa(ntype,type,10);
MyView->loadinfo[0] = CString("帐号:") + CString(account);
MyView->loadinfo[1] = CString("姓名:")+ CString(m_name);
MyView->loadinfo[2] = CString("储种:") + CString(type) + CString("年期");
MyView->loadinfo[3] = CString("本金:") + zbz + CString('.') + sbs + CString("元");
time_t a = time(NULL);
MyView->loadinfo[0] = CString("支取日期:") + CString(ctime(&a));
MyView->loadinfo[4] = CString("利息:") + ziz +CString('.') + sis + CString("元");
MyView->loadinfo[5] = CString("支取金额") + ztz + CString('.') + sts + CString("元");
MyView->isload = TRUE;
MyView->Invalidate();
}
void LoadDialog::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -