?? zu.cpp
字號:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include "zu.h"
#include "tjse.h"
#include "rkb.h"
#include "gdk.h"
#include <stdlib.h>
#include "CXKB.h"
#include "kcsz.h"
#include "About.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::X1Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormCloseQuery(TObject *Sender, bool &CanClose)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::N4Click(TObject *Sender)
{
char *ssd;
char xxxq[]="新學校的99學年第一學期";
ssd=new char[250];
Set<TMsgDlgBtn,0,8>temp_set;
temp_set<<mbYes<<mbNo;
sprintf(ssd," 你是否真的要刪除(%s)\n的任課檔案、教師檔案、班級檔案?",xxxq);
switch(MessageBox(Handle,ssd,"學校辦公系統——排課系統",MB_YESNOCANCEL | MB_ICONQUESTION))
{
case mrNo:
break;
case mrYes:
//要刪除記錄
Table2->Active = false;
Table3->Active = false;
Form3->Table1->Active = false;
Form4->Table1->Active = false;
Form4->Table2->Active = false;
Table1->Active = false; // 復制教師空表
Table1->FieldDefs->Clear();
Table1->IndexDefs->Clear();
Table1->Filter="";
Table1->TableName= "tjs.dbf";
Table1->IndexFieldNames="";
Table1->IndexName="";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "tjsa.dbf";
Table1->CreateTable();
Table1->Active = true;
Table1->AppendRecord(ARRAYOFCONST((1)));
Table1->Active = false; // 復制教師代課空表
Table1->TableName= "dk.dbf";
Table1->IndexName="";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "dka.dbf";
Table1->CreateTable();
Table1->Active = false; // 復制教師調課空表
Table1->TableName= "lsdk.dbf";
Table1->IndexName="";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "lsdka.dbf";
Table1->CreateTable();
Table1->Active = false; // 復制總課表空表
Table1->TableName= "zkb.dbf";
Table1->IndexName="BJMC";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "zkba.dbf";
Table1->CreateTable();
Table1->Active = false; // 復制課時數空表
Table1->TableName= "kss.dbf";
Table1->IndexName="KCMC";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "kssa.dbf";
Table1->CreateTable();
Table1->Active = false; // 復制班級空表
Table1->TableName= "bj.dbf";
Table1->IndexName="BJHM";
Table1->Active = true;
Table1->Active = false; //
Table1->TableType = ttFoxPro;
Table1->TableName= "bja.dbf";
Table1->CreateTable();
P2->Enabled=true;
R1->Enabled=true;
B1->Enabled=true;
T1->Enabled=true;
K1->Enabled=true;
R2->Enabled=true;
N7->Enabled=true;
N12->Enabled=false;
S2->Enabled=false;
P3->Enabled=false;
ShowMessage("新學校各種數據初始化結束");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::O1Click(TObject *Sender)
{
B1->Enabled=true;
T1->Enabled=true;
K1->Enabled=true;
R2->Enabled=true;
N12->Enabled=true;
B3->Enabled=true;
S2->Enabled=true;
P3->Enabled=true;
P2->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::B1Click(TObject *Sender)
{
Table1->Active = false;
Table1->TableName="bja.dbf";
Table1->IndexName="BJHM";
Table1->TableType =ttFoxPro;
Table1->Active = true;
DBGrid1->Visible=true;
Button1->Visible=true;
Button2->Visible=true;
Button3->Visible=true;
Label1->Visible=true;
Label2->Visible=true;
Edit1->Visible=true;
ComboBox1->Visible=true;
UpDown1->Visible=true;
F1->Enabled=false;
P2->Enabled=false;
P3->Enabled=false;
S2->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
Table1->Active = false;
DBGrid1->Visible=false;
Button1->Visible=false;
Button2->Visible=false;
Button3->Visible=false;
Label1->Visible=false;
Label2->Visible=false;
Edit1->Visible=false;
ComboBox1->Visible=false;
UpDown1->Visible=false;
F1->Enabled=true;
P2->Enabled=true;
P3->Enabled=true;
S2->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
int bh;
char *mc;
mc=new char[19];
strcpy(mc,ComboBox1->Text.c_str());
strcat(mc,"(");
strcat(mc,Edit1->Text.c_str());
strcat(mc,")班");
if(ComboBox1->ItemIndex<0)
bh=ComboBox1->ItemIndex*100+1200;
else
bh=ComboBox1->ItemIndex*100+1100;
bh=bh+Edit1->Text.ToIntDef(1);
if(Table1->FindKey(ARRAYOFCONST((bh)))){
char *tmp;
tmp=new char[100];
strcpy(tmp,mc);
strcat(tmp,"的數據已經建立。");
ShowMessage(tmp);
delete tmp;
}
else {
Table1->AppendRecord(ARRAYOFCONST((bh,mc)));
Table3->Active = true;
Table3->AppendRecord(ARRAYOFCONST((mc)));
Table2->Active = false; // 復制課時數空表
Table2->FieldDefs->Clear();
Table2->IndexDefs->Clear();
Table2->Filter="";
Table2->TableName= "kss.dbf";
Table2->IndexName="KCMC";
Table2->Active = true;
Table2->Active = false; // "
Table2->TableType = ttFoxPro;
strcpy(mc,"kssa");
strcat(mc,Table1->FieldByName("BJHM")->AsString.c_str());
strcat(mc,".dbf");
Table2->TableName= mc;
Table2->CreateTable();
}
delete mc;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button3Click(TObject *Sender)
{
Table1->Delete();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::T1Click(TObject *Sender)
{
Table2->Active = false;
Table2->TableName= "kcm.dbf";
Table2->IndexName="";
Table2->Active = true;
// Table2->First();
Form3->DBComboBox1->Items->Clear();
while(!Table2->Eof){
Form3->DBComboBox1->Items->Add(Table2->FieldByName("KCMC")->AsString);
Table2->Next();
};
Form3->DBComboBox2->Items=Form3->DBComboBox1->Items;
Form3->DBComboBox3->Items=Form3->DBComboBox1->Items;
Form3->DBComboBox4->Items=Form3->DBComboBox1->Items;
Form3->DBComboBox5->Items=Form3->DBComboBox1->Items;
Form3->DBComboBox6->Items=Form3->DBComboBox1->Items;
Form3->Table1->Filter="";
Form3->Table1->Active = true;
Form3->Table1->First();
Form3->Show();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::R2Click(TObject *Sender)
{
char pyu[]="BZR = true";
Form3->Table1->Filter=pyu;
Form3->Table1->Active = true;
Form3->Table1->First();
Form4->ComboBox25->Items->Clear();
while(!Form3->Table1->Eof){
Form4->ComboBox25->Items->Add(Form3->Table1->FieldByName("TXM")->AsString);
Form3->Table1->Next();
};
Form3->Table1->Active = false;
Form3->Table1->Filter="";
Form3->Table1->Active = true;
Form3->Table1->First();
Table2->Active = false;
Table2->TableName= "kcm.dbf";
Table2->IndexName="";
Table2->Active = true;
Form4->Table1->Active = true;
char *uy7;
uy7=new char[30];
strcpy(uy7,"KSSA");
strcat(uy7,Form4->Table1->FieldByName("BJHM")->AsString.c_str());
strcat(uy7,".DBF");
Form4->Table2->TableName= uy7;
Form4->Table2->IndexName="KCMC";
Form4->Table2->Active = true;
Form4->ComboBox25->Text=Form4->Table1->FieldByName("BZR")->AsString;
if(!Table2->Eof){
Form4->Label1->Caption=Table2->FieldByName("KCMC")->AsString;
Form4->Label1->Visible=true;
Form4->Edit1->Visible=true;
Form4->ComboBox1->Visible=true;
Js(Table2->FieldByName("KCMC")->AsString.c_str());
Form4->ComboBox1->Items=Form4->ComboBox24->Items;
if(Form4->Table2->FindKey(ARRAYOFCONST((Table2->FieldByName("KCMC")->AsString)))){
Form4->Edit1->Text=Form4->Table2->FieldByName("KSS")->AsString;
Form4->ComboBox1->Text=Form4->Table2->FieldByName("TXM")->AsString;
Form4->ComboBox1->Enabled=true;
}
else{
Form4->Edit1->Text="";
Form4->ComboBox1->Text="";
Form4->ComboBox1->Enabled=false;
}
Table2->Next();
}
if(!Table2->Eof){
Form4->Label2->Caption=Table2->FieldByName("KCMC")->AsString;
Form4->Label2->Visible=true;
Form4->Edit2->Visible=true;
Form4->ComboBox2->Visible=true;
Js(Table2->FieldByName("KCMC")->AsString.c_str());
Form4->ComboBox2->Items=Form4->ComboBox24->Items;
if(Form4->Table2->FindKey(ARRAYOFCONST((Table2->FieldByName("KCMC")->AsString)))){
Form4->Edit2->Text=Form4->Table2->FieldByName("KSS")->AsString;
Form4->ComboBox2->Text=Form4->Table2->FieldByName("TXM")->AsString;
Form4->ComboBox2->Enabled=true;
}
else{
Form4->Edit2->Text="";
Form4->ComboBox2->Text="";
Form4->ComboBox2->Enabled=false;
}
Table2->Next();
}
if(!Table2->Eof){
Form4->Label3->Caption=Table2->FieldByName("KCMC")->AsString;
Form4->Label3->Visible=true;
Form4->Edit3->Visible=true;
Form4->ComboBox3->Visible=true;
Js(Table2->FieldByName("KCMC")->AsString.c_str());
Form4->ComboBox3->Items=Form4->ComboBox24->Items;
if(Form4->Table2->FindKey(ARRAYOFCONST((Table2->FieldByName("KCMC")->AsString)))){
Form4->Edit3->Text=Form4->Table2->FieldByName("KSS")->AsString;
Form4->ComboBox3->Text=Form4->Table2->FieldByName("TXM")->AsString;
Form4->ComboBox3->Enabled=true;
}
else{
Form4->Edit3->Text="";
Form4->ComboBox3->Text="";
Form4->ComboBox3->Enabled=false;
}
Table2->Next();
}
if(!Table2->Eof){
Form4->Label4->Caption=Table2->FieldByName("KCMC")->AsString;
Form4->Label4->Visible=true;
Form4->Edit4->Visible=true;
Form4->ComboBox4->Visible=true;
Js(Table2->FieldByName("KCMC")->AsString.c_str());
Form4->ComboBox4->Items=Form4->ComboBox24->Items;
if(Form4->Table2->FindKey(ARRAYOFCONST((Table2->FieldByName("KCMC")->AsString)))){
Form4->Edit4->Text=Form4->Table2->FieldByName("KSS")->AsString;
Form4->ComboBox4->Text=Form4->Table2->FieldByName("TXM")->AsString;
Form4->ComboBox4->Enabled=true;
}
else{
Form4->Edit4->Text="";
Form4->ComboBox4->Text="";
Form4->ComboBox4->Enabled=false;
}
Table2->Next();
}
if(!Table2->Eof){
Form4->Label5->Caption=Table2->FieldByName("KCMC")->AsString;
Form4->Label5->Visible=true;
Form4->Edit5->Visible=true;
Form4->ComboBox5->Visible=true;
Js(Table2->FieldByName("KCMC")->AsString.c_str());
Form4->ComboBox5->Items=Form4->ComboBox24->Items;
if(Form4->Table2->FindKey(ARRAYOFCONST((Table2->FieldByName("KCMC")->AsString)))){
Form4->Edit5->Text=Form4->Table2->FieldByName("KSS")->AsString;
Form4->ComboBox5->Text=Form4->Table2->FieldByName("TXM")->AsString;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -