📄 bisai.cpp
字号:
// bisai.cpp : 实现文件
//
#include "stdafx.h"
#include "计分程序 by WS.h"
#include "bisai.h"
#include ".\bisai.h"
// bisai 对话框
IMPLEMENT_DYNAMIC(bisai, CDialog)
bisai::bisai(CWnd* pParent /*=NULL*/)
: CDialog(bisai::IDD, pParent)
, pingweirenshu1(0)
, pingweirenshu2(0)
, pingweirenshu3(0)
, caisaixiangmunum(0)
{
}
bisai::~bisai()
{
db.databaseclose();
db1.databaseclose();
}
void bisai::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT15, shanchufen);
DDX_Control(pDX, IDC_EDIT16, caisaixiangmu);
DDX_Control(pDX, IDC_STATIC_zhuangtai, zhuangtai);
DDX_Control(pDX, IDC_EDIT1, saishimingcheng);
DDX_Control(pDX, IDC_EDIT2, saishiriqi);
DDX_Control(pDX, IDC_EDIT3, saishididian);
DDX_Control(pDX, IDC_EDIT4, pingwei1);
DDX_Control(pDX, IDC_EDIT5, pingwei1bili);
DDX_Control(pDX, IDC_EDIT7, pingwei2);
DDX_Control(pDX, IDC_EDIT8, pingwei2bili);
DDX_Control(pDX, IDC_EDIT10, pingwei3);
DDX_Control(pDX, IDC_EDIT11, pingwei3bili);
DDX_Control(pDX, IDC_EDIT6, pingwei1renshu);
DDX_Control(pDX, IDC_EDIT9, pingwei2renshu);
DDX_Control(pDX, IDC_EDIT12, pingwei3renshu);
DDX_Control(pDX, IDC_EDIT14, saishixuhao);
DDX_Control(pDX, IDC_LIST1, saishi);
DDX_Text(pDX, IDC_EDIT6, pingweirenshu1);
DDX_Text(pDX, IDC_EDIT9, pingweirenshu2);
DDX_Text(pDX, IDC_EDIT12, pingweirenshu3);
DDX_Text(pDX, IDC_EDIT16, caisaixiangmunum);
}
BEGIN_MESSAGE_MAP(bisai, CDialog)
ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
END_MESSAGE_MAP()
// bisai 消息处理程序
void bisai::OnLbnSelchangeList1()
{
// TODO: 在此添加控件通知处理程序代码
CString tempname,xuhaotemp;
int tempindex = saishi.GetCurSel();
if (tempindex!=LB_ERR){
saishi.GetText(tempindex,tempname);
}
CString sql="select * from saishi where mingcheng='"+tempname+"'";
db.datasearcher(sql);
if(!db.getrs()->adoeof){
CString tsql,tempname1;
tempname=db.getrs()->GetFields()->GetItem("xuhao")->GetValue();
saishixuhao.SetWindowText(tempname);
saishixuhao.GetWindowText(tempname1);
tempname=db.getrs()->GetFields()->GetItem("mingcheng")->GetValue();
saishimingcheng.SetWindowText(tempname);
tempname=db.getrs()->GetFields()->GetItem("riqi")->GetValue();
saishiriqi.SetWindowText(tempname);
tempname=db.getrs()->GetFields()->GetItem("didian")->GetValue();
saishididian.SetWindowText(tempname);
tempname=db.getrs()->GetFields()->GetItem("pingwei1")->GetValue();
pingwei1.SetWindowText(tempname);
tsql="select * from pingwei where suoshusaishi = "+tempname1+" and suoshupingweizu='"+tempname+"'";
pingweirenshu1 = db1.getrscount(tsql);
UpdateData(0);
db.getrs()->GetFields()->GetItem("pingwei1renshu")->PutValue(pingweirenshu1);
db.getrs()->Update();
tempname=db.getrs()->GetFields()->GetItem("pingwei1bili")->GetValue();
pingwei1bili.SetWindowText(tempname);
tempname=db.getrs()->GetFields()->GetItem("pingwei2")->GetValue();
pingwei2.SetWindowText(tempname);
tsql="select * from pingwei where suoshusaishi = "+tempname1+" and suoshupingweizu='"+tempname+"'";
pingweirenshu2 = db1.getrscount(tsql);
UpdateData(0);
db.getrs()->GetFields()->GetItem("pingwei2renshu")->PutValue(pingweirenshu2);
db.getrs()->Update();
tempname=db.getrs()->GetFields()->GetItem("pingwei2bili")->GetValue();
pingwei2bili.SetWindowText(tempname);
tempname=db.getrs()->GetFields()->GetItem("pingwei3")->GetValue();
pingwei3.SetWindowText(tempname);
tsql="select * from pingwei where suoshusaishi = "+tempname1+" and suoshupingweizu='"+tempname+"'";
pingweirenshu3 = db1.getrscount(tsql);
UpdateData(0);
db.getrs()->GetFields()->GetItem("pingwei3renshu")->PutValue(pingweirenshu3);
db.getrs()->Update();
tempname=db.getrs()->GetFields()->GetItem("pingwei3bili")->GetValue();
pingwei3bili.SetWindowText(tempname);
tsql="select * from xuanshou where suoshusaishi = "+tempname1+"";
caisaixiangmunum = db1.getrscount(tsql);
UpdateData(0);
db.getrs()->GetFields()->GetItem("xiangmushu")->PutValue(caisaixiangmunum);
db.getrs()->Update();
tempname=db.getrs()->GetFields()->GetItem("shanchufenshu")->GetValue();
shanchufen.SetWindowText(tempname);
zhuangtai.SetWindowText("成功读取记录");
}
}
BOOL bisai::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
db1.databaseconn();
db.databaseconn();
db.datasearcher();
if(!db.getrs()->adoeof){
CString tempsaishi;
while(!db.getrs()->adoeof){
tempsaishi=db.getrs()->GetFields()->GetItem("mingcheng")->GetValue();
saishi.AddString(tempsaishi);
db.getrs()->MoveNext();
}
}
else{
CString names;
names="暂时无记录";
saishi.AddString(names);
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void bisai::OnOK()
{
// TODO: 在此添加专用代码和/或调用基类
}
void bisai::OnBnClickedButton4()
{
// TODO: 在此添加控件通知处理程序代码
CString tempname1;
CString sql="select top 1 * from dangqiansaishi";
db.datasearcher(sql);
if(db.getrs()->adoeof){db.getrs()->AddNew();}
saishixuhao.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("saishixuhao")->PutValue(_variant_t(tempname1));
saishimingcheng.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("mingcheng")->PutValue(_variant_t(tempname1));
saishididian.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("didian")->PutValue(_variant_t(tempname1));
saishiriqi.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("riqi")->PutValue(_variant_t(tempname1));
pingwei1.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei1")->PutValue(_variant_t(tempname1));
pingwei1renshu.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei1renshu")->PutValue(_variant_t(tempname1));
pingwei1bili.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei1bili")->PutValue(_variant_t(tempname1));
pingwei2.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei2")->PutValue(_variant_t(tempname1));
pingwei2renshu.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei2renshu")->PutValue(_variant_t(tempname1));
pingwei2bili.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei2bili")->PutValue(_variant_t(tempname1));
pingwei3bili.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei3bili")->PutValue(_variant_t(tempname1));
pingwei3.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei3")->PutValue(_variant_t(tempname1));
pingwei3renshu.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("pingwei3renshu")->PutValue(_variant_t(tempname1));
shanchufen.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("shanchufenshu")->PutValue(_variant_t(tempname1));
caisaixiangmu.GetWindowText(tempname1);
db.getrs()->GetFields()->GetItem("xiangmushu")->PutValue(_variant_t(tempname1));
db.getrs()->Update();
zhuangtai.SetWindowText("当前比赛设定成功");
}
void bisai::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
CString tempname;
saishixuhao.GetWindowText(tempname);
if (tempname!=""){
CString sql="select * from chengji where suoshusaishi="+tempname+"";
db.datasearcher(sql);
if (!db.getrs()->adoeof){
while (!db.getrs()->adoeof){
db.getrs()->Delete(adAffectCurrent);
db.getrs()->MoveNext();
}
}
sql="select * from fenshu where suoshusaishi="+tempname+"";
db.datasearcher(sql);
if (!db.getrs()->adoeof){
while (!db.getrs()->adoeof){
db.getrs()->Delete(adAffectCurrent);
db.getrs()->MoveNext();
}
}
zhuangtai.SetWindowText("所有分数信息已清除");
}
else{
zhuangtai.SetWindowText("请选择赛事");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -