📄 yhgldlg.cpp
字号:
// YHGLDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Library.h"
#include "YHGLDlg.h"
#include "DataBase.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CYHGLDlg dialog
CYHGLDlg::CYHGLDlg(CWnd* pParent /*=NULL*/)
: CDialog(CYHGLDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CYHGLDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CYHGLDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CYHGLDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CYHGLDlg, CDialog)
//{{AFX_MSG_MAP(CYHGLDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CYHGLDlg message handlers
void CYHGLDlg::OnOK()
{
int n=0;
CString bm;
CString name,pw1,pw2;
CWnd *pWnd1,*pWnd2,*pWnd3;
CButton *pRadio1=(CButton*)GetDlgItem(IDC_RADIO1);
CButton *pRadio2=(CButton*)GetDlgItem(IDC_RADIO2);
CButton *pRadio3=(CButton*)GetDlgItem(IDC_RADIO3);
if(pRadio1->GetCheck()==1)
{
n=1;
}
else
{
if(pRadio2->GetCheck()==1)
{
n=2;
}
else
{
if(pRadio3->GetCheck()==1)
{
n=3;
}
else
{
AfxMessageBox("请选择一项操作!");
}
}
}
//str.Format("%d",n);
//AfxMessageBox("RADIO值:"+str);
bm="SELECT * FROM admin";
CDataBase db(bm);
switch(n)
{
case 1:
//AfxMessageBox("你选择了添加用户!");
if(1==db.YHGL())
{
pWnd1=GetDlgItem(IDC_TJ_USERNAME);
pWnd1->GetWindowText(name);
pWnd2=GetDlgItem(IDC_TJ_PASSWORD1);
pWnd2->GetWindowText(pw1);
pWnd3=GetDlgItem(IDC_TJ_PASSWORD2);
pWnd3->GetWindowText(pw2);
if(name!="")
{
if(pw1!="")
{
if(pw2!="")
{
db.YHGL_TJ(name,pw1,pw2);
}
else
{
AfxMessageBox("请输入确认密码!");
}
}
else
{
AfxMessageBox("请输入密码!");
}
}
else
{
AfxMessageBox("用户名不能为空!");
}
}
else
{
AfxMessageBox("对不起,你不是超级管理员,不能使用用户管理功能!");
}
break;
case 2:
//AfxMessageBox("你选择了删除用户!");
pWnd1=GetDlgItem(IDC_SC_USERNAME);
pWnd1->GetWindowText(name);
if(1==db.YHGL())
{
if(1==db.YHGL_SC(name))
{
AfxMessageBox("删除用户成功!");
}
else
{
AfxMessageBox("删除用户失败!");
}
}
else
{
AfxMessageBox("对不起,你不是超级管理员,不能使用用户管理功能!");
}
break;
case 3:
AfxMessageBox("你选择了修改权限!");
break;
}
// CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -