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

📄 linelistdlg.cpp

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

#include "stdafx.h"
#include "fee.h"
#include "lineListDlg.h"

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


/////////////////////////////////////////////////////////////////////////////
// ClineListDlg dialog


ClineListDlg::ClineListDlg(CWnd* pParent /*=NULL*/)
	: CDialog(ClineListDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(ClineListDlg)
	m_strlinelistinlayoutcolumn = _T("");
	m_strlinelistinlayoutline = _T("");
	m_strlinelistlineroom = _T("");
	m_strlinelistlineroomkind = _T("");
	m_strlinelistoutlayoutcolumn = _T("");
	m_strlinelistoutlayoutline = _T("");
	m_strlinelistlinetelephone = _T("");
	//}}AFX_DATA_INIT
}


void ClineListDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ClineListDlg)
	DDX_CBString(pDX, IDC_COMBO_LINELIST_INLAYCOLUMN, m_strlinelistinlayoutcolumn);
	DDX_CBString(pDX, IDC_COMBO_LINELIST_INLAYLINE, m_strlinelistinlayoutline);
	DDX_CBString(pDX, IDC_COMBO_LINELIST_LINEROOM, m_strlinelistlineroom);
	DDX_CBString(pDX, IDC_COMBO_LINELIST_LINEROOMKIND, m_strlinelistlineroomkind);
	DDX_CBString(pDX, IDC_COMBO_LINELIST_OUTLAYCOLUMN, m_strlinelistoutlayoutcolumn);
	DDX_CBString(pDX, IDC_COMBO_LINELIST_OUTLAYLINE, m_strlinelistoutlayoutline);
	DDX_Text(pDX, IDC_EDIT_LINELIST_LINETELENUM, m_strlinelistlinetelephone);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ClineListDlg, CDialog)
	//{{AFX_MSG_MAP(ClineListDlg)
	ON_BN_CLICKED(ID_BOTTON_LINELIST_MODIFY, OnBottonLinelistModify)
	ON_BN_CLICKED(ID_BOTTON_LINELIST_DELETE, OnBottonLinelistDelete)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ClineListDlg message handlers

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

	// TODO: Add your control notification handler code here
	CString strSql,strTemp;
	CString oldlineroom,oldlineroomkind,oldlinetelenum;
	CString oldinlayline,oldinlaycolumn,oldoutlayline,oldoutlaycolumn;

	oldlineroom=m_strlinelistlineroom;
	oldlineroomkind=m_strlinelistlineroomkind;
	oldoutlayline=m_strlinelistoutlayoutline;
	oldoutlaycolumn=m_strlinelistoutlayoutcolumn;
	oldinlayline=m_strlinelistinlayoutline;
	oldinlaycolumn=m_strlinelistinlayoutcolumn;
	oldlinetelenum=m_strlinelistlinetelephone;

	UpdateData(TRUE);
	CFeeApp* pApp;
	pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("select * from LineManage where outlineLayoutLine='%s'\
		and outlineLayoutColumn='%s'and inlineLayoutLine='%s'\
		and inlineLayoutColumn='%s' and lineroom='%s'\
		and lineroomKind='%s' and linetelenum='%s'",\
		oldoutlayline,oldoutlaycolumn,oldinlayline,oldinlaycolumn,\
		oldlineroom,oldlineroomkind,oldlinetelenum);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open LineManage table");
	}
	if(!pApp->m_pjifeiRecordset->adoEOF)
	{
		strTemp=m_strlinelistoutlayoutline;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("outlineLayoutLine",_variant_t(strTemp));
		strTemp=m_strlinelistoutlayoutcolumn;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("outlineLayoutColumn",_variant_t(strTemp));
		strTemp=m_strlinelistinlayoutline;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("inlineLayoutLine",_variant_t(strTemp));
		strTemp=m_strlinelistinlayoutcolumn;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("inlineLayoutColumn",_variant_t(strTemp));
		strTemp=m_strlinelistlineroom;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("lineroom",_variant_t(strTemp));
		strTemp=m_strlinelistlineroomkind;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("lineroomKind",_variant_t(strTemp));
		strTemp=m_strlinelistlinetelephone;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("linetelenum",_variant_t(strTemp));
		pApp->m_pjifeiRecordset->Update();
	}
	pApp->m_pjifeiRecordset->Close();
	AfxMessageBox("Modified successfully");
	CDialog::OnOK();
}

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

	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CString strSql,strTemp;

	CString oldlineroom,oldlineroomkind,oldlinetelenum;
	CString oldinlayline,oldinlaycolumn,oldoutlayline,oldoutlaycolumn;

	oldlineroom=m_strlinelistlineroom;
	oldlineroomkind=m_strlinelistlineroomkind;
	oldoutlayline=m_strlinelistoutlayoutline;
	oldoutlaycolumn=m_strlinelistoutlayoutcolumn;
	oldinlayline=m_strlinelistinlayoutline;
	oldinlaycolumn=m_strlinelistinlayoutcolumn;
	oldlinetelenum=m_strlinelistlinetelephone;

	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	strSql.Format("select * from LineManage where outlineLayoutLine='%s'\
		and outlineLayoutColumn='%s'and inlineLayoutLine='%s'\
		and inlineLayoutColumn='%s' and lineroom='%s'\
		and lineroomKind='%s' and linetelenum='%s'",\
		oldoutlayline,oldoutlaycolumn,oldinlayline,oldinlaycolumn,\
		oldlineroom,oldlineroomkind,oldlinetelenum);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	if(!pApp->m_pjifeiRecordset->adoEOF)
	{
	}
	else
	{
		pApp->m_pjifeiRecordset->Close();
		AfxMessageBox("This record number does not exist");
		return;
	}
	pApp->m_pjifeiRecordset->Close();
	strSql.Format("delete * from LineManage where outlineLayoutLine='%s'\
		and outlineLayoutColumn='%s'and inlineLayoutLine='%s'\
		and inlineLayoutColumn='%s' and lineroom='%s'\
		and lineroomKind='%s' and linetelenum='%s'",\
		oldoutlayline,oldoutlaycolumn,oldinlayline,oldinlaycolumn,\
		oldlineroom,oldlineroomkind,oldlinetelenum);
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	AfxMessageBox("Deleted successfully");
	//tiaoshi
	CDialog::OnOK();
	
}

void ClineListDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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