📄 eventrecord.cpp
字号:
// EventRecord.cpp: implementation of the CEventRecord class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "EventRecord.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CEventRecord::CEventRecord()
{
}
CEventRecord::~CEventRecord()
{
}
CString CEventRecord::GetEventRecordID()
{
return eventRecordID;
}
CString CEventRecord::GetContent()
{
return content;
}
CString CEventRecord::GetSubject()
{
return subject;
}
CString CEventRecord::GetRecorder()
{
return recorder;
}
CString CEventRecord::GetEventCharacter()
{
return eventCharacter;
}
COleDateTime CEventRecord::GetEventDate()
{
return eventDate;
}
void CEventRecord::SetEventRecordID(CString vEventRecordID)
{
eventRecordID=vEventRecordID;
}
void CEventRecord::SetContent(CString vContent)
{
content=vContent;
}
void CEventRecord::SetSubject(CString vSubject)
{
subject=vSubject;
}
void CEventRecord::SetRecorder(CString vRecorder)
{
recorder=vRecorder;
}
void CEventRecord::SetEventCharacter(CString vEventCharacter)
{
eventCharacter=vEventCharacter;
}
void CEventRecord::SetEventDate(COleDateTime vEventDate)
{
eventDate=vEventDate;
}
void CEventRecord::sqlInsert()
{
CString strSQL;
strSQL="select * from eventRecord";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->AddNew();
m_pRecordset->PutCollect("eventRecordID",_variant_t(eventRecordID));
m_pRecordset->PutCollect("eventDate",_variant_t(eventDate));
m_pRecordset->PutCollect("eventCharacter",_variant_t(eventCharacter.Left(50)));
m_pRecordset->PutCollect("recorder",_variant_t(recorder.Left(50)));
m_pRecordset->PutCollect("subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CEventRecord::sqlUpdate(CString cEventRecordID)
{
CString strSQL;
strSQL="select * from eventRecord where eventRecordID='";
strSQL+=cEventRecordID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->PutCollect("eventDate",_variant_t(eventDate));
m_pRecordset->PutCollect("eventCharacter",_variant_t(eventCharacter.Left(50)));
m_pRecordset->PutCollect("recorder",_variant_t(recorder.Left(50)));
m_pRecordset->PutCollect("subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CEventRecord::sqlDelete(CString cEventRecordID)
{
CString strSQL;
strSQL="delete from eventRecord where eventRecordID='";
strSQL=strSQL+cEventRecordID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CEventRecord::GetData(CString cEventRecordID)
{
CString strSQL;
strSQL="select * from eventRecord where eventRecordID='";
strSQL+=cEventRecordID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(!(m_pRecordset->adoEOF))
{
eventRecordID=cEventRecordID;
eventDate= m_pRecordset->GetCollect("eventDate");
eventCharacter= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("eventCharacter"));
recorder= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("recorder"));
subject= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("subject"));
content= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("content"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -