📄 unit14.~pas
字号:
unit Unit14;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls,StrUtils;
type
Tyuangongtj = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit4: TEdit;
Edit5: TEdit;
ComboBox1: TComboBox;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Edit6: TEdit;
ComboBox2: TComboBox;
Edit7: TEdit;
ComboBox5: TComboBox;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
ComboBox6: TComboBox;
Edit14: TEdit;
Edit15: TEdit;
Edit16: TEdit;
Edit17: TEdit;
Edit18: TEdit;
ComboBox7: TComboBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
DBGrid1: TDBGrid;
Edit19: TEdit;
Edit20: TEdit;
ComboBox3: TComboBox;
button4: TButton;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit17Change(Sender: TObject);
procedure Edit6Change(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure button4Click(Sender: TObject);
private
{ Private declarations }
function isdate(s:string):boolean;
public
{ Public declarations }
end;
var
yuangongtj: Tyuangongtj;
implementation
uses Unit1, Unit10, Unit11, Unit12, Unit13, Unit2, Unit3, Unit4, Unit5,
Unit6, Unit7, Unit8, Unit9, Unit15, Unit16;
{$R *.dfm}
procedure Tyuangongtj.FormCreate(Sender: TObject);
var i:integer;
con1:string;
begin
ComboBox1.Items.Add('汉族');
ComboBox1.Items.Add('壮族');
ComboBox1.Items.Add('维吾儿族');
ComboBox1.Items.Add('蒙古族');
ComboBox1.Items.Add('其他少数民族');
ComboBox2.Items.Add('中共党员');
ComboBox2.Items.Add('共青团员');
ComboBox2.Items.Add('群众');
ComboBox2.Items.Add('民主党员');
ComboBox3.Items.Add('男');
ComboBox3.Items.Add('女');
ComboBox5.Items.Add('初级');
ComboBox5.Items.Add('中级');
ComboBox5.Items.Add('高级');
ComboBox6.Items.Add('高中');
ComboBox6.Items.Add('大专');
ComboBox6.Items.Add('本科');
ComboBox6.Items.Add('研究生');
ComboBox6.Items.Add('博士生');
ComboBox7.Items.Add('在岗');
ComboBox7.Items.Add('离岗');
ComboBox7.Items.Add('退休');
dm.ADOTable2.Active:=false;
dm.ADOTable2.Close;
dm.ADOTable2.TableName:='ygjibenxinxi';
dm.ADOTable2.Active:=true;
dbgrid1.Columns[0].FieldName:='员工id';
dbgrid1.Columns[1].FieldName:='姓名';
dbgrid1.Columns[2].FieldName:='性别';
dbgrid1.Columns[3].FieldName:='出生日期';
dbgrid1.Columns[4].FieldName:='籍贯';
dbgrid1.Columns[5].FieldName:='民族';
dbgrid1.Columns[6].FieldName:='身份证号';
dbgrid1.Columns[7].FieldName:='政治面貌';
dbgrid1.Columns[8].FieldName:='部门代码';
dbgrid1.Columns[9].FieldName:='进入部门日期';
dbgrid1.Columns[10].FieldName:='职务代码';
dbgrid1.Columns[11].FieldName:='职称';
dbgrid1.Columns[12].FieldName:='起薪日期';
dbgrid1.Columns[13].FieldName:='原企业';
dbgrid1.Columns[14].FieldName:='原职称';
dbgrid1.Columns[15].FieldName:='员工id';
dbgrid1.Columns[16].FieldName:='毕业学校';
dbgrid1.Columns[17].FieldName:='毕业日期';
dbgrid1.Columns[18].FieldName:='学历';
dbgrid1.Columns[19].FieldName:='专业';
dbgrid1.Columns[20].FieldName:='外语';
dbgrid1.Columns[21].FieldName:='地址';
dbgrid1.Columns[22].FieldName:='电话';
dbgrid1.Columns[23].FieldName:='邮箱';
dbgrid1.Columns[24].FieldName:='在岗状态';
for i:=0 to 24 do
dbgrid1.Columns[i].Width:=80;
end;
function Tyuangongtj.isdate(s:string):boolean;
begin
result:=false;
try
strtodate(s);
result:=true;
except
on econverterror do
result:=false;
end;
end;
procedure Tyuangongtj.Button3Click(Sender: TObject);
begin
yuangongtj.Close;
end;
procedure Tyuangongtj.Button1Click(Sender: TObject);
var
strnamem:string;
begin
strnamem:=edit4.Text;
if edit1.Text<>'' then
begin
if edit2.Text<>''then
begin
if edit6.Text<>'' then
begin
if edit14.Text<>'' then
begin
if (length(edit6.Text)=18) or (length(edit6.Text)=15) then
begin
with dm.ADODataSet1 do
begin
//判断员工编号的惟一性
close;
CommandText:='select * from ygjibenxinxi where 员工id='''+edit1.Text+'''';
open;
if isempty then
begin
dm.ADODataSet1.Close;
with dm.ADOTable2 do
begin
dm.ADOTable2.Active:=false;
dm.ADOTable2.TableName:='ygjibenxinxi';
dm.ADOTable2.Active:=true;
Append;
FieldByName('员工id').AsString:=edit1.Text;
FieldByName('姓名').AsString:=edit2.Text;
FieldByName('性别').AsString:=combobox3.Text;
FieldByName('出生日期').AsString:=edit4.Text;
FieldByName('籍贯').AsString:=edit5.Text;
FieldByName('民族').AsString:=combobox1.Text;
FieldByName('身份证号').AsString:=edit6.Text;
FieldByName('政治面貌').AsString:=combobox2.Text;
FieldByName('部门代码').AsString:=edit20.Text;
FieldByName('进入部门日期').AsString:=edit7.Text;
FieldByName('职务代码').AsString:=edit19.Text;
FieldByName('职称').AsString:=combobox5.Text;
FieldByName('起薪日期').AsString:=edit8.Text;
FieldByName('原企业').AsString:=edit9.Text;
FieldByName('原职称').AsString:=edit10.Text;
FieldByName('原职务').AsString:=edit11.Text;
FieldByName('毕业学校').AsString:=edit12.Text;
FieldByName('毕业日期').AsString:=edit13.Text;
FieldByName('学历').AsString:=combobox6.Text;
FieldByName('专业').AsString:=edit14.Text;
FieldByName('外语').AsString:=edit15.Text;
FieldByName('地址').AsString:=edit16.Text;
FieldByName('电话').AsString:=edit17.Text;
FieldByName('邮箱').AsString:=edit18.Text;
FieldByName('在岗状态').AsString:=combobox7.Text;
post;
end
end
else
begin
application.MessageBox('对不起,员工编号不允许重复!!','错误',mb_iconhand+mb_yesno);
edit1.Text:='';
edit1.SetFocus;
end
end
end
else
begin
application.MessageBox('身份证号码必须是18位或者15位!!','木鱼工作室',mb_iconhand+mb_yesno);
edit6.Clear;
edit6.SetFocus;
end
end
else
begin
application.MessageBox('专业必须填写!!','错误',mb_iconhand+mb_yesno);
end
end
else
begin
application.MessageBox('身份证号必须填写!!','错误',mb_iconhand+mb_yesno);
end
end
else
begin
application.MessageBox('员工姓名必须填写!!','错误',mb_iconhand+mb_yesno);
end
end
else
begin
application.MessageBox('员工编号必须填写!!','错误',mb_iconhand+mb_yesno);
end;
end;
procedure Tyuangongtj.Edit17Change(Sender: TObject);
var
Str:string;
begin
Str:='';
Str:=Edit17.Text;
if Length(Str)>0 then
if not (Str[Length(Str)] in ['0'..'9',#8]) then
begin
Application.MessageBox('请输入数字!', '木鱼工作室', MB_OKCANCEL + MB_ICONINFORMATION);
Edit17.Text:=LeftStr(Str,Length(Str)-1);
end;
Edit17.SelStart:=Length(Edit17.Text);
end;
procedure Tyuangongtj.Edit6Change(Sender: TObject);
var
Str:string;
begin
Str:='';
Str:=Edit6.Text;
if Length(Str)>0 then
if not (Str[Length(Str)] in ['0'..'9',#8]) then
begin
Application.MessageBox('身份证号只能是数字!', '木鱼工作室', MB_OKCANCEL + MB_ICONINFORMATION);
Edit6.Text:=LeftStr(Str,Length(Str)-1);
end;
Edit6.SelStart:=Length(Edit6.Text);
end;
procedure Tyuangongtj.Button2Click(Sender: TObject);
begin
application.CreateForm(Tygxiugaisc,ygxiugaisc);
ygxiugaisc.ShowModal;
ygxiugaisc.Free;
end;
procedure Tyuangongtj.button4Click(Sender: TObject);
begin
application.CreateForm(Tyjchaxun,yjchaxun);
yjchaxun.ShowModal;
yjchaxun.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -