📄 informationissue.cpp
字号:
// InformationIssue.cpp: implementation of the CInformationIssue class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "InformationIssue.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CInformationIssue::CInformationIssue()
{
}
CInformationIssue::~CInformationIssue()
{
}
COleDateTime CInformationIssue::GetIssueDate()
{
return issueDate;
}
CString CInformationIssue::GetDepartment()
{
return department;
}
CString CInformationIssue::GetStaffName()
{
return staffName;
}
CString CInformationIssue::GetSubject()
{
return subject;
}
CString CInformationIssue::GetContent()
{
return content;
}
CString CInformationIssue::GetInformationIssueID()
{
return informationIssueID;
}
void CInformationIssue::SetIssueDate(COleDateTime vIssueDate)
{
issueDate=vIssueDate;
}
void CInformationIssue::SetDepartment(CString vDepartment)
{
department=vDepartment;
}
void CInformationIssue::SetStaffName(CString vStaffName)
{
staffName=vStaffName;
}
void CInformationIssue::SetSubject(CString vSubject)
{
subject=vSubject;
}
void CInformationIssue::SetContent(CString vContent)
{
content=vContent;
}
void CInformationIssue::SetInformationIssueID(CString vInformationIssueID)
{
informationIssueID=vInformationIssueID;
}
void CInformationIssue::sqlInsert()
{
CString strSQL;
strSQL="select * from informationIssue";
_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("informationIssueID",_variant_t(informationIssueID));
m_pRecordset->PutCollect("issueDate",_variant_t(issueDate));
m_pRecordset->PutCollect("Department",_variant_t(department.Left(50)));
m_pRecordset->PutCollect("StaffName",_variant_t(staffName));
m_pRecordset->PutCollect("Subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CInformationIssue::sqlUpdate(CString vInformationIssueID)
{
CString strSQL;
strSQL="select * from informationIssue where informationIssueID='";
strSQL=strSQL+vInformationIssueID+"'";
_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("informationIssueID",_variant_t(vInformationIssueID));
m_pRecordset->PutCollect("issueDate",_variant_t(issueDate));
m_pRecordset->PutCollect("Department",_variant_t(department.Left(50)));
m_pRecordset->PutCollect("StaffName",_variant_t(staffName));
m_pRecordset->PutCollect("Subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CInformationIssue::sqlDelete(CString vInformationIssueID)
{
CString strSQL;
strSQL="delete from informationIssue where informationIssueID='";
strSQL=strSQL+vInformationIssueID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CInformationIssue::GetData(CString vInformationIssueID)
{
CString strSQL;
CString str;
str.Format("%d",vInformationIssueID);
strSQL="select * from informationIssue where informationIssueID='";
strSQL=strSQL+vInformationIssueID+"'";
_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))
{
//informationIssueID= atoi(((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("informationIssueID")));
issueDate= m_pRecordset->GetCollect("issueDate");
department= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("Department"));
staffName= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("StaffName"));
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 + -