|
|
|
|
// DlgCreatAccount.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "LaiPuLaser.h"
|
|
|
|
|
#include "DlgAuthorityCreatAccount.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
// CDlgAuthorityCreatAccount <20>Ի<EFBFBD><D4BB><EFBFBD>
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDlgAuthorityCreatAccount, CDialogEx)
|
|
|
|
|
|
|
|
|
|
CDlgAuthorityCreatAccount::CDlgAuthorityCreatAccount(CWnd* pParent /*=NULL*/)
|
|
|
|
|
: CDialogEx(CDlgAuthorityCreatAccount::IDD, pParent)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDlgAuthorityCreatAccount::~CDlgAuthorityCreatAccount()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDlgAuthorityCreatAccount::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(CDlgAuthorityCreatAccount, CDialogEx)
|
|
|
|
|
ON_BN_CLICKED(IDOK, &CDlgAuthorityCreatAccount::OnBnClickedOk)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDlgAuthorityCreatAccount <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BOOL CDlgAuthorityCreatAccount::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialogEx::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
IniAuthorityComb();
|
|
|
|
|
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>AuthorityComb
|
|
|
|
|
void CDlgAuthorityCreatAccount::IniAuthorityComb()
|
|
|
|
|
{
|
|
|
|
|
eAuthorityType CurAuthority = gAuthorityMgr->GetCurAuthority();
|
|
|
|
|
int idx = 0;
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_Authority_Operator));
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_Authority_OperatorAdmin));
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_Authority_Engineer));
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_Authority_Technics));
|
|
|
|
|
if(CurAuthority== _Authority_Factory)
|
|
|
|
|
{
|
|
|
|
|
m_AuthorityComb.InsertString(idx++,gAuthorityMgr->GetAccountName(_Authority_Factory));
|
|
|
|
|
}
|
|
|
|
|
m_AuthorityComb.SetCurSel(0);
|
|
|
|
|
}
|
|
|
|
|
void CDlgAuthorityCreatAccount::OnBnClickedOk()
|
|
|
|
|
{
|
|
|
|
|
eAuthorityType CurAuthority = gAuthorityMgr->GetCurAuthority();
|
|
|
|
|
if(!UpdateData(TRUE))
|
|
|
|
|
return;
|
|
|
|
|
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 = (eAuthorityType)(m_AuthorityComb.GetCurSel()+1);//Ȩ<><C8A8>
|
|
|
|
|
gAuthorityMgr->AddAccount(Account);
|
|
|
|
|
CDialogEx::OnOK();
|
|
|
|
|
}
|