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

📄 billiards_huan_rollcall.cpp

📁 可以用于台球厅进行收费的程序代码,计算时间并进行费用计算
💻 CPP
字号:
// Billiards_Huan_RollCall.cpp : implementation file
//

#include "stdafx.h"
#include "双星台球厅计时收费系统.h"
#include "Billiards_Huan_RollCall.h"
#include "双星台球厅计时收费系统View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBilliards_Huan_RollCall dialog


CBilliards_Huan_RollCall::CBilliards_Huan_RollCall(CWnd* pParent /*=NULL*/)
	: CDialog(CBilliards_Huan_RollCall::IDD, pParent)
{
	//{{AFX_DATA_INIT(CBilliards_Huan_RollCall)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CBilliards_Huan_RollCall::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBilliards_Huan_RollCall)
	DDX_Control(pDX, IDOK, m_OK);
	DDX_Control(pDX, IDC_COMBO2, m_Com_2);
	DDX_Control(pDX, IDC_COMBO1, m_Com_1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBilliards_Huan_RollCall, CDialog)
	//{{AFX_MSG_MAP(CBilliards_Huan_RollCall)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
	ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBilliards_Huan_RollCall message handlers

BOOL CBilliards_Huan_RollCall::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_Mark_1[0]=m_Mark_1[1]=FALSE;
	
	CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	
	CString str_1,str_2,str_3;
	_variant_t var;

	m_OK.EnableWindow(FALSE);
	
	try
	{
		pFrame->f_MyApp->m_pRecordset->Open("SELECT *FROM TaiQiuZheUserInformationRecond",
			pFrame->f_MyApp->m_pConnection.GetInterfacePtr(),
			adOpenDynamic,
			adLockOptimistic,
			adCmdText);
		
		if(!pFrame->f_MyApp->m_pRecordset->BOF)
		{
			pFrame->f_MyApp->m_pRecordset->MoveFirst();
		}
		while(!pFrame->f_MyApp->m_pRecordset->adoEOF)
		{
			var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserMark");
			if(var.vt!=VT_NULL)
			{
				str_1=(LPCSTR)_bstr_t(var);

				if(str_1=="正在使用")
				{
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserNumber");
					if(var.vt!=VT_NULL)
					{
						str_2=(LPCSTR)_bstr_t(var);

						m_Com_1.AddString("第 "+str_2+" 台球桌");
					}
				}
				if(str_1=="没有使用")
				{
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserNumber");
					if(var.vt!=VT_NULL)
					{
						str_2=(LPCSTR)_bstr_t(var);

						m_Com_2.AddString("第 "+str_2+" 台球桌");
					}
				}
			}
			pFrame->f_MyApp->m_pRecordset->MoveNext();
		}
		pFrame->f_MyApp->m_pRecordset->Close();		
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.ErrorMessage());
		return FALSE;
	}
	
	return TRUE;
}

void CBilliards_Huan_RollCall::OnSelchangeCombo1() 
{
	m_Mark_1[0]=TRUE;

	if((m_Mark_1[0]==TRUE)&&(m_Mark_1[1]==TRUE))
	{
		m_OK.EnableWindow(TRUE);
	}
}

void CBilliards_Huan_RollCall::OnSelchangeCombo2() 
{
	m_Mark_1[1]=TRUE;

	if((m_Mark_1[0]==TRUE)&&(m_Mark_1[1]==TRUE))
	{
		m_OK.EnableWindow(TRUE);
	}
}

void CBilliards_Huan_RollCall::OnOK() 
{
	CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;

	CString str_3;
	m_Com_1.GetWindowText(str_3);

	CString str_4;
	m_Com_2.GetWindowText(str_4);
	
	str_3.Replace("第 ","");
	str_3.Replace(" 台球桌","");

	str_4.Replace("第 ","");
	str_4.Replace(" 台球桌","");
	
	CString str_1,str_2,str_10,str_11,str_12,str_13;
	_variant_t var;
	
	try
	{
		pFrame->f_MyApp->m_pRecordset->Open("SELECT *FROM TaiQiuZheUserInformationRecond",
			pFrame->f_MyApp->m_pConnection.GetInterfacePtr(),
			adOpenDynamic,
			adLockOptimistic,
			adCmdText);
		
		if(!pFrame->f_MyApp->m_pRecordset->BOF)
		{
			pFrame->f_MyApp->m_pRecordset->MoveFirst();
		}
		while(!pFrame->f_MyApp->m_pRecordset->adoEOF)
		{
			var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserNumber");
			if(var.vt!=VT_NULL)
			{
				str_1=(LPCSTR)_bstr_t(var);
				
				if(str_1==str_3)
				{
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserData");
					if(var.vt!=VT_NULL)
					{
						str_10=(LPCSTR)_bstr_t(var);
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("BeginTime");
					if(var.vt!=VT_NULL)
					{
						str_11=(LPCSTR)_bstr_t(var);
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserPeople");
					if(var.vt!=VT_NULL)
					{
						str_12=(LPCSTR)_bstr_t(var);
					}
					
					break;
				}
			}
			pFrame->f_MyApp->m_pRecordset->MoveNext();
		}
		pFrame->f_MyApp->m_pRecordset->Close();		
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.ErrorMessage());
		return;
	}

	try
	{
		pFrame->f_MyApp->m_pRecordset->Open("SELECT *FROM TaiQiuZheUserInformationRecond",
			pFrame->f_MyApp->m_pConnection.GetInterfacePtr(),
			adOpenDynamic,
			adLockOptimistic,
			adCmdText);
		
		if(!pFrame->f_MyApp->m_pRecordset->BOF)
		{
			pFrame->f_MyApp->m_pRecordset->MoveFirst();
		}
		while(!pFrame->f_MyApp->m_pRecordset->adoEOF)
		{
			var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserNumber");
			if(var.vt!=VT_NULL)
			{
				str_1=(LPCSTR)_bstr_t(var);
				
				if(str_1==str_3)
				{
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserMark",_variant_t("没有使用"));
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserData",_variant_t(""));
					pFrame->f_MyApp->m_pRecordset->PutCollect("BeginTime",_variant_t(""));
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserPeople",_variant_t(""));

					pFrame->f_MyApp->m_pRecordset->Update();
				}

				if(str_1==str_4)
				{
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserMark",_variant_t("正在使用"));
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserData",_variant_t(str_10));
					pFrame->f_MyApp->m_pRecordset->PutCollect("BeginTime",_variant_t(str_11));
					pFrame->f_MyApp->m_pRecordset->PutCollect("UserPeople",_variant_t(str_12));

					pFrame->f_MyApp->m_pRecordset->Update();
				}
			}
			pFrame->f_MyApp->m_pRecordset->MoveNext();
		}
		pFrame->f_MyApp->m_pRecordset->Close();		
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.ErrorMessage());
		return;
	}

	pFrame->f_MyView->On_AddDataToListShow(str_3);
	pFrame->f_MyView->On_AddDataToListShow(str_4);
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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