|
|
|
|
// DlgCreatAccount.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "LaiPuLaser.h"
|
|
|
|
|
#include "DlgCreatAccount.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
// CDlgCreatAccount <20>Ի<EFBFBD><D4BB><EFBFBD>
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDlgCreatAccount, CDialogEx)
|
|
|
|
|
|
|
|
|
|
CDlgCreatAccount::CDlgCreatAccount(CWnd* pParent /*=NULL*/)
|
|
|
|
|
: CDialogEx(CDlgCreatAccount::IDD, pParent)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDlgCreatAccount::~CDlgCreatAccount()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDlgCreatAccount::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::DoDataExchange(pDX);
|
|
|
|
|
DDX_Text(pDX, IDC_NAME, m_Name);
|
|
|
|
|
DDX_Text(pDX, IDC_PASSWORD, m_PassWord1);
|
|
|
|
|
DDX_Text(pDX, IDC_PASSWORD2, m_PassWord2);
|
|
|
|
|
DDX_Control(pDX, IDC_AUTHORITY_COMB, m_AuthorityComb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgCreatAccount, CDialogEx)
|
|
|
|
|
ON_BN_CLICKED(IDOK, &CDlgCreatAccount::OnBnClickedOk)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDlgCreatAccount <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BOOL CDlgCreatAccount::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
IniAuthorityComb();
|
|
|
|
|
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
void CDlgCreatAccount::IniAuthorityComb()
|
|
|
|
|
{
|
|
|
|
|
AUTHORITY_TYPE CurAuthority = gAuthorityMgr->GetCurAuthority();
|
|
|
|
|
|
|
|
|
|
if(CurAuthority== _NO_LOGIN || CurAuthority== _USER)
|
|
|
|
|
return;
|
|
|
|
|
int idx = 0;
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_USER));
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_ADMIN));
|
|
|
|
|
if(CurAuthority== _FACTORY)
|
|
|
|
|
{
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_FACTORY));
|
|
|
|
|
}
|
|
|
|
|
m_AuthorityComb.SetCurSel(_USER);
|
|
|
|
|
}
|
|
|
|
|
void CDlgCreatAccount::OnBnClickedOk()
|
|
|
|
|
{
|
|
|
|
|
AUTHORITY_TYPE CurAuthority = gAuthorityMgr->GetCurAuthority();
|
|
|
|
|
if(CurAuthority== _USER)
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD><EFBFBD>ǰȨ<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
if(m_Name=="")
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(m_PassWord1=="")
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(m_PassWord1 != m_PassWord2)
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻һ<EFBFBD><EFBFBD>!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CAccount Account;
|
|
|
|
|
Account.m_Name = m_Name;
|
|
|
|
|
Account.m_PassWord = m_PassWord1;
|
|
|
|
|
Account.m_Authority = (AUTHORITY_TYPE)(m_AuthorityComb.GetCurSel()+1);//Ȩ<><C8A8>
|
|
|
|
|
gAuthorityMgr->AddAccount(Account);
|
|
|
|
|
CDialogEx::OnOK();
|
|
|
|
|
}
|