📄 usermandlg.cpp
字号:
// UserManDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HosptialMan.h"
#include "UserManDlg.h"
#include "UserEditDlg.h"
extern CUsers curUser;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserManDlg dialog
CUserManDlg::CUserManDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUserManDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserManDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CUserManDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserManDlg)
DDX_Control(pDX, IDC_ADODC1, m_adodc);
DDX_Control(pDX, IDC_DATALIST1, m_datalist);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserManDlg, CDialog)
//{{AFX_MSG_MAP(CUserManDlg)
ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton)
ON_BN_CLICKED(IDC_MODI_BUTTON, OnModiButton)
ON_BN_CLICKED(IDC_DEL_BUTTON, OnDelButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserManDlg message handlers
void CUserManDlg::OnAddButton()
{
CUserEditDlg dlg;
dlg.iUserType = 2;
if (dlg.DoModal() == IDOK)
m_adodc.Refresh();
}
void CUserManDlg::OnModiButton()
{
if (m_datalist.GetText() == "")
{
MessageBox("请选择用户");
return;
}
if (curUser.GetUserName() != "Admin" && curUser.GetUserName() != m_datalist.GetText()
&& m_datalist.GetBoundText() == "1")
{ //除Admin外,其他管理员只能修改普通用户信息
MessageBox("只能对普通用户进行密码复位");
return;
}
if (MessageBox("是否对当前用户进行密码复位","请确认", MB_YESNO) == IDYES)
{
CUsers usr;
usr.SetPwd("888888"); //设置默认密码
usr.sql_updatePwd(m_datalist.GetText());
MessageBox("密码已经复位");
}
}
void CUserManDlg::OnDelButton()
{
if (m_datalist.GetText() == "")
{
MessageBox("请选择用户");
return;
}
if (curUser.GetUserName() != "Admin" && m_datalist.GetBoundText() == "1")
{ //除Admin外,其他管理员只能删除普通用户
MessageBox("只能删除普通用户");
return;
}
if (m_datalist.GetText() == "Admin")
{
MessageBox("不能删除Admin用户");
return;
}
if (MessageBox("是否删除当前用户","请确认", MB_YESNO) == IDYES)
{
CUsers usr;
usr.sql_delete(m_datalist.GetText());
m_adodc.Refresh();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -