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

📄 userchannel.cpp

📁 一个电视台专用的信息管理软件源代码
💻 CPP
字号:
// UserChannel.cpp: implementation of the CUserChannel class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "UserChannel.h"

#include "ADOConn.h"

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

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

CUserChannel::CUserChannel()
{

}

CUserChannel::~CUserChannel()
{

}

int CUserChannel::GetUID()
{
	return UID;
}

int CUserChannel::GetUserID()
{
	return UserID;
}

int CUserChannel::GetChannelID()
{
	return ChannelID;
}

int CUserChannel::GetColumnID()
{
	return ColumnID;
}


void CUserChannel::SetUID(int iUID)
{
	UID=iUID;
}

void CUserChannel::SetUserID(int iUserID)
{
	UserID=iUserID;
}

void CUserChannel::SetChannelID(int iChannelID)
{
	ChannelID=iChannelID;
}

void CUserChannel::SetColumnID(int iColumnID)
{
	ColumnID=iColumnID;
}

void CUserChannel::sql_insert(int iUserID,int iChannelID,int iColumnID)
{
	CString strUserID,strChannelID,strColumnID;
	strUserID.Format("%d", iUserID);
	strChannelID.Format("%d", iChannelID);
	strColumnID.Format("%d", iColumnID);

	//设置INSERT语句
	vSQL = "INSERT INTO UserChannel VALUES(" + strUserID + "," + strChannelID + "," +strColumnID + ")";
    AfxMessageBox(vSQL);
	//执行INSERT语句
	ExecuteSQL(vSQL);	
	

}
void CUserChannel::sql_update(int iUID,int iUserID,int iChannelID,int iColumnID)
{
	CString strUID,strUserID,strChannelID,strColumnID;
	strUID.Format("%d", iUID);
	strUserID.Format("%d", iUserID);
	strChannelID.Format("%d", iChannelID);
	strColumnID.Format("%d", iColumnID);

	//设置UPDATE语句
	vSQL = "UPDATE UserChannel SET UserID=" + strUserID + ", ChannelID=" + strChannelID + ", ColumnID=" +strColumnID + " WHERE UID= "+ strUID ;
    AfxMessageBox(vSQL);
	//执行INSERT语句
	ExecuteSQL(vSQL);	
	
}

void CUserChannel::sql_delete(int iUID)
{
	CString strUID;
	strUID.Format("%d", iUID);
	//设置DELETE语句
	vSQL = "DELETE FROM UserChannel WHERE UID= "+ strUID ;
    AfxMessageBox(vSQL);
	//执行INSERT语句
	ExecuteSQL(vSQL);	

}

void CUserChannel::GetData(int UID)
{
	//设置SELECT语句
	vSQL = "SELECT * FROM UserChannel WHERE UID=" + UID;
	//执行SELETE语句
	m_pRecordset = GetRecordSet(vSQL);

	//返回各列的值
	if (m_pRecordset->adoEOF)
		CUserChannel();
	else
	{
		UserID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("UserID"));
		ChannelID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ChannelID"));
		ColumnID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ColumnID"));

	}
	

}
int CUserChannel::GetAuditor(int iChannelID,int iColumnID)
{
	CString strChannelID;
	strChannelID.Format("%d",iChannelID);

	CString strColumnID;
	strColumnID.Format("%d",iColumnID);
	//设置SELECT语句
	vSQL = "SELECT UserID FROM UserChannel WHERE ChannelID=" + strChannelID+ " AND ColumnID=" + strColumnID;
	//执行SELETE语句
	m_pRecordset = GetRecordSet(vSQL);
	UserID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("UserID"));

	return UserID;
}

int CUserChannel::GetColumnIDByUserID(int iUserID)
{
	CString strUserID;
	strUserID.Format("%d",iUserID);
	//设置SELECT语句
	vSQL = "SELECT ColumnID FROM UserChannel WHERE IsDelete=0 AND UserID=" + strUserID;
	//执行SELETE语句
	m_pRecordset = GetRecordSet(vSQL);
	ColumnID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ColumnID"));

	return ColumnID;

}


//PASS
int CUserChannel::GetChannelIDByUserID(int iUserID)
{
	CString strUserID;
	strUserID.Format("%d",iUserID);
	//设置SELECT语句
	vSQL = "SELECT ChannelID FROM UserChannel WHERE IsDelete=0 AND UserID=" + strUserID;
	//执行SELETE语句
	m_pRecordset = GetRecordSet(vSQL);
	ChannelID = atoi((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ChannelID"));
	

	return ChannelID;

}

⌨️ 快捷键说明

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