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

📄 bisaijifen.cpp

📁 由我为校教务处自主开发的竞赛计分软件。 该软件由“比赛信息管理”、“裁判信息管理”、“选手信息管理”、“比赛计分排序”等几个模块组成。基于MFC技术
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// bisaijifen.cpp : 实现文件
//

#include "stdafx.h"
#include "计分程序 by WS.h"
#include "bisaijifen.h"
#include ".\bisaijifen.h"



// Copyright (C) 1992-2001 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Visual C++ Language  Reference and related
// electronic documentation provided with Microsoft Visual C++.
// See these sources for detailed information regarding the
// Microsoft Visual C++ product.

// NOTE: This example will only work with Excel10 in OfficeXP
// Compile with cl /GX comexcel.cpp
#include "stdafx.h"


#define USE_PROGID 1

#define USE_LIBID 0

//
// Delete the *.tlh files when changing import qualifiers
//

#if USE_PROGID
#import "progid:Excel.Sheet" auto_search auto_rename rename_search_namespace("Office10")
#elif USE_LIBID
#import "libid:{00020813-0000-0000-C000-000000000046}" auto_search auto_rename version(1.3) lcid(0) no_search_namespace
#else
#pragma message ("Make sure the path to excel.exe is correct")
#import "c:\office\office10\excel.exe" auto_search auto_rename dual_interfaces
#endif

void dump_com_error(_com_error &e)
{
    _tprintf(_T("Oops - hit an error!\n"));
    _tprintf(_T("\a\tCode = %08lx\n"), e.Error());
    _tprintf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());
    _tprintf(_T("\a\tSource = %s\n"), (LPCTSTR) bstrSource);
    _tprintf(_T("\a\tDescription = %s\n"), (LPCTSTR) bstrDescription);
}

// If this is placed in the scope of the smart pointers, they must be
// explicitly Release(d) before CoUninitialize() is called.  If any reference
// count is non-zero, a protection fault will occur.
struct StartOle {
    StartOle() { CoInitialize(NULL); }
    ~StartOle() { CoUninitialize(); }
} _inst_StartOle;// bisaijifen 对话框

IMPLEMENT_DYNAMIC(bisaijifen, CDialog)
bisaijifen::bisaijifen(CWnd* pParent /*=NULL*/)
	: CDialog(bisaijifen::IDD, pParent)
	
{
	for(int i =0;i<30;i++){
	fenshu[i]=0;
	}
	zuizhongchengji=0;
}

bisaijifen::~bisaijifen()
{
}

void bisaijifen::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_dangqianbisai, dangqianbisai);
	DDX_Control(pDX, IDC_LIST1, xiangmulist);
	DDX_Control(pDX, IDC_LIST2, xuanshouxuhaolist);
	DDX_Control(pDX, IDC_EDIT1, xuanshouxuhao);
	DDX_Control(pDX, IDC_STATIC_xiangmuming, xiangmuming);
	DDX_Text(pDX, IDC_STATIC_pingwei, pingweiming[0]);
	DDX_Text(pDX, IDC_STATIC_pingwei1, pingweiming[1]);
	DDX_Text(pDX, IDC_STATIC_pingwei2, pingweiming[2]);
	DDX_Text(pDX, IDC_STATIC_pingwei3, pingweiming[3]);
	DDX_Text(pDX, IDC_STATIC_pingwei4, pingweiming[4]);
	DDX_Text(pDX, IDC_STATIC_pingwei5, pingweiming[5]);
	DDX_Text(pDX, IDC_STATIC_pingwei6, pingweiming[6]);
	DDX_Text(pDX, IDC_STATIC_pingwei7, pingweiming[7]);
	DDX_Text(pDX, IDC_STATIC_pingwei8, pingweiming[8]);
	DDX_Text(pDX, IDC_STATIC_pingwei9, pingweiming[9]);
	DDX_Text(pDX, IDC_STATIC_pingwei10, pingweiming[10]);
	DDX_Text(pDX, IDC_STATIC_pingwei11, pingweiming[11]);
	DDX_Text(pDX, IDC_STATIC_pingwei12, pingweiming[12]);
	DDX_Text(pDX, IDC_STATIC_pingwei13, pingweiming[13]);
	DDX_Text(pDX, IDC_STATIC_pingwei14, pingweiming[14]);
	DDX_Text(pDX, IDC_STATIC_pingwei15, pingweiming[15]);
	DDX_Text(pDX, IDC_STATIC_pingwei16, pingweiming[16]);
	DDX_Text(pDX, IDC_STATIC_pingwei17, pingweiming[17]);
	DDX_Text(pDX, IDC_STATIC_pingwei18, pingweiming[18]);
	DDX_Text(pDX, IDC_STATIC_pingwei19, pingweiming[19]);
	DDX_Text(pDX, IDC_STATIC_pingwei20, pingweiming[20]);
	DDX_Text(pDX, IDC_STATIC_pingwei21, pingweiming[21]);
	DDX_Text(pDX, IDC_STATIC_pingwei22, pingweiming[22]);
	DDX_Text(pDX, IDC_STATIC_pingwei23, pingweiming[23]);
	DDX_Text(pDX, IDC_STATIC_pingwei24, pingweiming[24]);
	DDX_Text(pDX, IDC_STATIC_pingwei25, pingweiming[25]);
	DDX_Text(pDX, IDC_STATIC_pingwei26, pingweiming[26]);
	DDX_Text(pDX, IDC_STATIC_pingwei27, pingweiming[27]);
	DDX_Text(pDX, IDC_STATIC_pingwei28, pingweiming[28]);
	DDX_Text(pDX, IDC_STATIC_pingwei29, pingweiming[29]);
	DDX_Control(pDX, IDC_EDIT2, fenshuctrl[0]);
	DDX_Control(pDX, IDC_EDIT3, fenshuctrl[1]);
	DDX_Control(pDX, IDC_EDIT4, fenshuctrl[2]);
	DDX_Control(pDX, IDC_EDIT5, fenshuctrl[3]);
	DDX_Control(pDX, IDC_EDIT6, fenshuctrl[4]);
	DDX_Control(pDX, IDC_EDIT7, fenshuctrl[5]);
	DDX_Control(pDX, IDC_EDIT8, fenshuctrl[6]);
	DDX_Control(pDX, IDC_EDIT9, fenshuctrl[7]);
	DDX_Control(pDX, IDC_EDIT10, fenshuctrl[8]);
	DDX_Control(pDX, IDC_EDIT11, fenshuctrl[9]);
	DDX_Control(pDX, IDC_EDIT12, fenshuctrl[10]);
	DDX_Control(pDX, IDC_EDIT13, fenshuctrl[11]);
	DDX_Control(pDX, IDC_EDIT14, fenshuctrl[12]);
	DDX_Control(pDX, IDC_EDIT15, fenshuctrl[13]);
	DDX_Control(pDX, IDC_EDIT16, fenshuctrl[14]);
	DDX_Control(pDX, IDC_EDIT17, fenshuctrl[15]);
	DDX_Control(pDX, IDC_EDIT18, fenshuctrl[16]);
	DDX_Control(pDX, IDC_EDIT19, fenshuctrl[17]);
	DDX_Control(pDX, IDC_EDIT20, fenshuctrl[18]);
	DDX_Control(pDX, IDC_EDIT21, fenshuctrl[19]);
	DDX_Control(pDX, IDC_EDIT22, fenshuctrl[20]);
	DDX_Control(pDX, IDC_EDIT23, fenshuctrl[21]);
	DDX_Control(pDX, IDC_EDIT24, fenshuctrl[22]);
	DDX_Control(pDX, IDC_EDIT25, fenshuctrl[23]);
	DDX_Control(pDX, IDC_EDIT26, fenshuctrl[24]);
	DDX_Control(pDX, IDC_EDIT27, fenshuctrl[25]);
	DDX_Control(pDX, IDC_EDIT28, fenshuctrl[26]);
	DDX_Control(pDX, IDC_EDIT29, fenshuctrl[27]);
	DDX_Control(pDX, IDC_EDIT30, fenshuctrl[28]);
	DDX_Control(pDX, IDC_EDIT31, fenshuctrl[29]);
	DDX_Text(pDX, IDC_EDIT2, fenshu[0]);
	DDX_Text(pDX, IDC_EDIT3, fenshu[1]);
	DDX_Text(pDX, IDC_EDIT4, fenshu[2]);
	DDX_Text(pDX, IDC_EDIT5, fenshu[3]);
	DDX_Text(pDX, IDC_EDIT6, fenshu[4]);
	DDX_Text(pDX, IDC_EDIT7, fenshu[5]);
	DDX_Text(pDX, IDC_EDIT8, fenshu[6]);
	DDX_Text(pDX, IDC_EDIT9, fenshu[7]);
	DDX_Text(pDX, IDC_EDIT10, fenshu[8]);
	DDX_Text(pDX, IDC_EDIT11, fenshu[9]);
	DDX_Text(pDX, IDC_EDIT12, fenshu[10]);
	DDX_Text(pDX, IDC_EDIT13, fenshu[11]);
	DDX_Text(pDX, IDC_EDIT14, fenshu[12]);
	DDX_Text(pDX, IDC_EDIT15, fenshu[13]);
	DDX_Text(pDX, IDC_EDIT16, fenshu[14]);
	DDX_Text(pDX, IDC_EDIT17, fenshu[15]);
	DDX_Text(pDX, IDC_EDIT18, fenshu[16]);
	DDX_Text(pDX, IDC_EDIT19, fenshu[17]);
	DDX_Text(pDX, IDC_EDIT20, fenshu[18]);
	DDX_Text(pDX, IDC_EDIT21, fenshu[19]);
	DDX_Text(pDX, IDC_EDIT22, fenshu[20]);
	DDX_Text(pDX, IDC_EDIT23, fenshu[21]);
	DDX_Text(pDX, IDC_EDIT24, fenshu[22]);
	DDX_Text(pDX, IDC_EDIT25, fenshu[23]);
	DDX_Text(pDX, IDC_EDIT26, fenshu[24]);
	DDX_Text(pDX, IDC_EDIT27, fenshu[25]);
	DDX_Text(pDX, IDC_EDIT28, fenshu[26]);
	DDX_Text(pDX, IDC_EDIT29, fenshu[27]);
	DDX_Text(pDX, IDC_EDIT30, fenshu[28]);
	DDX_Text(pDX, IDC_EDIT31, fenshu[29]);
	DDX_Control(pDX, IDC_STATIC_pingwei, pingwei[0]);
	DDX_Control(pDX, IDC_STATIC_pingwei1, pingwei[1]);
	DDX_Control(pDX, IDC_STATIC_pingwei2, pingwei[2]);
	DDX_Control(pDX, IDC_STATIC_pingwei3, pingwei[3]);
	DDX_Control(pDX, IDC_STATIC_pingwei4, pingwei[4]);
	DDX_Control(pDX, IDC_STATIC_pingwei5, pingwei[5]);
	DDX_Control(pDX, IDC_STATIC_pingwei6, pingwei[6]);
	DDX_Control(pDX, IDC_STATIC_pingwei7, pingwei[7]);
	DDX_Control(pDX, IDC_STATIC_pingwei8, pingwei[8]);
	DDX_Control(pDX, IDC_STATIC_pingwei9, pingwei[9]);
	DDX_Control(pDX, IDC_STATIC_pingwei10, pingwei[10]);
	DDX_Control(pDX, IDC_STATIC_pingwei11, pingwei[11]);
	DDX_Control(pDX, IDC_STATIC_pingwei12, pingwei[12]);
	DDX_Control(pDX, IDC_STATIC_pingwei13, pingwei[13]);
	DDX_Control(pDX, IDC_STATIC_pingwei14, pingwei[14]);
	DDX_Control(pDX, IDC_STATIC_pingwei15, pingwei[15]);
	DDX_Control(pDX, IDC_STATIC_pingwei16, pingwei[16]);
	DDX_Control(pDX, IDC_STATIC_pingwei17, pingwei[17]);
	DDX_Control(pDX, IDC_STATIC_pingwei18, pingwei[18]);
	DDX_Control(pDX, IDC_STATIC_pingwei19, pingwei[19]);
	DDX_Control(pDX, IDC_STATIC_pingwei20, pingwei[20]);
	DDX_Control(pDX, IDC_STATIC_pingwei21, pingwei[21]);
	DDX_Control(pDX, IDC_STATIC_pingwei22, pingwei[22]);
	DDX_Control(pDX, IDC_STATIC_pingwei23, pingwei[23]);
	DDX_Control(pDX, IDC_STATIC_pingwei24, pingwei[24]);
	DDX_Control(pDX, IDC_STATIC_pingwei25, pingwei[25]);
	DDX_Control(pDX, IDC_STATIC_pingwei26, pingwei[26]);
	DDX_Control(pDX, IDC_STATIC_pingwei27, pingwei[27]);
	DDX_Control(pDX, IDC_STATIC_pingwei28, pingwei[28]);
	DDX_Control(pDX, IDC_STATIC_pingwei29, pingwei[29]);

	DDX_Control(pDX, IDC_STATIC_xinxi, zhuangtai);
	DDX_Control(pDX, IDC_LIST4, pingweizu);
	
}


BEGIN_MESSAGE_MAP(bisaijifen, CDialog)
	ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
	ON_BN_CLICKED(IDC_BUTTON7, OnBnClickedButton7)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
	ON_LBN_SELCHANGE(IDC_LIST4, OnLbnSelchangeList4)
	ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
	ON_BN_CLICKED(IDC_BUTTON8, OnBnClickedButton8)
	ON_BN_CLICKED(IDC_BUTTON9, OnBnClickedButton9)
END_MESSAGE_MAP()


// bisaijifen 消息处理程序

//void bisaijifen::OnOK()
//{
//	// TODO: 在此添加专用代码和/或调用基类
//	OnBnClickedButton7();
//	
//}

BOOL bisaijifen::OnInitDialog()
{
	CDialog::OnInitDialog();
	db.databaseconn();
	CString sql="select top 1 * from dangqiansaishi";
	db.datasearcher(sql);
if(!db.getrs()->adoeof){
	saishixuhao= db.getrs()->GetFields()->GetItem("saishixuhao")->GetValue();
	CString tempname=db.getrs()->GetFields()->GetItem("saishixuhao")->GetValue();
	mingcheng=db.getrs()->GetFields()->GetItem("mingcheng")->GetValue();

	riqi=db.getrs()->GetFields()->GetItem("riqi")->GetValue();

	didian=db.getrs()->GetFields()->GetItem("didian")->GetValue();
	
	shanchufenshu=db.getrs()->GetFields()->GetItem("shanchufenshu")->GetValue();
	
	xiangmushu=db.getrs()->GetFields()->GetItem("xiangmushu")->GetValue();
	
	pingwei1[0]=db.getrs()->GetFields()->GetItem("pingwei1")->GetValue();
	if (pingwei1[0]!="") pingweizu.AddString(pingwei1[0]);
	
	tpingweibili[0]=db.getrs()->GetFields()->GetItem("pingwei1bili")->GetValue();
	
	pingweirenshu[0]=db.getrs()->GetFields()->GetItem("pingwei1renshu")->GetValue();
	
	pingwei1[1]=db.getrs()->GetFields()->GetItem("pingwei2")->GetValue();
	if (pingwei1[1]!="") pingweizu.AddString(pingwei1[1]);
	
	tpingweibili[1]=db.getrs()->GetFields()->GetItem("pingwei2bili")->GetValue();
	
	pingweirenshu[1]=db.getrs()->GetFields()->GetItem("pingwei2renshu")->GetValue();
	
	pingwei1[2]=db.getrs()->GetFields()->GetItem("pingwei3")->GetValue();
	if (pingwei1[2]!="") pingweizu.AddString(pingwei1[2]);
	
	tpingweibili[2]=db.getrs()->GetFields()->GetItem("pingwei3bili")->GetValue();
	
	pingweirenshu[2]=db.getrs()->GetFields()->GetItem("pingwei3renshu")->GetValue();

		CString sql="select * from xuanshou where suoshusaishi="+tempname+"";
		tempname=db.getrs()->GetFields()->GetItem("mingcheng")->GetValue();
			dangqianbisai.SetWindowText(tempname);
		db.datasearcher(sql);
	while(!db.getrs()->adoeof){
					
					tempname=db.getrs()->GetFields()->GetItem("xiangmu")->GetValue();
					xiangmulist.AddString(tempname);
					tempname=db.getrs()->GetFields()->GetItem("xuhao")->GetValue();
					xuanshouxuhaolist.AddString(tempname);
					db.getrs()->MoveNext();
		
}
	}
	else{
		CString  names;
		names="暂时无记录";
		xiangmulist.AddString(names);
		}

	// TODO:  在此添加额外的初始化
	for(long i=29;i>=0;i--){
		fenshuctrl[i].SetReadOnly(1);
				
	}
	


	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

void bisaijifen::OnLbnSelchangeList1()

{
	// TODO: 在此添加控件通知处理程序代码
	for(long i=0;i<30;i++){
		fenshuctrl[i].SetReadOnly(1);
		fenshuctrl[i].SetWindowText("0");

	}
	int tempindex = pingweizu.GetCurSel();
	if (tempindex!=LB_ERR){
		int tpingweirenshu;
		tpingweirenshu=pingweirenshu[tempindex];
		
	for(long i=0;i<tpingweirenshu;i++){
		fenshuctrl[i].SetReadOnly(0);
				
	}
	}
		CString tempname,xuhaotemp;
		tempindex = xiangmulist.GetCurSel();
	if (tempindex!=LB_ERR){
		xiangmulist.GetText(tempindex,tempname);
		xiangmuming.SetWindowText(tempname);
		xuanshouxuhaolist.GetText(tempindex,tempname);
		xuanshouxuhao.SetWindowText(tempname);
		int indextemp1=pingweizu.GetCurSel();
		if (indextemp1!=LB_ERR){
		CString	sql="select top 1 * from fenshu where suoshuxuanshou ="+tempname+" and pingweizu='"+pingwei1[indextemp1]+"'";
	db.datasearcher(sql);
	if(!db.getrs()->adoeof){
		fenshu[0]=db.getrs()->GetFields()->GetItem("pingwei1")->GetValue();
		fenshu[1]=db.getrs()->GetFields()->GetItem("pingwei2")->GetValue();
		fenshu[2]=db.getrs()->GetFields()->GetItem("pingwei3")->GetValue();
		fenshu[3]=db.getrs()->GetFields()->GetItem("pingwei4")->GetValue();
		fenshu[4]=db.getrs()->GetFields()->GetItem("pingwei5")->GetValue();
		fenshu[5]=db.getrs()->GetFields()->GetItem("pingwei6")->GetValue();
		fenshu[6]=db.getrs()->GetFields()->GetItem("pingwei7")->GetValue();
		fenshu[7]=db.getrs()->GetFields()->GetItem("pingwei8")->GetValue();
		fenshu[8]=db.getrs()->GetFields()->GetItem("pingwei9")->GetValue();
		fenshu[9]=db.getrs()->GetFields()->GetItem("pingwei10")->GetValue();
		fenshu[10]=db.getrs()->GetFields()->GetItem("pingwei11")->GetValue();
		fenshu[11]=db.getrs()->GetFields()->GetItem("pingwei12")->GetValue();
		fenshu[12]=db.getrs()->GetFields()->GetItem("pingwei13")->GetValue();
		fenshu[13]=db.getrs()->GetFields()->GetItem("pingwei14")->GetValue();
		fenshu[14]=db.getrs()->GetFields()->GetItem("pingwei15")->GetValue();
		fenshu[15]=db.getrs()->GetFields()->GetItem("pingwei16")->GetValue();
		fenshu[16]=db.getrs()->GetFields()->GetItem("pingwei17")->GetValue();
		fenshu[17]=db.getrs()->GetFields()->GetItem("pingwei18")->GetValue();
		fenshu[18]=db.getrs()->GetFields()->GetItem("pingwei19")->GetValue();
		fenshu[19]=db.getrs()->GetFields()->GetItem("pingwei20")->GetValue();
		fenshu[20]=db.getrs()->GetFields()->GetItem("pingwei21")->GetValue();
		fenshu[21]=db.getrs()->GetFields()->GetItem("pingwei22")->GetValue();
		fenshu[22]=db.getrs()->GetFields()->GetItem("pingwei23")->GetValue();
		fenshu[23]=db.getrs()->GetFields()->GetItem("pingwei24")->GetValue();
		fenshu[24]=db.getrs()->GetFields()->GetItem("pingwei25")->GetValue();
		fenshu[25]=db.getrs()->GetFields()->GetItem("pingwei26")->GetValue();
		fenshu[26]=db.getrs()->GetFields()->GetItem("pingwei27")->GetValue();
		fenshu[27]=db.getrs()->GetFields()->GetItem("pingwei28")->GetValue();
		fenshu[28]=db.getrs()->GetFields()->GetItem("pingwei29")->GetValue();
		fenshu[29]=db.getrs()->GetFields()->GetItem("pingwei30")->GetValue();
	
		
	}
	else{
		for(int i=0;i<30;i++) {
			fenshu[i]=0;
			pingweiming[i]="";
		}
	 
	}
	
		CString saishixuhaot=_variant_t(saishixuhao);
		sql="select * from pingwei where suoshusaishi ="+saishixuhaot+" and suoshupingweizu='"+pingwei1[indextemp1]+"'";
		db.datasearcher(sql);
		int i=0;
		while(!db.getrs()->adoeof){
			bool txianshi=db.getrs()->GetFields()->GetItem("xianshi")->GetValue();
			if(txianshi){

⌨️ 快捷键说明

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