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

📄 telephoneadddlg.cpp

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

#include "stdafx.h"
#include "fee.h"
#include "telephoneAddDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CtelephoneAddDlg dialog


CtelephoneAddDlg::CtelephoneAddDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CtelephoneAddDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CtelephoneAddDlg)
	m_straddteleaddress = _T("");
	m_straddtelebank = _T("");
	m_straddtelebankaccount = _T("");
	m_straddtelekind = _T("");
	m_straddtelename = _T("");
	m_straddtelenum = _T("");
	m_straddtelestatus = _T("");
	//}}AFX_DATA_INIT
}


void CtelephoneAddDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CtelephoneAddDlg)
	DDX_Text(pDX, IDC_EDIT_TELEADD_ADDRESS, m_straddteleaddress);
	DDX_Text(pDX, IDC_EDIT_TELEADD_BANK, m_straddtelebank);
	DDX_Text(pDX, IDC_EDIT_TELEADD_BANKACCOUNT, m_straddtelebankaccount);
	DDX_Text(pDX, IDC_EDIT_TELEADD_KIND, m_straddtelekind);
	DDX_Text(pDX, IDC_EDIT_TELEADD_NAME, m_straddtelename);
	DDX_Text(pDX, IDC_EDIT_TELEADD_NUM, m_straddtelenum);
	DDX_Text(pDX, IDC_EDIT_TELEADD_STATUS, m_straddtelestatus);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CtelephoneAddDlg, CDialog)
	//{{AFX_MSG_MAP(CtelephoneAddDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CtelephoneAddDlg message handlers

void CtelephoneAddDlg::OnOK() 
{
	// TODO: Add extra validation here
	unsigned int flag;
	flag=0;

	UpdateData(TRUE);
	if (m_straddtelenum=="")
	{
		AfxMessageBox("The phone number cannot be blank");
		flag=1;
	}
	if (flag==0)
	{
		HRESULT result;

		CString strSql,strTemp;
		CFeeApp* pApp=(CFeeApp *)AfxGetApp();
		strSql.Format("select * from telephone where telephoneCode='%s'",m_straddtelenum);
		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)
		{
		//	flag=1;
		//	AfxMessageBox("This phone number has existed");
		}
		if (flag==0)
		{
			
			pApp->m_pjifeiRecordset->AddNew();
		}
		strTemp=m_straddtelename;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneName",_variant_t(strTemp));
		strTemp=m_straddteleaddress;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneAddress",_variant_t(strTemp));
		strTemp=m_straddtelenum;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneCode",_variant_t(strTemp));
		strTemp=m_straddtelekind;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneKind",_variant_t(strTemp));
		strTemp=m_straddtelestatus;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneStatus",_variant_t(strTemp));
		strTemp=m_straddtelebank;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneFeeBank",_variant_t(strTemp));
		strTemp=m_straddtelebankaccount;
		if (strTemp=="")
			strTemp="NULL";
		pApp->m_pjifeiRecordset->PutCollect("telephoneFeeAccount",_variant_t(strTemp));
		pApp->m_pjifeiRecordset->Update();
		pApp->m_pjifeiRecordset->Close();
	}
		
	// TODO: Add extra validation here
	//
	if (flag==0)
		CDialog::OnOK();
	else
		CDialog::OnCancel();
}

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

⌨️ 快捷键说明

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