📄 denglu.cpp
字号:
// denglu.cpp : implementation file
//
#include "stdafx.h"
#include "药品信息管理系统.h"
#include "denglu.h"
#include "login.h"
#include "药品信息管理系统Set.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// denglu dialog
denglu::denglu(CWnd* pParent /*=NULL*/)
: CDialog(denglu::IDD, pParent)
{
//{{AFX_DATA_INIT(denglu)
m_password = _T("");
m_user = _T("");
//}}AFX_DATA_INIT
}
void denglu::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(denglu)
DDX_Text(pDX, IDC_EDIT_PASSWORD, m_password);
DDX_Text(pDX, IDC_EDIT_NAME, m_user);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(denglu, CDialog)
//{{AFX_MSG_MAP(denglu)
ON_BN_CLICKED(IDquxiao, Onquxiao)
ON_EN_CHANGE(IDC_EDIT_NAME, OnChangeEditName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// denglu message handlers
void denglu::Onquxiao()
{
// TODO: Add your control notification handler code here
exit(0);
}
void denglu::OnChangeEditName()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void denglu::OnOK()
{
// TODO: Add extra validation here
denglu dlg; //定义登录类对象
Clogin *m_qSet=new Clogin;
UpdateData(); //数据更新
m_user.TrimLeft(); //清空用户左边左边空格
m_password.TrimLeft(); //清空密码左边左边空格
if(m_user.IsEmpty()) //判断用户是否为空
{
MessageBox("输入用户名无效!");
return;
}
else
{
if(m_qSet->IsOpen()) //
m_qSet->Close(); //判断记录集是否打开是则关闭
m_qSet->m_strFilter.Format("yonghuming='%s'",m_user); //设置过滤条件
m_qSet->Open(); //打开记录集
if(!m_qSet->IsEOF()) //如果记录集没有到文件尾登录成功
;
else
{
MessageBox("用户名输入错误!");
return;
}
}
if(m_password.IsEmpty()) //设置条件如果密码是空就执行下面代码
{
MessageBox("密码无效!");
}
else
{
if(m_qSet->IsOpen())
m_qSet->Close(); //如果记录集打开就关闭
m_qSet->m_strFilter.Format("mima='%s'",m_password); //设置查询条件
m_qSet->Open(); //打开记录集
if(!m_qSet->IsEOF())
{
CDialog::OnOK(); //如果在查找密码结束前在记录集中找到相匹配的记录就运行结束对话框
}
else
{
MessageBox("密码输入错误!");
return;
} //如果记录集找遍了没找到要找的内容就弹出提示“密码输入错误”
}
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -