📄 worktypes.pas
字号:
unit worktypes;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, xpButton, Grids, DBGrids;
type
Tworktype = class(TForm)
Bevel1: TBevel;
xpButton1: TxpButton;
xpButton2: TxpButton;
xpButton3: TxpButton;
DBGrid1: TDBGrid;
procedure FormPaint(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure xpButton1Click(Sender: TObject);
procedure xpButton2Click(Sender: TObject);
procedure xpButton3Click(Sender: TObject);
private
procedure refreshlist;
{ Private declarations }
public
{ Public declarations }
end;
var
worktype: Tworktype;
implementation
uses sldata, worktypenew, worktypemodify;
{$R *.DFM}
procedure Tworktype.FormPaint(Sender: TObject);
begin
sl_data.formonpaint(self);
end;
procedure Tworktype.refreshlist;
begin
with sl_data.querys do
begin
close;
commandtext:='select work_type as 工种,depart as 部门 from worktype';
open;
end;
end;
procedure Tworktype.FormShow(Sender: TObject);
begin
refreshlist;
end;
procedure Tworktype.xpButton1Click(Sender: TObject);
begin
with tworktype_new.create(nil) do
try
showmodal;
finally
free;
end;
refreshlist;
end;
procedure Tworktype.xpButton2Click(Sender: TObject);
begin
if sl_data.querys.Active then
if sl_data.querys.recordcount>0 then
with tworktype_modify.create(nil) do
try
localstr:=dbgrid1.fields[0].asstring;
showmodal;
finally
free;
end;
refreshlist;
end;
procedure Tworktype.xpButton3Click(Sender: TObject);
var s:String;
begin
if sl_data.querys.Active then
if sl_data.querys.recordcount>0 then
begin
s:=dbgrid1.fields[0].asstring;
if messagebox(handle,pchar('是否删除工种名称为:'+s+'的记录'),pchar('提示'),1)=1 then
if sl_data.deleteworktype(s) then refreshlist;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -