📄 addexpert.cpp
字号:
// AddExpert.cpp : implementation file
//
#include "stdafx.h"
#include "LiveController.h"
#include "AddExpert.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddExpert dialog
CAddExpert::CAddExpert(CWnd* pParent /*=NULL*/)
: CDialog(CAddExpert::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddExpert)
m_ExpertID = _T("");
m_ExpertName = _T("");
m_ExpertPW = _T("");
m_ExpertRank = _T("1");
m_ExpertPW2 = _T("");
//}}AFX_DATA_INIT
m_nPrivilege = 0;
}
void CAddExpert::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddExpert)
DDX_Control(pDX, IDC_Expert_PRIVILEGE, m_ctrPrivilege);
DDX_Text(pDX, IDC_Expert_ID, m_ExpertID);
DDV_MaxChars(pDX, m_ExpertID, 12);
DDX_Text(pDX, IDC_Expert_NAME, m_ExpertName);
DDV_MaxChars(pDX, m_ExpertName, 16);
DDX_Text(pDX, IDC_Expert_PW, m_ExpertPW);
DDV_MaxChars(pDX, m_ExpertPW, 10);
DDX_Text(pDX, IDC_Expert_LEVEL, m_ExpertRank);
DDX_Text(pDX, IDC_Expert_PW2, m_ExpertPW2);
DDV_MaxChars(pDX, m_ExpertPW2, 10);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddExpert, CDialog)
//{{AFX_MSG_MAP(CAddExpert)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddExpert message handlers
void CAddExpert::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if (m_ExpertID.IsEmpty())
{
MessageBox( "ID号不能为空,请重新填写", "提示" );
GetDlgItem(IDC_Expert_ID)->SetFocus();
return;
}
else if (m_ExpertName.IsEmpty())
{
MessageBox( "姓名不能为空,请重新填写", "提示" );
GetDlgItem(IDC_Expert_NAME)->SetFocus();
return;
}
else if (m_ExpertPW.IsEmpty())
{
MessageBox( "密码不能为空,请重新填写", "提示" );
GetDlgItem(IDC_Expert_PW)->SetFocus();
return;
}
else if (m_ExpertPW != m_ExpertPW2)
{
MessageBox( "两次输入的密码不相同,请重新填写", "提示" );
GetDlgItem(IDC_Expert_PW)->SetFocus();
return;
}
int nIndex = m_ctrPrivilege.GetCurSel();
if ( nIndex == 0 ) {
m_nPrivilege = USER_AUTH_SCHE_RELATED;
}
else
if ( nIndex == 1 ) {
m_nPrivilege = USER_AUTH_ADMIN;
}
else {
m_nPrivilege = USER_AUTH_DENY;
}
if ( m_ExpertRank.IsEmpty() ) {
m_ExpertRank = "1";
}
CDialog::OnOK();
}
BOOL CAddExpert::OnInitDialog()
{
CDialog::OnInitDialog();
m_ctrPrivilege.AddString( "普通权限" );
m_ctrPrivilege.AddString( "超级权限" );
m_ctrPrivilege.AddString( "禁止权限" );
m_ctrPrivilege.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -