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

📄 pageamendaccount.cpp

📁 短信群发系统
💻 CPP
字号:
// PageAmendAccount.cpp : implementation file
//

#include "stdafx.h"
#include "notesendsystem.h"
#include "PageAmendAccount.h"
#include "AdoRecordSet.h"
#include "AccountManager.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPageAmendAccount dialog


CPageAmendAccount::CPageAmendAccount(CWnd* pParent /*=NULL*/)
	: CDialog(CPageAmendAccount::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPageAmendAccount)
	m_user = _T("");
	//}}AFX_DATA_INIT
}


void CPageAmendAccount::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageAmendAccount)
	DDX_Control(pDX, IDC_COMBO, m_combo);
	DDX_Text(pDX, IDC_USER, m_user);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageAmendAccount, CDialog)
	//{{AFX_MSG_MAP(CPageAmendAccount)
	ON_BN_CLICKED(IDC_AMEND, OnAmend)
	ON_BN_CLICKED(IDC_DEL, OnDel)
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_AMENDACCOUNT, updateUsername)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageAmendAccount message handlers

//修改用户
void CPageAmendAccount::OnAmend() 
{
	UpdateData();
	if (m_user.GetLength() == 0)
	{
		MessageBox("请先选择一个用户", "提示");
		return;
	}
	int					acc_type;
	CNoteSendSystemApp *pApp = (CNoteSendSystemApp *)AfxGetApp();
	if (m_acc_type == 0)
	{
		MessageBox("权限不足,不能修改", "提示");
		UpdateData(FALSE);
		return;
	}
	if (m_combo.GetCurSel() == 0)
	{
		acc_type = 0;
	}
	else
	{
		acc_type = 1;
	}
	//把修改后的数据保存到数据库	
	pApp->m_pConnection.AmendAccType(m_user, acc_type);
	CAccountManager	*acc_man = (CAccountManager	*)GetParent()->GetParent();
	acc_man->UpdateListView();
}
//删除用户
void CPageAmendAccount::OnDel() 
{
	UpdateData();
	if (m_user.GetLength() == 0)
	{
		MessageBox("请先选择一个用户", "提示");
		return;
	}
	CNoteSendSystemApp *pApp = (CNoteSendSystemApp *)AfxGetApp();
	if (m_acc_type == 0)
	{
		MessageBox("权限不足,不能删除", "提示");
		UpdateData(FALSE);
		return;
	}
	if (pApp->CulUser == m_user)
	{
		MessageBox("你不能删除你自己","提示");
		//UpdateData(FALSE);
		return;
	}
	//执行删除操作	
	if (!pApp->m_pConnection.DelAccount(m_user))
	{
		MessageBox("删除失败","提示");
	}
	CAccountManager	*acc_man = (CAccountManager	*)GetParent()->GetParent();
	acc_man->UpdateListView();
	UpdateData(FALSE);
}

BOOL CPageAmendAccount::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_combo.SetCurSel(0);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

UINT CPageAmendAccount::updateUsername(WPARAM w, LPARAM l)
{
	CString *pStr = (CString *)w;	
	m_user = *pStr;
	m_acc_type = l;
	if (m_acc_type == 0)
	{
		m_combo.SetCurSel(0);
	}
	else
	{
		m_combo.SetCurSel(1);
	}

	UpdateData(FALSE);
	return 1;
}

⌨️ 快捷键说明

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