UserManDlg.cpp
资源名称:SQLVC.rar [点击查看]
上传用户:biney012
上传日期:2022-05-09
资源大小:4592k
文件大小:3k
源码类别:
数据库系统
开发平台:
Visual C++
- // 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();
- }
- }