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

📄 jkmanage.cpp

📁 短信发送工具
💻 CPP
字号:
// JKMANAGE.cpp : implementation file
//

#include "stdafx.h"
#include "SMS.h"
#include "JKMANAGE.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJKMANAGE dialog


CJKMANAGE::CJKMANAGE(CWnd* pParent /*=NULL*/)
	: CDialog(CJKMANAGE::IDD, pParent)
{
	//{{AFX_DATA_INIT(CJKMANAGE)
	m_duanhao = _T("");
	m_changhao = _T("");
	m_name = _T("");
	m_popedmon = _T("");
	//}}AFX_DATA_INIT
}


void CJKMANAGE::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJKMANAGE)
	DDX_Control(pDX, IDC_LIST1, m_clist);
	DDX_Text(pDX, IDC_EDIT1, m_duanhao);
	DDX_Text(pDX, IDC_EDIT2, m_changhao);
	DDX_Text(pDX, IDC_EDIT3, m_name);
	DDX_CBString(pDX, IDC_COMBO1, m_popedmon);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CJKMANAGE, CDialog)
	//{{AFX_MSG_MAP(CJKMANAGE)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJKMANAGE message handlers

void CJKMANAGE::OnButton1() 
{
		UpdateData(true);
	    m_duanhao.TrimRight(" ");
		m_changhao.TrimRight(" ");
		m_name.TrimRight(" ");

    	if ( ""==m_duanhao)
	{
		AfxMessageBox(_T("请输入短号"), MB_ICONEXCLAMATION);
        return;
	}
    	
		if ( ""==m_changhao)
	{
		AfxMessageBox(_T("请输入长号"), MB_ICONEXCLAMATION);
        return;
	}
    

			if ( ""==m_name)
	{
		AfxMessageBox(_T("请输入姓名"), MB_ICONEXCLAMATION);
        return;
	}
				if ( ""==m_popedmon)
	{
		AfxMessageBox(_T("请选择用户权限"), MB_ICONEXCLAMATION);
        return;
	}


	_variant_t strQuery;


strQuery="insert user_info values('" +m_duanhao+"','"+m_name+"','"+m_changhao+"','"+m_popedmon+"')";
if ( theApp.ADOExecute(theApp.m_pADOSet, strQuery) ) 
{	
			AfxMessageBox(_T("添加记录成功!"), MB_ICONINFORMATION);
}



	else 
	{
		 AfxMessageBox(_T("添加记录失败!"), MB_ICONEXCLAMATION);
	}
	// TODO: Add your control notification handler code here
	
	
	
	
	// TODO: Add your control notification handler code here
	
}

void CJKMANAGE::OnButton2() 
{
	 CString value;
	
     	value = m_clist.GetItemText(IndexInFieldList, 0);
	

		_variant_t strQuery;
		
	{strQuery="delete from user_info where duanhao='"+value+"'";
	theApp.ADOExecute(theApp.m_pADOSet, strQuery);
    AfxMessageBox("删除用户成功", MB_ICONEXCLAMATION);
	}
	// TODO: Add your control notification handler code here
	
}

BOOL CJKMANAGE::OnInitDialog()
{	CDialog::OnInitDialog();
 

 int nColumnCount = m_clist.GetHeaderCtrl()->GetItemCount();
		m_clist.SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT );
	for (int i=0;i < nColumnCount;i++)
	{
		m_clist.DeleteColumn(0);
	}
	
	m_clist.DeleteAllItems();
	
	char *title[] = 
	{
		"短号",
		"姓名",
		"长号",
		 "用户权限"
	
	};

	int nWidth[4] = { 80, 120, 150,150};

	for(i = 0; i < 4; i++ )
	{
		m_clist.InsertColumn( i, title[i], LVCFMT_LEFT, nWidth[i], 0 );
	}
	
    CString strText;
    _variant_t Holder, strQuery;
    strQuery = "select * from user_Info ";
	theApp.ADOExecute(theApp.m_pADOSet, strQuery);
	int iCount = theApp.m_pADOSet->GetRecordCount();
	theApp.m_pADOSet->MoveFirst();
    for (i=0;i<iCount;i++)
	{Holder=theApp.m_pADOSet->GetCollect("duanhao");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.InsertItem( i, strText );
    Holder=theApp.m_pADOSet->GetCollect("name");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i, 1, strText );
	Holder=theApp.m_pADOSet->GetCollect("changhao");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i, 2, strText );
	Holder=theApp.m_pADOSet->GetCollect("popedom");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i,3, strText );
    theApp.m_pADOSet->MoveNext();
	}
	return true;
}

void CJKMANAGE::OnButton3() 
{
	 int nColumnCount = m_clist.GetHeaderCtrl()->GetItemCount();

	for (int i=0;i < nColumnCount;i++)
	{
		m_clist.DeleteColumn(0);
	}
	
	m_clist.DeleteAllItems();
	
	char *title[] = 
	{
		"短号",
		"姓名",
		"长号",
	    "用户权限"
	};

	int nWidth[4] = { 80, 120, 150,150};

	for(i = 0; i < 4; i++ )
	{
		m_clist.InsertColumn( i, title[i], LVCFMT_LEFT, nWidth[i], 0 );
	}
    CString strText;
    _variant_t Holder, strQuery;
    strQuery = "select * from user_Info ";
	theApp.ADOExecute(theApp.m_pADOSet, strQuery);
	int iCount = theApp.m_pADOSet->GetRecordCount();
	theApp.m_pADOSet->MoveFirst();
    for ( i=0;i<iCount;i++)
	{Holder=theApp.m_pADOSet->GetCollect("duanhao");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.InsertItem( i, strText );
    Holder=theApp.m_pADOSet->GetCollect("name");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i, 1, strText );
	Holder=theApp.m_pADOSet->GetCollect("changhao");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i, 2, strText );
	Holder=theApp.m_pADOSet->GetCollect("popedom");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	m_clist.SetItemText( i,3, strText );
    theApp.m_pADOSet->MoveNext();
	}
	
	// TODO: Add your control notification handler code here
	
}

void CJKMANAGE::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	
		POSITION pos;
	pos = m_clist.GetFirstSelectedItemPosition();
	IndexInFieldList = m_clist.GetNextSelectedItem(pos);
	// TODO: Add your control notification handler code here
	
	*pResult = 0;
}

⌨️ 快捷键说明

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