📄 cjiang.~pas
字号:
Parameters.ParamByName('code1').Value:='A';
end
else
begin
Parameters.ParamByName('code1').Value:='O';
end;
if CY>=1 then
begin
Parameters.ParamByName('code2').Value:='B';
end
else
begin
Parameters.ParamByName('code2').Value:='O';
end;
if CX>=1 then
begin
Parameters.ParamByName('code3').Value:='C';
end
else
begin
Parameters.ParamByName('code3').Value:='O';
end;
if DD>=1 then
begin
Parameters.ParamByName('code4').Value:='D';
end
else
begin
Parameters.ParamByName('code4').Value:='O';
end;
if ZL>=1 then
begin
Parameters.ParamByName('code5').Value:='E';
end
else
begin
Parameters.ParamByName('code5').Value:='O';
end;
if LD>=1 then
begin
Parameters.ParamByName('code6').Value:='G';
end
else
begin
Parameters.ParamByName('code6').Value:='O';
end;
if SJ>=1 then
begin
Parameters.ParamByName('code7').Value:='F';
end
else
begin
Parameters.ParamByName('code7').Value:='O';
end;
end;
open;
while not Eof do
begin
st:=Fields[0].AsString;
ListBox3.Items.Add(st);
Next;
end;
end;
end
else if (Combobox1.ItemIndex+1)=6 then
begin
With aqWork do
begin
Close;
sql.Clear;
if (GL0>=1) and (CY0>=1) and (CX0>=1) and (DD0>=1) and (ZL0>=1) and (LD0>=1) and (SJ0>=1) then
begin
sql.Add('select * from staffer where grade=0 order by name desc');
end
else
begin
sql.Add('select * from staffer where grade=0 and left(code,1)<> :code1 and left(code,1)<> :code2');
sql.Add('and left(code,1)<> :code3 and left(code,1)<> :code4 and left(code,1)<> :code5');
sql.Add('and left(code,1)<> :code6 and left(code,1)<> :code7 order by name desc');
if GL0>=1 then
begin
Parameters.ParamByName('code1').Value:='A';
end
else
begin
Parameters.ParamByName('code1').Value:='O';
end;
if CY0>=1 then
begin
Parameters.ParamByName('code2').Value:='B';
end
else
begin
Parameters.ParamByName('code2').Value:='O';
end;
if CX0>=1 then
begin
Parameters.ParamByName('code3').Value:='C';
end
else
begin
Parameters.ParamByName('code3').Value:='O';
end;
if DD0>=1 then
begin
Parameters.ParamByName('code4').Value:='D';
end
else
begin
Parameters.ParamByName('code4').Value:='O';
end;
if ZL0>=1 then
begin
Parameters.ParamByName('code5').Value:='E';
end
else
begin
Parameters.ParamByName('code5').Value:='O';
end;
if LD0>=1 then
begin
Parameters.ParamByName('code6').Value:='G';
end
else
begin
Parameters.ParamByName('code6').Value:='O';
end;
if SJ0>=1 then
begin
Parameters.ParamByName('code7').Value:='F';
end
else
begin
Parameters.ParamByName('code7').Value:='O';
end;
end;
open;
while not Eof do
begin
st:=Fields[0].AsString;
ListBox3.Items.Add(st);
Next;
end;
end;
end
else if (Combobox1.ItemIndex+1)>6 then
begin
With aqWork do
begin
Close;
sql.Clear;
if (GL>=1) and (CY>=1) and (CX>=1) and (DD>=1) and (ZL>=1) and (LD>=1) and (SJ>=1) then
begin
sql.Add('select * from staffer where grade=0 order by name desc');
end
else
begin
sql.Add('select * from staffer where grade=0 and left(code,1)<> :code1 and left(code,1)<> :code2');
sql.Add('and left(code,1)<> :code3 and left(code,1)<> :code4 and left(code,1)<> :code5');
sql.Add('and left(code,1)<> :code6 and left(code,1)<> :code7 order by name desc');
if GL>=1 then
begin
Parameters.ParamByName('code1').Value:='A';
end
else
begin
Parameters.ParamByName('code1').Value:='O';
end;
if CY>=1 then
begin
Parameters.ParamByName('code2').Value:='B';
end
else
begin
Parameters.ParamByName('code2').Value:='O';
end;
if CX>=1 then
begin
Parameters.ParamByName('code3').Value:='C';
end
else
begin
Parameters.ParamByName('code3').Value:='O';
end;
if DD>=1 then
begin
Parameters.ParamByName('code4').Value:='D';
end
else
begin
Parameters.ParamByName('code4').Value:='O';
end;
if ZL>=1 then
begin
Parameters.ParamByName('code5').Value:='E';
end
else
begin
Parameters.ParamByName('code5').Value:='O';
end;
if LD>=1 then
begin
Parameters.ParamByName('code6').Value:='G';
end
else
begin
Parameters.ParamByName('code6').Value:='O';
end;
if SJ>=1 then
begin
Parameters.ParamByName('code7').Value:='F';
end
else
begin
Parameters.ParamByName('code7').Value:='O';
end;
end;
open;
while not Eof do
begin
st:=Fields[0].AsString;
ListBox3.Items.Add(st);
Next;
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
str,str1:string;
n:integer;
begin
ListBox1.Items.Clear;
ListBox1.Visible:=True;
ListBox2.Visible:=False;
with aqWork do
begin
Close;
sql.Clear;
sql.Add('select * from staffer where grade>0 and get_luck=1 order by grade,code');
Open;
N:=Recordcount;
if n=0 then
begin
showmessage('目前还没有人中奖!');
ListBox1.Visible:=False;
exit;
end;
while not eof do
begin
application.ProcessMessages;
if Fields[5].Value=1 then
begin
str1:='三等奖';
end
else if Fields[5].Value=2 then
begin
str1:='二等奖';
end
else if Fields[5].Value=3 then
begin
str1:='一等奖';
end
else if Fields[5].Value=4 then
begin
str1:='特等奖';
end
else if Fields[5].Value=5 then
begin
str1:='幸运奖';
end
else if Fields[5].value=6 then
begin
str1:='特别奖';
end
else if Fields[5].value=7 then
begin
str1:='补抽奖';
end;
Str:=Fields[1].AsString+' '+Fields[2].AsString+' '+Fields[3].AsString+' '+Str1;
ListBox1.Items.Add(Str);
Next;
end;
ShowMessage('已抽取了'+IntToStr(N)+'名奖!');
end;
SpeedButton2.SetFocus;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
var
str2:string;
a,b:integer;
x,y,i,n:integer;
gra:integer;
str,str1:string;
F_ser,F_code,F_name,F_pname,F_mingci:String;
begin
if SpeedButton2.Caption='开始' then
begin
SpeedButton2.SetFocus;
SpeedButton2.Caption:='停止';
ListBox1.Visible:=False;
ListBox2.Visible:=False;
Label3.Visible:=False;
Label6.Visible:=True;
Label4.Visible:=False;
Label5.Visible:=False;
ListBox4.Items.Clear;
With aqWork do
begin
Close;
sql.Clear;
sql.Add('select * from staffer where grade=0 order by name');
open;
while not Eof do
begin
str2:=Fields[3].AsString+' '+Fields[1].AsString+' '+Fields[2].AsString;
ListBox4.Items.Add(str2);
Next;
end;
end;
for a:=0 to 1000 do
begin
for b:=0 to ListBox4.Items.Count-1 do
begin
Application.ProcessMessages;
PDelay(5);
Label6.Caption:=ListBox4.Items[b];
Label6.Left:=Round((Panel2.Width-Label6.Width)/2);
end;
end;
end;
if SpeedButton2.Caption='停止' then
begin
Panel2.SetFocus;
SpeedButton2.Caption:='开始';
Label4.Visible:=True;
Label5.Visible:=True;
Label6.Visible:=False;
ListBox1.Visible:=False;
ListBox2.Items.Clear;
x:=StrToInt(trim(Edit1.Text));
if x=0 then
begin
ShowMessage('得奖人数不能为0');
Label3.Visible:=True;
Exit;
end;
Label5.Visible:=True;
Label5.Caption:=Combobox1.Text+IntToStr(x)+'名';
Label5.Left:=Round((Panel2.Width-Label5.Width)/2);
gra:=Combobox1.ItemIndex+1;
// Randomize;
if gra>6 then
begin
for y:=x downto 1 do
begin
Randomize;
ZhongJiang;
n:=ListBox3.Items.Count;
Application.ProcessMessages;
PDelay(Time);
i:=StrToInt(ListBox3.Items[Random(n)]);
with aqZj do
begin
Close;
sql.Clear;
sql.Add('select * from staffer where ser_no=:ser_no');
parameters.ParamByName('ser_no').Value:=i;
Open;
F_ser:=Fields[0].AsString;
F_code:=Fields[1].AsString;
F_name:=Fields[2].AsString;
F_pname:=Fields[3].AsString;
str1:=Fields[3].AsString+' '+Fields[1].AsString+' '+Fields[2].AsString;
Label4.Caption:=Inttostr(y)+' '+str1;
Label4.Left:=Round((Panel2.Width-Label4.Width)/2);
ListBox2.Items.Add(Str1);
end;
with aqWork do
begin
Close;
sql.Clear;
sql.Add('update staffer set get_luck=1,grade=:grade where ser_no=:ser_no');
parameters.ParamByName('grade').Value:=gra;
parameters.ParamByName('ser_no').Value:=i;
Execsql;
end;
with atWork do
begin
TableName:='Luckly';
Open;
atWork.AppendRecord([F_ser,F_code,F_name,F_pname,Combobox1.Text]);
Close;
end;
with atWork do
begin
TableName:='ALuck';
Open;
atWork.AppendRecord([F_ser,F_code,F_name,F_pname,Combobox1.Text]);
Close;
end;
end;
end
else if gra=6 then
begin
y:=1;
while y<=2000 do
begin
with aqprt do
begin
close;
sql.Clear;
sql.Add('select * from staffer where grade>=6 ');
Open;
end;
if aqprt.RecordCount>=7 then
begin
showmessage('得奖人数已经满了');
exit;
end;
Randomize;
ZhongJiang;
n:=ListBox3.Items.Count;
Application.ProcessMessages;
PDelay(Time);
i:=StrToInt(ListBox3.Items[Random(n)]);
with aqZj do
begin
Close;
sql.Clear;
sql.Add('select * from staffer where ser_no=:ser_no');
parameters.ParamByName('ser_no').Value:=i;
Open;
F_ser:=Fields[0].AsString;
F_code:=Fields[1].AsString;
F_name:=Fields[2].AsString;
F_pname:=Fields[3].AsString;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -