pwddlg.pas
来自「仲裁委仲裁案件计酬程序.有基础资料设置、分级设置」· PAS 代码 · 共 122 行
PAS
122 行
unit PWDDlg;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, DB, ADODB, TFlatButtonUnit, TFlatEditUnit, ExtCtrls,Messages;
type
TPWDDlgFrm = class(TForm)
Shape1: TShape;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
btnCancel: TFlatButton;
btnOK: TFlatButton;
EditPWD: TADOQuery;
edtOldPsw: TFlatEdit;
edtPassword: TFlatEdit;
edtNewPsw: TFlatEdit;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure btnOKClick(Sender: TObject);
procedure edtOldPswKeyPress(Sender: TObject; var Key: Char);
procedure edtNewPswKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PWDDlgFrm: TPWDDlgFrm;
implementation
{$R *.dfm}
Uses Link,PubData,InterfaceDLLLoader, MyInterface;
procedure TPWDDlgFrm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=13 then btnOK.Click;
if Key=27 then btnCancel.Click;
end;
procedure TPWDDlgFrm.btnOKClick(Sender: TObject);
var
dllInterface: IMyInterface;
begin
//先检查用户输入的内容
{ if edtOldPsw.Text='' then begin
Application.MessageBox('请输入您当前的密码!','提示',MB_ICONINFORMATION);
edtOldPsw.SetFocus;
Exit;
end; }
if Length(edtPassword.Text)<4 then begin
Application.MessageBox('请输入新密码,新密码长度不能小于4位!','提示',MB_ICONINFORMATION);
edtPassword.SetFocus;
Exit;
end;
if edtNewPsw.Text='' then begin
Application.MessageBox('请输入确认密码!','提示',MB_ICONINFORMATION);
edtNewPsw.SetFocus;
Exit;
end;
if edtPassword.Text <> edtNewPsw.Text then begin
Application.MessageBox('请两次输入的密码不一致!','提示',MB_ICONINFORMATION);
edtNewPsw.SetFocus;
Exit;
end;
//取用户信息并修改密码
with TInterfaceDLLLoader.Create() do
begin
dllInterface := GetInterface();
with EditPWD do begin
SQL.Clear;
SQL.Add('select [FPWD] from [T_User] where FName=:UserName');
Parameters.ParamValues['UserName'] := PubData.SysUser;
Active := true;
if Eof then begin
Application.MessageBox('未预料的错误:系统未找到您的帐号信息', '提示', MB_OK+MB_ICONSTOP);
Exit;
end;
if FieldByName('FPWD').AsString <> dllInterface.TransPassword(edtOldPsw.Text) then begin
Application.MessageBox('当前密码不正确,请重新输入', '提示', MB_ICONINFORMATION);
edtOldPsw.SetFocus;
Exit;
end;
try
Edit;
FieldByName('FPWD').AsString := dllInterface.TransPassword(edtPassword.Text);
Post;
Application.MessageBox('密码修改成功,请牢记此密码!','提示',MB_ICONINFORMATION);
Close;
Self.Close;
free(); //
except
on E: Exception do begin
Cancel;
free(); //
Application.MessageBox(PChar('有未知错误产生,操作已被取消,错误描述如下:'#13#10 + E.Message), '提示',MB_ICONSTOP);
end;
end;
end;
end;
end;
procedure TPWDDlgFrm.edtOldPswKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
PostMessage(Handle, WM_KEYDOWN, VK_TAB, 0);
end;
procedure TPWDDlgFrm.edtNewPswKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
BtnOK.Click;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?