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

📄 blackallrisingdlg.cpp

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

#include "stdafx.h"
#include "fee.h"
#include "blackAllRisingDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CblackAllRisingDlg dialog


CblackAllRisingDlg::CblackAllRisingDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CblackAllRisingDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CblackAllRisingDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CblackAllRisingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CblackAllRisingDlg)
	DDX_Control(pDX, IDC_PROGRESS1, m_progress);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CblackAllRisingDlg message handlers

BOOL CblackAllRisingDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_progress.SetRange(0,100);
	m_progress.SetPos(0);
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CblackAllRisingDlg::OnOK() 
{
	// TODO: Add extra validation here
	CString strspcCallingNum,strspcCalledNum;
	CString strspcTalkEndDate,strspcTalkEndTime;
	CString strspcTalkTime;
	CString strtime;
	CString strSql;
	unsigned long int i;
	unsigned long spcrecordcount,donerecordcount;
	unsigned char flag;
	unsigned int pos;
	HRESULT result;
	strSql.Format("select * from spcrecord");

	spcrecordcount=0;
	donerecordcount=0;
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	pApp->m_pspcRecordset->CursorLocation=adUseClientBatch;
	
	result=pApp->m_pspcRecordset->Open(strSql.AllocSysString(),
		pApp->m_pspcConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	/*	
	pApp->m_pspcRecordset->Open(_variant_t("spcrecord"),
	_variant_t((IDispatch *)pApp->m_pspcConnection,true), adOpenKeyset,
	adLockOptimistic, adCmdTable);
	*/
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open spcrecord table");
	}
	i=0;
	if (!pApp->m_pspcRecordset->adoEOF)
	{
		spcrecordcount=pApp->m_pspcRecordset->GetRecordCount();
	}
	if (spcrecordcount>0)
		pApp->m_pspcRecordset->MoveFirst();
	while(!pApp->m_pspcRecordset->adoEOF)
	{
		flag=0;
		_variant_t varport;
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcCallingNum"));
		if (varport.vt!=VT_NULL)
			strspcCallingNum =(char*)_bstr_t(varport);
		else 
			strspcCallingNum="null";
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcCalledNum"));
		if (varport.vt!=VT_NULL)
			strspcCalledNum =(char*)_bstr_t(varport);
		else 
			strspcCalledNum="null";
		/*
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartDate"));
		if (varport.vt!=VT_NULL)
			strspcTalkStartDate =(char*)_bstr_t(varport);
		else 
			strspcTalkStartDate="null";
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcStartTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkStartTime =(char*)_bstr_t(varport);
		else 
			strspcTalkStartTime="null";	
			*/
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndDate"));
		if (varport.vt!=VT_NULL)
			strspcTalkEndDate =(char*)_bstr_t(varport);
		else 
			strspcTalkEndDate="null";
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkEndTime =(char*)_bstr_t(varport);
		else 
			strspcTalkEndTime="null";	
		varport=pApp->m_pspcRecordset->GetCollect(_variant_t("spcTalkTime"));
		if (varport.vt!=VT_NULL)
			strspcTalkTime =(char*)_bstr_t(varport);
		else 
			strspcTalkTime="null";	
		//strspcCallingNum=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcCallingNum"));
		//strspcCalledNum=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcCalledNum"));
		//strspcTalkTime=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcTalkTime"));
		//strspcTalkEndDate=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndDate"));
		//strspcTalkEndTime=(char*)(_bstr_t)pApp->m_pspcRecordset->GetCollect(_variant_t("spcEndTime"));
		/*
		strSql.Format("select * from telephone where telephoneCode='%s'",strspcCallingNum);
		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
		{
			flag=1;
		}
		pApp->m_pjifeiRecordset->Close();
		*/
		if (flag==0)
		{
			long lentemp;
			TCHAR strcalleddir[50];
			lentemp=strlen(strspcCalledNum);
			long flag1;
			flag1=0;
			for(long n=0;n<lentemp;n++)
			{
				lstrcpyn(strcalleddir,strspcCalledNum,n+2);
				strSql.Format("select * from feedirection where feedirection='%s'",strcalleddir);
				result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
					pApp->m_pjifeiConnection.GetInterfacePtr(),
					adOpenDynamic,adLockOptimistic,adCmdText);
				if (!SUCCEEDED(result))
				{
					AfxMessageBox("can't open feedirection table");
				}
				if (!pApp->m_pjifeiRecordset->adoEOF)  //找到被叫局向
				{
					flag1=1;
				}
				pApp->m_pjifeiRecordset->Close();
			}
			if (flag1==0)
			{
				strSql.Format("select * from feefreecalled where callednum='%s'",strspcCalledNum);

				result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
					pApp->m_pjifeiConnection.GetInterfacePtr(),
					adOpenDynamic,adLockOptimistic,adCmdText);
				if (!SUCCEEDED(result))
				{
					AfxMessageBox("can't open feetele table");
				}
				if(!pApp->m_pjifeiRecordset->adoEOF)
				{	
					flag1=1;
				}
				pApp->m_pjifeiRecordset->Close();
			}
			if (flag1==0)
			{
				flag=2;
			}
			
		}

		if (flag!=0)
		{
			COleDateTime ttdate,ttime;
			long lyear,lmonth,lday,lhour,lminute,lsecond;
			ttdate.ParseDateTime(strspcTalkEndDate,VAR_DATEVALUEONLY);
			ttime.ParseDateTime(strspcTalkEndTime,VAR_TIMEVALUEONLY);
			lyear=ttdate.GetYear();
			lmonth=ttdate.GetMonth();
			lday=ttdate.GetDay();
			lhour=ttime.GetHour();
			lminute=ttime.GetMinute();
			lsecond=ttime.GetSecond();
			
			strSql.Format("select * from blackSub where blackCallingNum='%s' and \
				blackCalledNum='%s' and blackTalkTime=%d and \
				blackTalkEndDate=#%d-%d-%d# and blackTalkEndTime=#%d:%d:%d#",\
				strspcCallingNum,strspcCalledNum,atol(strspcTalkTime),\
				lyear,lmonth,lday,lhour,lminute,lsecond);
			result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
				pApp->m_pjifeiConnection.GetInterfacePtr(),
				adOpenDynamic,adLockOptimistic,adCmdText);
			if (!SUCCEEDED(result))
			{
				AfxMessageBox("can't open blackSub table");
			}
			if (!pApp->m_pjifeiRecordset->adoEOF)
			{
			}
			else
			{
				pApp->m_pjifeiRecordset->AddNew();
				pApp->m_pjifeiRecordset->PutCollect("blackCallingNum",_variant_t(strspcCallingNum));
				pApp->m_pjifeiRecordset->PutCollect("blackCalledNum",_variant_t(strspcCalledNum));
				pApp->m_pjifeiRecordset->PutCollect("blackTalkTime",_variant_t(strspcTalkTime));
				pApp->m_pjifeiRecordset->PutCollect("blackTalkEndDate",_variant_t(strspcTalkEndDate));
				pApp->m_pjifeiRecordset->PutCollect("blackTalkEndTime",_variant_t(strspcTalkEndTime));
				if (flag==1)
					pApp->m_pjifeiRecordset->PutCollect("blackReason",_variant_t("callingnum no Register"));
				else if (flag==2)
					pApp->m_pjifeiRecordset->PutCollect("blackReason",_variant_t("calleddir no Register"));
				pApp->m_pjifeiRecordset->PutCollect("blackDelflag",_variant_t("1"));
				pApp->m_pjifeiRecordset->Update();
			}
			pApp->m_pjifeiRecordset->Close();
		}
		
		donerecordcount++;
		pos=((donerecordcount*100)/spcrecordcount);
		m_progress.SetPos(pos);
		pApp->m_pspcRecordset->MoveNext();
	}
	pApp->m_pspcRecordset->Close();
	AfxMessageBox("Attraction finished");

	CDialog::OnOK();
}

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

⌨️ 快捷键说明

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