|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "LaiPuLaser.h"
|
|
|
|
|
#include "DlgAuthorityAccount.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "DlgAuthorityCreatAccount.h"
|
|
|
|
|
#include "DlgAuthorityPar.h"
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDlgAuthorityAccount, CDialogEx)
|
|
|
|
|
CDlgAuthorityAccount::CDlgAuthorityAccount(CWnd* pParent /*=NULL*/)
|
|
|
|
|
: CDialogEx(CDlgAuthorityAccount::IDD, pParent)
|
|
|
|
|
{
|
|
|
|
|
m_CurSelIdx = -1;//<2F><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CDlgAuthorityAccount::~CDlgAuthorityAccount()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::DoDataExchange(pDX);
|
|
|
|
|
DDX_Control(pDX, IDC_USER_LIST, m_UserList);
|
|
|
|
|
}
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgAuthorityAccount, CDialogEx)
|
|
|
|
|
|
|
|
|
|
ON_NOTIFY(NM_CLICK, IDC_USER_LIST, &CDlgAuthorityAccount::OnNMClickUserList)
|
|
|
|
|
ON_BN_CLICKED(IDC_DEL_SEL, &CDlgAuthorityAccount::OnBnClickedDelSel)
|
|
|
|
|
ON_BN_CLICKED(IDC_CREAT, &CDlgAuthorityAccount::OnBnClickedCreatAccount)
|
|
|
|
|
ON_BN_CLICKED(IDC_OPEN_AUTH_PAR_DLG, &CDlgAuthorityAccount::OnBnClickedOpenAuthorityDlg)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
//<2F>ػ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BOOL CDlgAuthorityAccount::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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CDlgAuthorityAccount::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::OnInitDialog();
|
|
|
|
|
IniUserList();
|
|
|
|
|
UpdateUserList();
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::IniUserList()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
|
|
|
|
|
m_UserList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int idx = 0;
|
|
|
|
|
m_UserList.InsertColumn(idx,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>",LVCFMT_CENTER,120,-1);
|
|
|
|
|
idx++;
|
|
|
|
|
m_UserList.InsertColumn(idx,"<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>",LVCFMT_CENTER,150,-1);
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::UpdateUserList()
|
|
|
|
|
{
|
|
|
|
|
m_UserList.DeleteAllItems();
|
|
|
|
|
gAuthorityMgr->InsertToList(m_UserList);
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡlist <20><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
|
|
|
|
int CDlgAuthorityAccount::GetCurListIdx(CListCtrl &list)
|
|
|
|
|
{
|
|
|
|
|
POSITION pos = list.GetFirstSelectedItemPosition();
|
|
|
|
|
if (pos == NULL)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while (pos)
|
|
|
|
|
{
|
|
|
|
|
int nItem = list.GetNextSelectedItem(pos);
|
|
|
|
|
return nItem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::OnNMClickUserList(NMHDR *pNMHDR, LRESULT *pResult)
|
|
|
|
|
{
|
|
|
|
|
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
|
|
|
|
|
*pResult = 0;
|
|
|
|
|
m_CurSelIdx=GetCurListIdx(m_UserList);
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::OnBnClickedDelSel()
|
|
|
|
|
{
|
|
|
|
|
gAuthorityMgr->DelUser(m_CurSelIdx);
|
|
|
|
|
UpdateUserList();
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::OnBnClickedCreatAccount()
|
|
|
|
|
{
|
|
|
|
|
CDlgAuthorityCreatAccount dlg;
|
|
|
|
|
dlg.DoModal();
|
|
|
|
|
UpdateUserList();
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityAccount::OnBnClickedOpenAuthorityDlg()
|
|
|
|
|
{
|
|
|
|
|
if(!gAuthorityMgr->CheckAuthorityByName("AUTHORITY_AuthorityEdit",true))
|
|
|
|
|
return;
|
|
|
|
|
CDlgAuthorityPar dlg;
|
|
|
|
|
dlg.DoModal();
|
|
|
|
|
}
|