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

📄 recordobject.cpp

📁 VC++开发的一个电话录音程序
💻 CPP
字号:
/ RecordObject.cpp: implementation of the CRecordObject class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "phonerec.h"
#include "RecordObject.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern CDatabase g_dbCust;
extern int g_serildata;

CRecordObject::CRecordObject( int lineID, LPCTSTR callerID )
{
	m_iLineID			= lineID;	


}

void CRecordObject::InitRecord( )
{
	m_startDate         = CTime::GetCurrentTime();
	m_StartTime			= m_startDate;
	m_EndTime			= m_StartTime;
	m_TalkTimeSpan	=	0; 
	
	m_strSerialNo.Format( "%05d",  ++g_serildata );

	extern CString g_strReSavePath;
	m_strPath = g_strReSavePath +  m_StartTime.Format("\\%Y\\%m\\%d");
	m_strFilename.Format("%s\\%s.wav" , m_strPath ,m_strSerialNo);

}

CRecordObject::~CRecordObject()
{

}

//从数据书中取出最后一条记录的序号
int CRecordObject::GetMaxSerialNoFromdb()
{
	CRecordset rs( &g_dbCust );
	
	CTime time = CTime::GetCurrentTime();
	CString strStartDate = time.Format("%Y-%m-%d");
	
	CString strSQL = "Select *  from RecordData Where StartDate = # " +strStartDate+ "#" +" order by StartDate ASC, StartTime ASC";
	rs.Open( CRecordset::dynaset, _T( strSQL ) );
	
	while( !rs.IsEOF( ) )
	{
		rs.MoveLast();
		rs.GetFieldValue( "SerialNo", m_strSerialNo );
		break;
	}
	rs.Close();

	if( m_strSerialNo.GetLength() == 0 )
	{
		m_strSerialNo = "00000";
	}
	else
	{
		int itempSerial = atoi( m_strSerialNo )+1;
		m_strSerialNo.Format( "%05d",itempSerial );
	}
	return 0;
}

void CRecordObject::InsertRedataTodb( )
{
	RecordUint tempunit;
	//GetMaxSerialNoFromdb();
	CString strLineID ;
	CString strStartDate;
	CString strStartTime;
	CString  strEndTime;
	CString strTalkLong;

	m_EndTime      = CTime::GetCurrentTime();
	m_TalkTimeSpan	=	m_EndTime-m_StartTime;




//
	SetRecordUint( tempunit );

	strLineID.Format( "%d",tempunit.m_tagiLineID );
	strStartDate = tempunit.m_tagStartDate.Format("%Y-%m-%d");
	strStartTime	= tempunit.m_tagStartTime.Format("%H:%M:%S");
	strEndTime = tempunit.m_tagEndTime.Format("%H:%M:%S");
 	strTalkLong = tempunit.m_tagTalkTimeSpan.Format("%H:%M:%S");
	

//	CString strSQLSave;
//	strSQLSave = "Insert into RecordData( SerialNo, LineID, CallerID, DTMF, StartTime, EndTime, TimeLong, FileAllPath) values( '"+ tempunit.m_tagstrSerialNo +"','"+ strLineID +"','"+ tempunit.m_tagstrCallerID +"','"+ tempunit.m_tagstrDTMF +"','"+ strStartTime +"','"+ strEndTime +"','"+ strTalkLong +"','"+ tempunit.m_tagFileAllPath +"')";
	CString strSQLSave = "Insert into RecordData( SerialNo, LineID, CallerID, DTMF, StartDate, StartTime, EndTime, TimeLong, FileAllPath ) values( '" + tempunit.m_tagstrSerialNo + "','"+ strLineID+"', '"+ tempunit.m_tagstrCallerID +"','"+tempunit.m_tagstrDTMF+"','"+strStartDate+"','"+strStartTime+"','"+strEndTime+"','"+strTalkLong +"','"+tempunit.m_tagFileAllPath+"')";
	g_dbCust.ExecuteSQL( strSQLSave );
}

void CRecordObject::SetRecordUint(RecordUint &rRecordUint)
{
	rRecordUint.m_tagstrSerialNo = m_strSerialNo;
	rRecordUint.m_tagiLineID = m_iLineID;
	rRecordUint.m_tagstrCallerID = m_strCallerID;
	if( m_strCallerID.GetLength() == 0 )
	{
		rRecordUint.m_tagstrDTMF = m_strDTMF;	
	}
	else
	{
		rRecordUint.m_tagstrDTMF = "";
	}
	rRecordUint.m_tagStartDate = m_startDate;
	rRecordUint.m_tagStartTime = m_StartTime;
	rRecordUint.m_tagEndTime = m_EndTime;
	rRecordUint.m_tagTalkTimeSpan = m_TalkTimeSpan;
	rRecordUint.m_tagFileAllPath = m_strFilename;	
}

⌨️ 快捷键说明

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