📄 blackconditionrisingdlg.cpp
字号:
// blackConditionRisingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "fee.h"
#include "blackConditionRisingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CblackConditionRisingDlg dialog
CblackConditionRisingDlg::CblackConditionRisingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CblackConditionRisingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CblackConditionRisingDlg)
m_strblackrisingendday = _T("");
m_strblackrisingendmonth = _T("");
m_strblackrisingendyear = _T("");
m_strblackrisingstartday = _T("");
m_strblackrisingstartmonth = _T("");
m_strblackrisingstartyear = _T("");
m_strblackrisingtelenum = _T("");
//}}AFX_DATA_INIT
}
void CblackConditionRisingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CblackConditionRisingDlg)
DDX_Control(pDX, IDC_PROGRESS1, m_progress);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_ENDDAY, m_strblackrisingendday);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_ENDMONTH, m_strblackrisingendmonth);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_ENDYEAR, m_strblackrisingendyear);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_STARTDAY, m_strblackrisingstartday);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_STARTMONTH, m_strblackrisingstartmonth);
DDX_CBString(pDX, IDC_COMBO_BLACKRISING_STARTYEAR, m_strblackrisingstartyear);
DDX_Text(pDX, IDC_EDIT_BLACKRISING_TELENUM, m_strblackrisingtelenum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CblackConditionRisingDlg, CDialog)
//{{AFX_MSG_MAP(CblackConditionRisingDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CblackConditionRisingDlg message handlers
BOOL CblackConditionRisingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
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 CblackConditionRisingDlg::OnOK()
{
// TODO: Add extra validation here
CString strspcCallingNum,strspcCalledNum,strspcTalkTime;
CString strspcTalkEndDate,strspcTalkEndTime;
CString strSql,strtemp,strtemp1;
long lstartyear,lstartmonth,lstartday;
long lendyear,lendmonth,lendday;
CString blackrisingtelenum;
unsigned long int i;
unsigned long spcrecordcount,donerecordcount;
unsigned char flag;
unsigned int pos;
CFeeApp* pApp;
HRESULT result;
UpdateData(TRUE);
lstartyear=atol(m_strblackrisingstartyear);
lstartmonth=atol(m_strblackrisingstartmonth);
lstartday=atol(m_strblackrisingstartday);
lendyear=atol(m_strblackrisingendyear);
lendmonth=atol(m_strblackrisingendmonth);
lendday=atol(m_strblackrisingendday);
flag=0;
if (lendyear>lstartyear)
{
flag=1;
}
else if (lendyear==lstartyear)
{
if (lendmonth>lstartmonth)
{
flag=1;
}
else if (lendmonth==lstartmonth)
{
if (lendday>=lstartday)
{
flag=1;
}
}
}
if (flag==0)
{
AfxMessageBox("The start time is larger than the end time");
return;
}
if (lstartyear==0 && lstartmonth==0 && lstartday==0 &&
lendyear==0 && lendmonth==0 && lendday==0 &&
m_strblackrisingtelenum=="")
{
AfxMessageBox("Conditions cannot be blank");
return;
}
flag=0;
if (lstartyear==0) flag++;
if (lstartmonth==0) flag++;
if (lstartday==0) flag++;
if (flag!=0 && flag!=3)
{
AfxMessageBox("Start time setting error");
return;
}
flag=0;
if (lendyear==0) flag++;
if (lendmonth==0) flag++;
if (lendday==0) flag++;
if (flag!=0 && flag!=3)
{
AfxMessageBox("End time setting error");
return;
}
flag=0;
strSql="select * from spcrecord ";
if (lstartyear!=0)
{
strtemp.Format("where spcEndDate>=#%d-%d-%d#",lstartyear,lstartmonth,lstartday);
flag=1;
strSql=strSql+strtemp;
}
if (lendyear!=0)
{
if (flag==0)
{
strtemp.Format("where spcEndDate<=#%d-%d-%d#",lendyear,lendmonth,lendday);
}
else
{
strtemp.Format("and spcEndDate<=#%d-%d-%d#",lendyear,lendmonth,lendday);
}
flag=1;
strSql=strSql+strtemp;
}
if (m_strblackrisingtelenum!="")
{
if (flag==0)
{
strtemp.Format("where spcCallingNum='%s'",m_strblackrisingtelenum);
}
else
{
strtemp.Format("and spcCallingNum='%s'",m_strblackrisingtelenum);
}
strSql=strSql+strtemp;
}
pApp=(CFeeApp *)AfxGetApp();
pApp->m_pspcRecordset->CursorLocation=adUseClientBatch;
result=pApp->m_pspcRecordset->Open(strSql.AllocSysString(),
pApp->m_pspcConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
if (!SUCCEEDED(result))
{
AfxMessageBox("can't open spcrecord table");
}
i=0;
if (!pApp->m_pspcRecordset->adoEOF)
{
spcrecordcount=pApp->m_pspcRecordset->GetRecordCount();
}
donerecordcount=0;
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 CblackConditionRisingDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -