📄 update_pass.pas
字号:
unit update_pass;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, StdCtrls, Buttons, Mask, ExtCtrls;
type
Tfrm_update_pass = class(TForm)
Panel1: TPanel;
Label2: TLabel;
txt_old: TMaskEdit;
cmdOK: TBitBtn;
cmdCancel: TBitBtn;
sp_update_user_pass: TStoredProc;
Panel2: TPanel;
Label1: TLabel;
txt_name: TEdit;
Label3: TLabel;
txt_new: TMaskEdit;
Label4: TLabel;
txt_jy: TMaskEdit;
//
procedure controlKeyPress(Sender: TObject; var Key: Char);
procedure cmdOKClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
procedure controlSetFocus(intpos: integer);
public
{ Public declarations }
user_name1: string;
user_pass1: string;
user_group1: integer;
end;
var
frm_update_pass: Tfrm_update_pass;
implementation
{$R *.DFM}
uses
log;
procedure Tfrm_update_pass.controlKeyPress(Sender: TObject; var Key: Char);
begin
if Ord(Key) = 13 then controlSetFocus(TWinControl(Sender).Tag);
end;
procedure Tfrm_update_pass.controlSetFocus(intpos: integer);
begin
case intpos of
1: txt_new.SetFocus;
2: txt_jy.SetFocus;
end;
end;
procedure Tfrm_update_pass.cmdOKClick(Sender: TObject);
begin
if Trim(txt_old.Text) = user_pass1 then begin
if (Trim(txt_new.Text) = '') or (Trim(txt_jy.Text) = '') then begin
MessageBox(Handle, '新密码校验不完全', '沈阳信德', MB_ICONQUESTION or MB_OK);
txt_new.SetFocus;
Exit;
end else begin
if Trim(txt_new.Text) <> Trim(txt_jy.Text) then begin
MessageBox(Handle, '新密码与校验密码不一致', '沈阳信德', MB_ICONQUESTION or MB_OK);
txt_jy.SetFocus;
Exit;
end else begin
sp_update_user_pass.ParamByName('@iuser_name').Value := user_name1;
sp_update_user_pass.ParamByName('@iuser_password').Value := Trim(txt_new.Text);
sp_update_user_pass.ParamByName('@iuser_group').Value := user_group1;
sp_update_user_pass.ExecProc;
//
MessageBox(Handle, '密码已更新,新密码在下次登陆时生效', '沈阳信德', MB_ICONQUESTION or MB_OK);
Close;
end;
end;
end else begin
MessageBox(Handle, '旧密码不正确,请重新输入', '沈阳信德', MB_ICONQUESTION or MB_OK);
txt_old.SetFocus;
Exit;
end;
end;
procedure Tfrm_update_pass.cmdCancelClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_update_pass.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
procedure Tfrm_update_pass.FormDestroy(Sender: TObject);
begin
frm_update_pass := nil;
end;
procedure Tfrm_update_pass.FormShow(Sender: TObject);
begin
txt_name.Text := user_name1;
//
txt_old.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -