?? usermandlg.cpp
字號:
// UserManDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Stock.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_DATALIST1, m_datalist);
DDX_Control(pDX, IDC_ADODC1, m_adodc);
//}}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()
{
// TODO: Add your control notification handler code here
CUserEditDlg dlg;
dlg.iUserType = 2;
if (dlg.DoModal() == IDOK)
m_adodc.Refresh();
}
void CUserManDlg::OnModiButton()
{
// TODO: Add your control notification handler code here
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()
{
// TODO: Add your control notification handler code here
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 + -