⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgmtlistdlg.cpp

📁 VC6.0环境下编写的一个交换机计费程序。
💻 CPP
字号:
// mgmtlistDlg.cpp : implementation file
//

#include "stdafx.h"
#include "fee.h"
#include "mgmtlistDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CmgmtlistDlg dialog


CmgmtlistDlg::CmgmtlistDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CmgmtlistDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CmgmtlistDlg)
	m_strpower = _T("");
	m_strname = _T("");
	m_strpwd = _T("");
	//}}AFX_DATA_INIT
}


void CmgmtlistDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CmgmtlistDlg)
	DDX_CBString(pDX, IDC_COMBO_MGMTPOWER, m_strpower);
	DDX_Text(pDX, IDC_EDIT_MGMTNAME, m_strname);
	DDX_Text(pDX, IDC_EDIT_MGMTPWD, m_strpwd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CmgmtlistDlg, CDialog)
	//{{AFX_MSG_MAP(CmgmtlistDlg)
	ON_BN_CLICKED(ID_MGMT_MODIFY, OnMgmtModify)
	ON_BN_CLICKED(ID_MGMT_DELETE, OnMgmtDelete)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CmgmtlistDlg message handlers

void CmgmtlistDlg::OnMgmtModify() 
{
	HRESULT result;

	// TODO: Add your control notification handler code here
	CString strSql,strTemp;
	CString oldname,oldpwd,oldpower;

	oldname=m_strname;
	oldpwd=m_strpwd;
	oldpower=m_strpower;

	UpdateData(TRUE);
	unsigned flag;
	flag=0;
	if (m_strpower==""||m_strname==""||m_strpwd=="")
	{
	//	AfxMessageBox("条件不能为空");
		flag=1;
	}
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("select * from loginid where \
		UserName='%s' and UserPwd='%s'",oldname,oldpwd);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open loginid table");
	}
	if(!pApp->m_pjifeiRecordset->adoEOF)
	{
		strTemp=m_strname;
		pApp->m_pjifeiRecordset->PutCollect("UserName",_variant_t(strTemp));
		strTemp=m_strpwd;
		pApp->m_pjifeiRecordset->PutCollect("UserPwd",_variant_t(strTemp));
		if (m_strpower=="Advanced")
			m_strpower="2";
		else
			m_strpower="1";
		strTemp=m_strpower;
		pApp->m_pjifeiRecordset->PutCollect("UserPower",_variant_t(strTemp));
		pApp->m_pjifeiRecordset->Update();
	}
	pApp->m_pjifeiRecordset->Close();
	AfxMessageBox("Modified successfully");
	CDialog::OnCancel();
}

void CmgmtlistDlg::OnMgmtDelete() 
{
	// TODO: Add your control notification handler code here
	HRESULT result;

	// TODO: Add your control notification handler code here
	CString strSql,strTemp;
	CString oldname,oldpwd,oldpower;

	oldname=m_strname;
	oldpwd=m_strpwd;
	oldpower=m_strpower;

	unsigned flag;
	flag=0;
	if (m_strpower==""||m_strname==""||m_strpwd=="")
	{
	//	AfxMessageBox("条件不能为空");
		flag=1;
	}
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("delete * from loginid where \
		UserName='%s' and UserPwd='%s'",oldname,oldpwd);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open loginid table");
	}
	AfxMessageBox("Deleted successfully");
	CDialog::OnCancel();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -