📄 winworktime.~pas
字号:
//****************************************************************
procedure TWinworktime.TWinworktime_Closed(sender: System.Object; e: System.EventArgs);
begin
try
clsmain.Winworktimeshowfla:=false;
except
on ex:exception do
begin
messagebox.Show('TWinworktime.TWinworktime_closed:(' + ex.Message + ')','考勤管理系统');
end;
end;
end;
//****************************************************************
//* 窗体项目清空
//*
//* [参数]
//* 无
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.Item_Clear;
begin
try
{self.DateTimePicker1.Text:=clsmain.MUPtime;
self.DateTimePicker2.Text:=clsmain.MDOwntime;}
self.Textbeizhu.Text:='';
except
on ex:exception do
begin
messagebox.Show('TWinworktime.TWinworktime_closed:(' + ex.Message + ')','考勤管理系统');
end;
end;
end;
//****************************************************************
//* DateTimePicker1_KeyPress
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.DateTimePicker1_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
try
if e.KeyChar=#13 then
datetimepicker2.Focus;
except
on ex:Exception do
begin
messagebox.Show('TWinworktime.DateTimePicker1_KeyPress: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* Textbeizhu_KeyPress
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.Textbeizhu_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
try
Case e.KeyChar of
char(13):
begin
e.Handled := False;
SendKeys.Send('{Tab}');
end;
end;
except
on ex:Exception do
begin
messagebox.Show('TWinworktime.DateTimePicker2_KeyPress: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* DateTimePicker2_KeyPress
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.DateTimePicker2_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
try
Case e.KeyChar of
char(13):
begin
e.Handled := False;
SendKeys.Send('{Tab}');
end;
end;
except
on ex:Exception do
begin
messagebox.Show('TWinworktime.DateTimePicker2_KeyPress: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* Butok_Click
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.Butok_Click(sender: System.Object; e: System.EventArgs);
begin
try
if data_upd()=false then
begin
messagebox.Show('添加时间失败,请重新输入!','时间管理');
end
else
begin
messagebox.Show('添加时间成功!','时间管理');
end;
except
on ex:Exception do
begin
messagebox.Show('TWinworktime.Butok_Click: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* Butcancel_Click
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinworktime.Butcancel_Click(sender: System.Object; e: System.EventArgs);
begin
try
self.Close;
except
on ex:Exception do
begin
messagebox.Show('TWinworktime.Butcancel_Click: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 数据修改
//*
//* [参数]
//* 无
//* [返回]
//* 实行状况
//* True:成功
//* False:失败
//****************************************************************
function TWinworktime.Data_Upd: boolean;
var
w_sql:string;
w_DateTimePicker1:string; //上班时间
w_DateTimePicker2:string; //下班时间
w_textbeizhu:string;
begin
try
//设置当前光标为忙等待状态
self.Cursor:=cursors.WaitCursor;
w_DateTimePicker1:=DateTimePicker1.Value.ToString;
w_SQL := '';
w_SQL := w_SQL + ' UPDATE 工作时间表 SET';
w_SQL := w_SQL + ' 上班时间='''+w_DateTimePicker1+''',';
w_SQL := w_SQL + ' 下班时间='''+w_DateTimePicker2+''',';
w_SQL := w_SQL + ' 备注='''+w_textbeizhu+'''';
w_SQL := w_SQL + ' WHERE 上班时间='''+w_DateTimePicker1+'''';
clsmain.TClass1.Create.begintrans; //开始事务
clsmain.TClass1.Create.cmn_ado_select(w_sql); //执行SQL语句
clsmain.TClass1.Create.commit; //提交事务
result:=true;
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinworktime.Butok_Click: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
procedure TWinworktime.Label2_Click(sender: System.Object; e: System.EventArgs);
begin
end;
//****************************************************************
//* 数据查询
//*
//* [参数]
//* 无
//* [返回]
//* 实行状况
//* True:成功
//* False:失败
//****************************************************************
function TWinworktime.data_get: boolean;
var
w_SQL:string;
//w_DateTimePicker1:string;
//w_DateTimePicker2:string;
begin
try
w_SQL := '';
w_SQL := w_SQL + ' SELECT 上班时间,';
w_SQL := w_SQL + ' 下班时间,';
w_SQL := w_SQL + ' 备注';
w_SQL := w_SQL + ' From 工作时间表';
DGDs:=clsmain.TClass1.Create.Cmn_Ado_Select (w_SQL);
clsmain.TClass1.Create.begintrans; //开始事务
clsmain.TClass1.Create.cmn_ado_select(w_sql); //执行SQL语句
clsmain.TClass1.Create.commit;
myds:=dataset.Create;
//执行sql语句并把记录返回
myds:=clsmain.TClass1.Create.cmn_ado_select(w_sql);
if dgds.Tables[0].Rows.count<>0 then
begin
DateTimePicker1.Text:= clsmain.TClass1.Create.getItemValueS(DGDs,0,'上班时间').ToString;
DateTimePicker2.Text:= clsmain.TClass1.Create.getItemValueS(DGDs,0,'下班时间').ToString;
Textbeizhu.Text:= clsmain.TClass1.Create.getItemValueS(DGDs,0,'备注').ToString;
end;
{//保存工作时间中的上班时间
clsmain.MUPtime:=w_DateTimePicker1;
//保存工作时间中的下班时间
clsmain.MDOwntime:=w_DateTimePicker2; }
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinworktime.data_get: (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -