📄 submain.pas
字号:
begin
colstr:=colstr+'姓名 AS 录入员,';
continue;
end
else
colstr:=colstr+checklistbox1.Items[i]+',';
end;
end; //end of for
end; // end of with
colstr:=copy(colstr,0,length(colstr)-1);
case U_global_setting.F_setting.RadioGroup2.ItemIndex of
0:
begin
s:=inputbox('按试卷ID输入','请输入试卷ID','0');
s:='试卷表.试卷号='+s;
end;
1:
begin
s:=inputbox('按试卷名称模糊输入','请输入试卷名称关键字','计算机');
s:='试卷表.试卷名称 like ''%'+trim(s)+'%''';
end;
2:
begin
s:=inputbox('按试卷名称精确输入','请输入试卷名称','计算机2级');
s:='试卷表.试卷名称='''+trim(s)+'''';
end;
end;
global.sj_sqlstr:='select '+colstr+' FROM 用户作答表 INNER JOIN'
+' 试题表 ON 用户作答表.题号 = 试题表.试题号 INNER JOIN'
+' 试卷表 ON 用户作答表.试卷号 = 试卷表.试卷号 INNER JOIN'
+' 知识点表 ON 试题表.知识点 = 知识点表.id INNER JOIN'
+' 题库表 ON 试题表.所属题库 = 题库表.id INNER JOIN'
+' 题型表 ON 试题表.题型 = 题型表.id INNER JOIN'
+' 人员信息表 ON 试题表.录入员号 = 人员信息表.ID'+' where '+s;
report_sj.F_report_sj.Show;
end;
end;
procedure TForm1.N78Click(Sender: TObject);
var
s:string;
sql:string;
begin
if global.blnopensound then
playsound('click.wav');
if messagedlg('你确定要进行试卷的删除操作么?',mtwarning,[mbyes,mbno],0)=mryes then
begin
if messagedlg('你要进行试卷删除的有关设置么?',mtwarning,[mbyes,mbno],0)=mrno then
begin
case U_global_setting.F_setting.del_sj.ItemIndex of
0:
begin
s:=inputbox('按试卷号删除','请输入试卷号','0');
sql:='delete from 用户作答表 where 试卷号='+s;
end;
1:
begin
s:=inputbox('按试卷名称[模糊]删除','请输入试卷名称关键字','计算机');
sql:='delete from 用户作答表 where 试卷号 in (select 试卷号 from 试卷表 where 试卷名称 like ''%'+trim(s)+'%'')';
end;
2:
begin
s:=inputbox('按试卷名称[精确]删除','请输入试卷名称','计算机2级');
sql:='delete from 用户作答表 where 试卷号 in (select 试卷号 from 试卷表 where 试卷名称='''+trim(s)+''')';
end;
3:
begin
s:=inputbox('按出卷人删除','请输入出卷人姓名','计算机');
sql:='delete from 用户作答表 where 试卷号 in (select 试卷号 from 试卷表 where 出卷人='''+trim(s)+''')';
end;
end;
if U_global_setting.F_setting.CheckBox11.Checked then
begin
if messagedlg('你确定要删除满足要求的试卷么?一旦删除,不可恢复哦!',mtwarning,[mbyes,mbno],0)=mryes then
begin
with main.DataModule2 do
begin
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add(sql);
aq1.ExecSQL;
messagedlg('删除成功',mtinformation,[mbok],0);
end;
end;
end
else
begin
with main.DataModule2 do
begin
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add(sql);
aq1.ExecSQL;
messagedlg('删除成功',mtinformation,[mbok],0);
end;
end;
end //end of if
else
begin
U_global_setting.F_setting.Show;
U_global_setting.F_setting.PageControl1.ActivePageIndex:=5;
end;
end; // end of if
end;
procedure TForm1.TV1EndDock(Sender, Target: TObject; X, Y: Integer);
begin
//tv1.Left:=0;
//tv1.Top:=coolbar1.Height;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
myfile:Tinifile;
begin
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
if myfile.Readbool('other_setting','disable_altf4',false) then
canclose:=false;
//else
//N5.Click;
end;
procedure TForm1.TV1Click(Sender: TObject);
begin
if tv1.Selected.Level=0 then
begin
if global.blnopensound then
playsound('btnFocus.wav');
end;
if ((tv1.Selected.Level=1)and(tv1.Selected.Text<>'查询')and(tv1.Selected.Text<>'新建')and(tv1.Selected.Text<>'快速导航')and(tv1.Selected.Text<>'帮助主题')) then
begin
if global.blnopensound then
playsound('btnFocus.wav');
end;
end;
procedure TForm1.TV1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
if global.blnopensound then
playsound('undo.wav');
end;
end;
procedure TForm1.ToolBar1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
if global.blnopensound then
playsound('undo.wav');
end;
end;
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
if global.blnopensound then
playsound('undo.wav');
end;
end;
procedure TForm1.N81Click(Sender: TObject);
begin
if global.blnopensound then
playsound('click.wav');
U_global_setting.F_setting.Show;
U_global_setting.F_setting.PageControl1.ActivePageIndex:=5;
end;
procedure TForm1.N82Click(Sender: TObject);
begin
U_tip.F_tip_form.Hide;
AnimateWindow(F_tip_form.Handle,1000,AW_CENTER);
U_tip.F_tip_form.Show;
end;
procedure TForm1.N83Click(Sender: TObject);
var
s1,s2:string;
id:integer;
begin
if inputquery('请输入大类知识点','请输入大类知识点',s1) then
begin
if inputquery('请输入小类知识点','请输入小类知识点',s2) then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('select count(*) as num from 知识点表');
aq3.Open;
id:=aq3.FieldValues['num'];
id:=id+1;
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('insert into 知识点表 values('+inttostr(id)+','''+trim(s1)+''','''+trim(s2)+''',0,0)');
aq3.ExecSQL;
end;
if messagedlg('当前操作会影响主界面的树型目录'+#13+#10+'是否在贴加成功后执行[刷新]操作'
+#13+#10+'如果点选[&Yes],这可能要花费一段刷新时间',mtinformation,[mbyes,mbno],0)=mryes then
N52click(sender);
end;
end;
end;
procedure TForm1.N87Click(Sender: TObject);
var
s1,s2,sqlstr,s3,s4:string;
id,i:integer;
begin
if inputquery('设置过滤条件','1:按编号'+
#13+#10+'2:按大类知识点和小类知识点'+#13+#10
+'默认为按编号,请选择:',s1) then
begin
try
id:=strtoint(s1);
except
begin
messagedlg('请输入正确的数字1或者其他数字',mterror,[mbok],0);
exit;
end;
end;
case id of
1:
begin
if inputquery('设置过滤条件值','请输入编号: ',s2) then
begin
try
i:=strtoint(s2);
except
begin
messagedlg('请输入正确的数字类型',mterror,[mbok],0);
exit;
end;
end;
sqlstr:='delete from 知识点表 where id='+inttostr(i);
end;
end;
else
begin
if inputquery('请输入大类知识点','请输入大类知识点',s3) then
begin
if inputquery('请输入小类知识点','请输入小类知识点',s4) then
begin
sqlstr:='delete from 知识点表 where name='''+trim(s3)+''' and subname='''+trim(s4)+'''';
end;
end;
end;//end of else
end;//end of case
if messagedlg('是否要删除符合条件的记录?',mtinformation,[mbyes,mbno],0)=mryes then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add(sqlstr);
aq3.ExecSQL;
update_zsdb;
messagedlg('成功执行了删除操作!',mtinformation,[mbok],0);
if messagedlg('当前操作会影响主界面的树型目录'+#13+#10+'是否在删除成功后执行[刷新]操作'+
#13+#10+'如果点选[&Yes],这可能要花费一段刷新时间',mtinformation,[mbyes,mbno],0)=mryes then
N52click(sender);
end;
end;//end of if
end;// end of if
end;
procedure TForm1.N84Click(Sender: TObject);
var
s1:string;
i:integer;
begin
if inputquery('请输入题型名','请输入题型名',s1) then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('select count(*) as num from 题型表');
aq3.Open;
i:=aq3.FieldValues['num'];
i:=i+1;
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('insert into 题型表 values('+inttostr(i)+','''+s1+''')');
aq3.ExecSQL;
if messagedlg('当前操作会影响主界面的树型目录'+#13+#10+'是否在贴加成功后执行[刷新]操作'
+#13+#10+'如果点选[&Yes],这可能要花费一段刷新时间',mtinformation,[mbyes,mbno],0)=mryes then
N52click(sender);
end;
end;
end;
procedure TForm1.N88Click(Sender: TObject);
var
s1:string;
begin
if inputquery('请输入要删除的题型名','请输入要删除的题型名: ',s1) then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('delete from 题型表 where name='''+trim(s1)+'''');
aq3.ExecSQL;
update_txb;
messagedlg('成功执行了删除操作!',mtinformation,[mbok],0);
if messagedlg('当前操作会影响主界面的树型目录'+#13+#10+'是否在删除成功后执行[刷新]操作'
+#13+#10+'如果点选[&Yes],这可能要花费一段刷新时间',mtinformation,[mbyes,mbno],0)=mryes then
N52click(sender);
end;
end;
end;
procedure TForm1.N85Click(Sender: TObject);
var
s1,s2:string;
id:integer;
begin
if inputquery('请输入试卷名称','请输入试卷名称: ',s1) then
begin
if inputquery('请输入出卷人','请输入出卷人: ',s2) then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('select count(*) as num from 试卷表');
aq3.Open;
id:=aq3.FieldValues['num'];
id:=id+1;
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add('insert into 试卷表 values('+inttostr(id)+','''+trim(s1)+''','''+trim(s2)+''')');
aq3.ExecSQL;
messagedlg('当前操作执行成功!',mtinformation,[mbok],0);
end;
end;
end;
end;
procedure TForm1.N89Click(Sender: TObject);
var
s1,s2,sqlstr,s3,s4:string;
id,i:integer;
begin
if inputquery('设置过滤条件','1:按编号'+
#13+#10+'2:按试卷名和出卷人',s1) then
begin
try
id:=strtoint(s1);
except
begin
messagedlg('请输入正确的数字1或者其他数字',mterror,[mbok],0);
exit;
end;
end;
case id of
1:
begin
if inputquery('设置过滤条件值','请输入试卷编号: ',s2) then
begin
try
i:=strtoint(s2);
except
begin
messagedlg('请输入正确的数字类型',mterror,[mbok],0);
exit;
end;
end;
sqlstr:='delete from 试卷表 where 试卷号='+inttostr(i);
end;
end;
else
begin
if inputquery('请输入试卷名','请输入试卷名: ',s3) then
begin
if inputquery('请输入出卷人','请输入出卷人: ',s4) then
begin
sqlstr:='delete from 试卷表 where 试卷名称='''+trim(s3)+''' and 出卷人='''+trim(s4)+'''';
end;
end;
end;//end of else
end;//end of case
if messagedlg('是否要删除符合条件的记录?',mtinformation,[mbyes,mbno],0)=mryes then
begin
with main.DataModule2 do
begin
aq3.Close;
aq3.SQL.Clear;
aq3.SQL.Add(sqlstr);
aq3.ExecSQL;
update_sjb;
messagedlg('成功执行了删除操作!',mtinformation,[mbok],0);
end;
end;//end of if
end;// end of if
end;
procedure TForm1.TV1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept:=false;
if source=panel2 then
accept:=true;
tv1.Width:=x+(sender as tcontrol).Left;
end;
procedure TForm1.Panel1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept:=false;
if source=panel2 then
accept:=true;
tv1.Width:=(sender as tcontrol).Left;
end;
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
var
myfile:Tinifile;
begin
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
if not myfile.ReadBool('datebase_setting','dbgrid_canwrite',false) then
key:=#0;
end;
procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
myfile:Tinifile;
begin
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
if myfile.ReadBool('database_setting','grid_blank',false) then
begin
if (key=VK_down) then
begin
dbgrid1.DataSource.DataSet.DisableControls;
dbgrid1.DataSource.DataSet.Next;
if dbgrid1.DataSource.DataSet.Eof then
key:=0
else
dbgrid1.DataSource.DataSet.Prior;
dbgrid1.DataSource.DataSet.EnableControls;
end;
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
var
myfile:Tinifile;
begin
myfile:=Tinifile.Create(extractfilepath(application.ExeName)+'myfile.ini');
if myfile.ReadBool('other_setting','showfont',false) then
begin
toolbar1.Height:=82;
coolbar1.Height:=92;
toolbar1.ShowCaptions:=true;
end
else
begin
toolbar1.Height:=26;
coolbar1.Height:=36;
toolbar1.ShowCaptions:=false;
toolbar1.ButtonHeight:=24;
toolbar1.ButtonWidth:=24;
toolbar1.Wrapable:=true;
end;
tv1.Font:=u_global_setting.F_setting.Label17.Font;
tv1.Font.Color:=u_global_setting.F_setting.Label17.Font.Color;
tv1.Color:=u_global_setting.F_setting.Label
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -