Am_Yhgl_Zcs.~pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:5k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Am_Yhgl_Zcs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, Mask, DBCtrlsEh, Buttons, DB, DBClient;
- type
- TAm_Yhgl_Zc = class(TForm)
- Image1: TImage;
- Label1: TLabel;
- GroupBox1: TGroupBox;
- GroupBox2: TGroupBox;
- GroupBox3: TGroupBox;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- DBEditEh1: TDBEditEh;
- DBEditEh2: TDBEditEh;
- DBEditEh3: TDBEditEh;
- DBEditEh4: TDBEditEh;
- DBEditEh5: TDBEditEh;
- DBEditEh7: TDBEditEh;
- Label9: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- SpeedButton3: TSpeedButton;
- DataSource1: TDataSource;
- DBEditEh6: TDBEditEh;
- procedure SpeedButton3Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure DBEditEh1KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh2KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh3KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh5KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh6KeyPress(Sender: TObject; var Key: Char);
- procedure SpeedButton1Click(Sender: TObject);
- procedure DBEditEh4Exit(Sender: TObject);
- procedure DBEditEh4KeyPress(Sender: TObject; var Key: Char);
- procedure DBEditEh6Exit(Sender: TObject);
- procedure DBEditEh7KeyPress(Sender: TObject; var Key: Char);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Am_Yhgl_Zc: TAm_Yhgl_Zc;
- implementation
- uses dms,u_public,mainfrms, Am_Ygxzs;
- {$R *.dfm}
- procedure TAm_Yhgl_Zc.SpeedButton3Click(Sender: TObject);
- begin
- close;
- end;
- procedure TAm_Yhgl_Zc.SpeedButton2Click(Sender: TObject);
- var s_dm:string;//员工代码
- N:integer;//错误
- begin
- if trim(dbediteh1.Text)='' then
- begin
- application.MessageBox('用户代码不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh1.SetFocus;
- exit;
- end;
- if trim(dbediteh2.Text)='' then
- begin
- application.MessageBox('用户名称不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh2.SetFocus;
- exit;
- end;
- if trim(dbediteh4.Text)='' then
- begin
- application.MessageBox('员工代码不能为空','提示',mb_ok+mb_iconinformation);
- dbediteh4.SetFocus;
- exit;
- end;
- if dbediteh7.Text<>dbediteh6.Text then
- begin
- application.MessageBox('密码输入不一致'+#13#10+'请检查密码','提示'mb_ok+mb_iconinformation);
- exit;
- end;
- //有效性验证
- dm.xt_user.FieldByName('user_password').AsString:=Encrypt(trim(dbediteh6.Text));
- n:=dm.xt_user.ApplyUpdates(0);
- if n<>0 then
- begin
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- close;
- end;
- end;
- procedure TAm_Yhgl_Zc.FormCreate(Sender: TObject);
- begin
- dm.sz_yg.Active:=true;
- frm_name:='am_yhgl_zc';
- end;
- procedure TAm_Yhgl_Zc.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dm.sz_yg.Active:=false;
- frm_name:='';
- action:=cafree;
- am_yhgl_zc:=nil;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh1KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh2.SetFocus;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh2KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh3.SetFocus;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh3KeyPress(Sender: TObject; var Key: Char);
- begin
- {if key=#13 then
- speedButton1.Click;}
- end;
- procedure TAm_Yhgl_Zc.DBEditEh5KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh6.SetFocus;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh6KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh7.SetFocus;
- end;
- procedure TAm_Yhgl_Zc.SpeedButton1Click(Sender: TObject);
- begin
- if am_ygxz=nil then
- begin
- am_ygxz:=Tam_ygxz.create(self);
- am_ygxz.showmodal;
- end;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh4Exit(Sender: TObject);
- var s,s_dm:string;
- begin
- s:=trim(dbediteh4.Text);
- if s<>'' then
- begin
- dm.sz_yg.Close;
- dm.sz_yg.CommandText:='select * from sz_yg where yg_dm='+''''+s+''''+'';
- dm.sz_yg.open;
- if dm.sz_yg.RecordCount<>0 then
- begin
- s_dm:=trim(dm.sz_yg.FieldByName('yg_dm').AsString);
- if s<>'' then
- dbediteh5.Text:=s_dm
- end
- else
- begin
- application.MessageBox('当前表中没有该员工代码','提示',mb_ok+mb_iconinformation);
- dbediteh4.Text:='';
- dbediteh4.SetFocus;
- exit;//end if
- end;
- end
- else
- begin
- exit;
- end;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh4KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- dbediteh6.SetFocus;
- end;
- procedure TAm_Yhgl_Zc.DBEditEh6Exit(Sender: TObject);
- begin
- {if user_password<>dbediteh6.Text then
- begin
- Application.MessageBox('旧密码错误!','提示',mb_ok+mb_iconinformation);
- dbediteh6.Text:='';
- end}//密码修改时用到
- end;
- procedure TAm_Yhgl_Zc.DBEditEh7KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- speedButton2.Click;
- end;
- end.