📄 changid.cpp
字号:
// ChangId.cpp : implementation file
// 换收银员
#include "stdafx.h"
#include "PosClient.h"
#include "ChangId.h"
#include "MD5C.h"
extern CUsers curUser;
extern CString uid;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChangId dialog
CChangId::CChangId(CWnd* pParent /*=NULL*/)
: CDialog(CChangId::IDD, pParent)
{
//{{AFX_DATA_INIT(CChangId)
m_id = _T("");
m_psw = _T("");
//}}AFX_DATA_INIT
}
void CChangId::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChangId)
DDX_Text(pDX, IDC_EDIT1, m_id);
DDX_Text(pDX, IDC_EDIT2, m_psw);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChangId, CDialog)
//{{AFX_MSG_MAP(CChangId)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChangId message handlers
void CChangId::OnOK()
{
UpdateData(TRUE);
//检查数据有效性
if (m_id == "")
{
MessageBox("请输入用户ID");
return;
}
if (m_psw == "")
{
MessageBox("请输入密码");
return;
}
//定义CUsers对象,用于从表Users中读取数据
curUser.GetData(m_id);
//如果读取的数据与用户输入数据不同,则返回
CString strPwd=m_psw;
strPwd = MD5Binary((const unsigned char *)(LPCSTR)strPwd, strPwd.GetLength());
if (curUser.GetUserPwd() != strPwd)
{
MessageBox("用户信息不正确,无法更改收银员!");
return;
}
uid.Format(curUser.GetUserId());
//关闭对话框
CDialog::OnOK();
MessageBox("更改收银员成功!当前收银员ID为:"+uid,"提醒");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -