LocalUserRenameDlg.cpp
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:2k
- // LocalUserRenameDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "trfAgent.h"
- #include "LocalUserRenameDlg.h"
- #include "variantex.h"
- // CLocalUserRenameDlg dialog
- CLocalUserRenameDlg::CLocalUserRenameDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CLocalUserRenameDlg::IDD, pParent)
- {
- this->m_nRenamedAgentId = 0;
- //{{AFX_DATA_INIT(CLocalUserRenameDlg)
- m_sNewUsrName = _T("");
- //}}AFX_DATA_INIT
- }
- void CLocalUserRenameDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CLocalUserRenameDlg)
- DDX_Text(pDX, IDC_EDTUSRNAME, m_sNewUsrName);
- DDV_MaxChars(pDX, m_sNewUsrName, 32);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CLocalUserRenameDlg, CDialog)
- //{{AFX_MSG_MAP(CLocalUserRenameDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- // CLocalUserRenameDlg message handlers
- BOOL CLocalUserRenameDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- this->CenterWindow();
- return TRUE;
- }
- void CLocalUserRenameDlg::OnOK()
- {
- CGuiRecordSet rs;
- CVariantEx varex;
- bool result;
- UpdateData(TRUE);
-
- //if variable is zero then using default value.
- if(this->m_nRenamedAgentId == 0)
- {
- this->m_nRenamedAgentId = theApp.m_oCSHelper.GetClientID();
- }
- if(this->m_sNewUsrName.IsEmpty())
- {
- MSGBOX_WARNING(_LoadString(IDS_USERNAMEEMPTY).GetBuffer(0));
- return ;
- }
- result = theApp.m_oCSHelper.AGRename(this->m_sNewUsrName.GetBuffer(0),
- this->m_nRenamedAgentId);
- if(result)
- {
- MSGBOX_INFO(_LoadString(IDS_DBAGRENAME_OK).GetBuffer(0));
- }
- else
- {
- MSGBOX_INFO(_LoadString(IDS_DBAGRENAME_FAILED).GetBuffer(0));
- }
- //
- CDialog::OnOK();
- }
- void CLocalUserRenameDlg::SetRenamedAgentId(const int nAgentId)
- {
- this->m_nRenamedAgentId = nAgentId;
- }