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

📄 fuzhu.cpp

📁 大学田径运动会管理系统
💻 CPP
📖 第 1 页 / 共 5 页
字号:
}

void __fastcall TYuange_SR::open(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
open();
        //TODO: Add your source code here
}

void __fastcall TYuange_SR::dropsrtable(int type)
{
m_sql="drop table "+m_table_name;
if(!m_table_name.Trim().IsEmpty()){
  exe(m_sql);
  m_table_name="";
}else{m_table_name="";}       //TODO: Add your source code here
}
void __fastcall TYuange_SR::selectydy(int type )
{
parsestr(list_lbfz,&list_temp,':');
if(type==1)
m_sql="insert  "+m_table_name+" select * from cjb where LBBH='"+list_temp->Strings[0].Trim()+"' and \
       FZBH='"+list_temp->Strings[1].Trim()+"' and BSFS="+IntToStr(curbsfs)+" and XMBH='"+list_xmbh+"' and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"' and XZH="+cur_xzh;
if(type==10)
m_sql="insert  "+m_table_name+" select a.XMBH ,a.YDYBH ,a.BSFS	,a.XZH ,a.PDH	,a.LBBH ,a.FZBH ,a.CJ ,a.DF	,a.MC ,a.PJLBZ ,a.PJLDF	,a.XZMC ,a.CJBZ ,a.DXBH 	,a.JJBZ ,a.JLBZ ,a.BLBZ from jlb a,cjb b where a.LBBH='"+list_temp->Strings[0].Trim()+"' and \
       a.FZBH='"+list_temp->Strings[1].Trim()+"' and a.BSFS="+IntToStr(curbsfs)+" and a.XMBH='"+list_xmbh+"' and \
       a.DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"' and a.XZH="+cur_xzh+" and \
       a.YDYBH=b.YDYBH and a.LBBH=b.LBBH and a.FZBH=b.FZBH and a.XMBH=b.XMBH and a.BSFS=b.BSFS ";
exe(m_sql);
        //TODO: Add your source code here
}

void __fastcall TYuange_SR::setcj(AnsiString ydybh, AnsiString cj, AnsiString bz, int pjldf,int pjlindex)
{
 if(pjldf==0){
   m_sql="update "+m_table_name+" set CJ="+cj+",PJLBZ='0',PJLDF=0,CJBZ='"+bz+"' where YDYBH='"+ydybh+"'";
 }
 else{
   m_sql="update "+m_table_name+" set CJ="+cj+",PJLBZ='"+pjlindex+"',PJLDF="+IntToStr(pjldf)+",CJBZ='"+bz+"' where YDYBH='"+ydybh+"'";
 }        //TODO: Add your source code here
exe(m_sql);
}

void TYuange_SR::setbszt(int zt)
{
  index=curbsfs*10+zt;
  parsestr(list_mcbszt,&list_temp,';'); //TODO: Add your source code here
  list_temp->Strings[curbsfs-1]=IntToStr(index);
  list_str(list_mcbszt,list_temp,";");
  parsestr(list_lbfz,&list_temp,':');
  m_sql="update xmb set MCBSZT='"+list_mcbszt+"' where XMBH='"+list_xmbh+"' and LBBH='"+list_temp->Strings[0].Trim()+"' and FZBH='"+list_temp->Strings[1].Trim()+"'";
  exe(m_sql);
 if(StrToInt(list_xmgs)>1){
    if(zxm_index<list_zxmgs->Count){
     parsestr(list_ppzxmzt,&list_temp,';');
     list_temp->Strings[zxm_index]=curbsfs*10+zt;
     list_str(list_ppzxmzt,list_temp,";");
     parsestr(list_lbfz,&list_temp,':');
     m_sql="update qnxmsz set DXXMZT='"+list_ppzxmzt+"' where XMBH='"+list_xmbh+"' and LBBH='"+list_temp->Strings[0].Trim()+"' and FZBH='"+list_temp->Strings[1].Trim()+"'";
     exe(m_sql);
     }
   }  
}

void __fastcall TYuange_SR::updatecj(int type)
{
int xmxj=StrToInt(list_xmgs);  //>1 是全能
if(m_table_name.IsEmpty())return;
if(xmxj<=1)
m_sql="update cjb set cjb.XZMC=a.XZMC,cjb.CJ=a.CJ,cjb.PJLBZ=a.PJLBZ,cjb.PJLDF=a.PJLDF,cjb.CJBZ=a.CJBZ from "+m_table_name+" a where cjb.YDYBH=a.YDYBH \
       and cjb.BSFS=a.BSFS and a.FZBH=cjb.FZBH and a.LBBH=cjb.LBBH and a.BSFS=cjb.BSFS and cjb.XMBH=a.XMBH and cjb.dxbh=a.dxbh";
  else
m_sql="update jlb set jlb.XZMC=a.XZMC,jlb.CJ=a.CJ,jlb.PJLBZ=a.PJLBZ,jlb.PJLDF=a.PJLDF,jlb.jlbZ=a.jlbZ from "+m_table_name+" a where jlb.YDYBH=a.YDYBH \
       and jlb.BSFS=a.BSFS and a.FZBH=jlb.FZBH and a.LBBH=jlb.LBBH and a.BSFS=jlb.BSFS and jlb.XMBH=a.XMBH and jlb.DXBH=a.DXBH";

exe(m_sql);
        //TODO: Add your source code here
}
void __fastcall TYuange_SR::getnewsinfo()
{
m_sql="select MCBSZT from xmb where XMBH='"+list_xmbh+"' and  FZBH='"+list_fzbh+"' and LBBH='"+list_lbbh+"'";
open(m_sql);
list_mcbszt=m_query->Fields->FieldByName("MCBSZT")->AsString.Trim();
        //TODO: Add your source code here
}
//
bool __fastcall TYuange_JL::validebsfs(int bsfs)
{
if(StrToInt(list_xmgs)>1)return true; 
curbsfs=bsfs+1;
temp_str=list_mcbszt;
parsestr(temp_str,&list_temp,';');
if(bsfs>=list_temp->Count)return false;
temp_str=list_temp->Strings[bsfs].Trim();
index=StrToInt(temp_str);
i=(bsfs+1)*10;
if(index>=i+2)return false;
return true;
        //TODO: Add your source code here
}

void __fastcall TYuange_JL::createsrtable(int type)
{
dropsrtable(type);
m_table_name=this->getrandomtable();
m_sql="CREATE TABLE "+m_table_name+"( \
	XMBH char (20)  ,\
	YDYBH char (10)  ,\
	BSFS int ,        \
	XZH int  , \
	PDH int ,      \
	LBBH char (10)  ,\
	FZBH char (10)  ,\
	CJ numeric(18, 0) NULL ,\
	DF numeric(18, 2)  , \
	MC int ,  \
	PJLBZ char (20) ,\
	PJLDF numeric(18, 2)  ,\
	XZMC  int  ,  \
	CJBZ char (20) , \
	DXBH char (20), \
        JJBZ int,  \
        JLBZ int,  \
        BLBZ int  \
) ";
exe(m_sql);
        //TODO: Add your source code here
}

void TYuange_JL::close()
{
 this->m_con->Connected=false;        //TODO: Add your source code here
 this->m_query->Active=false;
}
void TYuange_JL::open()
{
 this->m_con->Connected=true;        //TODO: Add your source code here
 this->m_query->Active=true;
        //TODO: Add your source code here
}
void __fastcall TYuange_JL::exe(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
m_con->Connected=true;
m_query->ExecSQL();
close();
        //TODO: Add your source code here
}

void __fastcall TYuange_JL::open(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
open();
        //TODO: Add your source code here
}

void __fastcall TYuange_JL::dropsrtable(int type)
{
m_sql="drop table "+m_table_name;
if(!m_table_name.Trim().IsEmpty()){
  exe(m_sql);
  m_table_name="";
}else{m_table_name="";}       //TODO: Add your source code here
}
void __fastcall TYuange_JL::selectydy(int type )
{
//parsestr(list_lbfz,&list_temp,':');
if(curbsfs==1){ //从运动员表中检录的;
m_sql="insert "+m_table_name+" select * from jlb where LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
m_sql="delete from "+m_table_name+" where EXISTS (select * from cjb b where  "+m_table_name+".YDYBH=b.YDYBH and b.BSFS=1 and "+m_table_name+".XMBH=b.XMBH and "+m_table_name+".FZBH=b.FZBH and "+m_table_name+".LBBH=b.LBBH and "+m_table_name+".DXBH=b.DXBH) ";;
exe(m_sql);
m_sql="insert "+m_table_name+" select * from cjb where LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS=1 and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
}
else  //从成绩表中看的。。。。
{
m_sql="insert "+m_table_name+" select * from cjb where  LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS="+IntToStr(curbsfs-1)+" and JJBZ=1 and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
m_sql="delete from "+m_table_name+" where EXISTS (select * from cjb b where  "+m_table_name+".YDYBH=b.YDYBH and b.BSFS="+IntToStr(curbsfs)+" and "+m_table_name+".XMBH=b.XMBH and "+m_table_name+".FZBH=b.FZBH and "+m_table_name+".LBBH=b.LBBH and "+m_table_name+".DXBH=b.DXBH) ";;
exe(m_sql);
m_sql="update "+m_table_name+" set JLBZ=0";
exe(m_sql);
m_sql="insert "+m_table_name+" select * from cjb where LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS="+IntToStr(curbsfs)+" and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
}
m_sql="update "+m_table_name+" set JJBZ=0,BLBZ=0,PJLBZ=0,CJBZ='正常',CJ=0,DF=0,MC=555,PJLDF=0,XZMC=555,BSFS="+IntToStr(curbsfs);
exe(m_sql);
        //TODO: Add your source code here
}

void __fastcall TYuange_JL::setxzhpdh(AnsiString ydybh, int xzh, int pdh)
{
m_sql="update "+m_table_name+" set XZH="+IntToStr(xzh)+",PDH="+IntToStr(pdh)+" where YDYBH='"+ydybh+"'";
exe(m_sql);
}

void TYuange_JL::setbszt(int zt)
{
int i;
int index;
AnsiString szzt;
index=StrToInt(list_xmgs);
if(index>1){
   index=curbsfs*10+zt;
   list_temp->Clear();
   for(i=0;i<index;i++)list_temp->Add(IntToStr(index));
   list_str(temp_str,list_temp,";");
   m_sql="update qnxmsz set DXXMZT='"+temp_str+"' where XMBH='"+list_xmbh+"'";
   exe(m_sql);
  }
  index=curbsfs*10+zt;
  parsestr(list_mcbszt,&list_temp,';'); //TODO: Add your source code here
  list_temp->Strings[curbsfs-1]=IntToStr(index);
  list_str(list_mcbszt,list_temp,";");
  parsestr(list_lbfz,&list_temp,':');
  m_sql="update xmb set MCBSZT='"+list_mcbszt+"' where XMBH='"+list_xmbh+"' and LBBH='"+list_temp->Strings[0].Trim()+"' and FZBH='"+list_temp->Strings[1].Trim()+"'";
  exe(m_sql);
}

void __fastcall TYuange_JL::updatejl(int type)
{
if(m_table_name.IsEmpty())return;
m_sql="delete from cjb  where  LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS="+IntToStr(curbsfs)+" and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
m_sql="insert cjb select * from "+m_table_name+" where JLBZ=1";
exe(m_sql);
 m_sql="update cjb set CJBZ='正常' where LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS="+IntToStr(curbsfs)+" and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
exe(m_sql);
if(StrToInt(list_xmgs)>1){
m_sql="update jlb set CJBZ='正常' where LBBH='"+list_lbbh+ "' and FZBH='"+list_fzbh+"' and XMBH='"+list_xmbh+"' and BSFS="+IntToStr(curbsfs);
exe(m_sql);
}
        //TODO: Add your source code here
}
void __fastcall TYuange_JL::getnewsinfo()
{
m_sql="select MCBSZT from xmb where XMBH='"+list_xmbh+"' and  FZBH='"+list_fzbh+"' and LBBH='"+list_lbbh+"'";
open(m_sql);
list_mcbszt=m_query->Fields->FieldByName("MCBSZT")->AsString.Trim();
        //TODO: Add your source code here
}
void __fastcall TYuange_JL::setydyzt(AnsiString m_ydybh,int index)
{
if(m_ydybh.Trim().IsEmpty()){
 return ;
 }
m_sql="update "+m_table_name+" set JLBZ="+IntToStr(index)+" where YDYBH='"+m_ydybh+"'";
exe(m_sql); 
        //TODO: Add your source code here
}///

bool __fastcall TYuange_CL::validebsfs(int bsfs)
{
 int index;
curbsfs=bsfs+1;
if(StrToInt(list_xmgs)>1&&zxm_index!=StrToInt(list_xmgs)){
    parsestr(list_ppzxmzt,&list_temp,';');
    temp_str=list_temp->Strings[zxm_index].Trim();
    index=StrToInt(temp_str);
    i=(bsfs+1)*10;
    if(index<i+4)return false;
    if(index==i+6)shifoukaishichuli=0;else shifoukaishichuli=1;
    return true;
}
temp_str=list_mcbszt;
parsestr(temp_str,&list_temp,';');
if(bsfs>=list_temp->Count)return false;
temp_str=list_temp->Strings[bsfs].Trim();
index=StrToInt(temp_str);
i=(bsfs+1)*10;
if(index<i+4)return false;
if(index==i+6)shifoukaishichuli=0;else shifoukaishichuli=1;
return true;
        //TODO: Add your source code here
}

void __fastcall TYuange_CL::createsrtable(int type)
{
dropsrtable(type);
m_table_name=this->getrandomtable();
m_sql="CREATE TABLE "+m_table_name+"( \
	XMBH char (20)  ,\
	YDYBH char (10)  ,\
	BSFS int ,        \
	XZH int  , \
	PDH int ,      \
	LBBH char (10)  ,\
	FZBH char (10)  ,\
	CJ numeric(18, 0) NULL ,\
	DF numeric(18, 2)  , \
	MC int ,  \
	PJLBZ char (20) ,\
	PJLDF numeric(18, 2)  ,\
	XZMC  int  ,  \
	CJBZ char (20) , \
	DXBH char (20), \
        JJBZ int,  \
        JLBZ int,  \
        BLBZ int  \
) ";
exe(m_sql);
        //TODO: Add your source code here
}

void TYuange_CL::close()
{
 this->m_con->Connected=false;        //TODO: Add your source code here
 this->m_query->Active=false;
}
void TYuange_CL::open()
{
 this->m_con->Connected=true;        //TODO: Add your source code here
 this->m_query->Active=true;
        //TODO: Add your source code here
}
void __fastcall TYuange_CL::exe(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
m_con->Connected=true;
m_query->ExecSQL();
close();
        //TODO: Add your source code here
}

void __fastcall TYuange_CL::open(AnsiString sql)
{
close();
m_query->SQL->Clear();
m_query->SQL->Add(sql);
open();
        //TODO: Add your source code here
}

void __fastcall TYuange_CL::dropsrtable(int type)
{
m_sql="drop table "+m_table_name;
if(!m_table_name.Trim().IsEmpty()){
  exe(m_sql);
  m_table_name="";
}else{m_table_name="";}       //TODO: Add your source code here
}
void __fastcall TYuange_CL::selectydy(int type )
{
parsestr(list_lbfz,&list_temp,':');
if(type==1)
m_sql="insert  "+m_table_name+" select * from cjb where LBBH='"+list_temp->Strings[0].Trim()+"' and \
       FZBH='"+list_temp->Strings[1].Trim()+"' and BSFS="+IntToStr(curbsfs)+" and XMBH='"+list_xmbh+"' and DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'";
if(type==10)
m_sql="insert  "+m_table_name+" select a.XMBH ,a.YDYBH ,a.BSFS	,a.XZH ,a.PDH	,a.LBBH ,a.FZBH ,a.CJ ,a.DF,a.MC ,a.PJLBZ ,a.PJLDF,a.XZMC ,a.CJBZ ,a.DXBH ,a.JJBZ ,a.JLBZ ,a.BLBZ from jlb a,cjb b where a.LBBH='"+list_temp->Strings[0].Trim()+"' and \
       a.FZBH='"+list_temp->Strings[1].Trim()+"' and a.BSFS="+IntToStr(curbsfs)+" and a.XMBH='"+list_xmbh+"' and \
       a.DXBH='"+list_zxmbh->Strings[zxm_index].Trim()+"'  and \
       a.YDYBH=b.YDYBH and a.LBBH=b.LBBH and a.FZBH=b.FZBH and a.XMBH=b.XMBH and a.BSFS=b.BSFS ";

exe(m_sql);       
        //TODO: Add your source code here
}

void __fastcall TYuange_CL::setcj(AnsiString ydybh, AnsiString cj, AnsiString bz, int pjldf)
{
 if(pjldf==0){
   m_sql="update "+m_table_name+" set CJ="+cj+",PJLBZ='',PJLDF=0,CJBZ='"+bz+"' where YDYBH='"+ydybh+"'";
 }
 else{
   m_sql="update "+m_table_name+" set CJ="+cj+",PJLBZ='"+bz+"',PJLDF="+IntToStr(pjldf)+",CJBZ='"+bz+"' where YDYBH='"+ydybh+"'";
 }        //TODO: Add your source code here
exe(m_sql);
}

void TYuange_CL::setbszt(int zt)
{     int index;

  index=curbsfs*10+zt;
  parsestr(list_mcbszt,&list_temp,';'); //TODO: Add your source code here
  list_temp->Strings[curbsfs-1]=IntToStr(index);

⌨️ 快捷键说明

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