You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.0 KiB
C++

// DlgAuthorityMgr->cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
//
#include "stdafx.h"
#include "LaiPuLaser.h"
#include "DlgAuthorityMgr.h"
#include "afxdialogex.h"
#include "MsgBox.h"
#include "AuthorityMgr.h"
// CDlgAuthorityMgr <20>Ի<EFBFBD><D4BB><EFBFBD>
IMPLEMENT_DYNAMIC(CDlgAuthorityMgr, CDialogEx)
CDlgAuthorityMgr::CDlgAuthorityMgr(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgAuthorityMgr::IDD, pParent)
, m_CurUser(_T(""))
{
}
CDlgAuthorityMgr::~CDlgAuthorityMgr()
{
}
void CDlgAuthorityMgr::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_AUTHORITY, m_CurAuthority);
DDX_Text(pDX, IDC_NAME, m_Name);
DDX_Text(pDX, IDC_PASSWORD, m_PassWord);
DDX_Text(pDX, IDC_CUR_USER, m_CurUser);
DDX_Control(pDX, IDC_LOGIN, m_LoginBtn);
DDX_Control(pDX, IDC_LOCK_USER, m_LockBtn);
}
BEGIN_MESSAGE_MAP(CDlgAuthorityMgr, CDialogEx)
ON_BN_CLICKED(IDC_LOGIN, &CDlgAuthorityMgr::OnBnClickedLogin)
ON_BN_CLICKED(IDC_LOCK_USER, &CDlgAuthorityMgr::OnBnClickedLock)
END_MESSAGE_MAP()
//<2F>ػ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CDlgAuthorityMgr::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
if(c==VK_RETURN || c==VK_ESCAPE)
{
return TRUE;
}
}
return CDialogEx::PreTranslateMessage(pMsg);
}
// CDlgCreatAccount <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CDlgAuthorityMgr::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_LoginBtn.SetUpColor(RGB_GREEN);
//ˢ<>µ<EFBFBD>ǰȨ<C7B0><C8A8>
RefreashAuthority();
UpdateData(FALSE);
return TRUE;
}
//<2F><>¼
void CDlgAuthorityMgr::OnBnClickedLogin()
{
UpdateData(TRUE);
if(gAuthorityMgr->Login(m_Name,m_PassWord))
{
//ˢ<>µ<EFBFBD>ǰȨ<C7B0><C8A8>
RefreashAuthority();
OnOK();
}
}
//ˢ<>µ<EFBFBD>ǰȨ<C7B0><C8A8>
void CDlgAuthorityMgr::RefreashAuthority()
{
m_CurAuthority = gAuthorityMgr->GetAccountName(gAuthorityMgr->GetCurAuthority());
m_CurUser = gAuthorityMgr->GetCurUserName();
UpdateData(FALSE);
}
void CDlgAuthorityMgr::OnBnClickedLock()
{
gAuthorityMgr->Lock();
CMsgBox MsgBox;
MsgBox.Show("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Lock");
CDialogEx::OnCancel();
}