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

📄 vote.cpp

📁 这是一个企业办公管理系统。实现了文件的制作、修改、传递、、保存、销毁、存档等一系列操作。为windows系统认证模式
💻 CPP
字号:
// Vote.cpp: implementation of the CVote class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Office.h"
#include "Vote.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CVote::CVote()
{

}

CVote::~CVote()
{

}


CString CVote::GetStaff()
{
	return staff;
}

COleDateTime CVote::GetPublishDate()
{
	return publishDate;
}

CString CVote::GetContent()
{
	return content;
}

void CVote::SetStaff(CString vStaff)
{
	staff=vStaff;
}

void CVote::SetPublishDate(COleDateTime vPublishDate)
{
	publishDate=vPublishDate;
}

void CVote::SetContent(CString vContent)
{
	content=vContent;
}

void CVote::sqlInsert()
{
	CString strSQL;

	strSQL="select * from voteRecord";
	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));				
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);
	if(SUCCEEDED(hTRes))
	{
		m_pRecordset->AddNew();

		CString str;
		m_pRecordset->PutCollect("staff",_variant_t(staff));
		m_pRecordset->PutCollect("publishDate",_variant_t(publishDate));
		m_pRecordset->PutCollect("content",_variant_t(content));
	
		m_pRecordset->Update();
	}
}

void CVote::sqlDelete(CString vContent)
{
	CString strSQL;
	strSQL="delete from voteRecord where content='";
	strSQL=strSQL+vContent+"'";
	(((COfficeApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}

void CVote::sqlUpdate(CString vContent)
{
	CString strSQL;

	strSQL="select * from voteRecord where content='";
	strSQL=strSQL+vContent+"'";
	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));				
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);
	if(!(m_pRecordset->adoEOF))
	{
		CString str;
		m_pRecordset->PutCollect("staff",_variant_t(staff));
		m_pRecordset->PutCollect("publishDate",_variant_t(publishDate));
		m_pRecordset->PutCollect("content",_variant_t(content));
		
		m_pRecordset->Update();
	}
}

void CVote::GetData(CString vContent)
{
	CString strSQL;

	strSQL="select * from voteRecord where content='";
	strSQL=strSQL+vContent+"'";
	_RecordsetPtr m_pRecordset;
	HRESULT hTRes;
	hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));				
	hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
			((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
			adOpenDynamic,adLockPessimistic,adCmdText);
	if(SUCCEEDED(hTRes))
	{
		CString str;
		staff= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("staff"));
		content= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("content"));
		publishDate= m_pRecordset->GetCollect("publishDate");
		
	}

}

⌨️ 快捷键说明

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