U_xgmm.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:3k
- unit U_xgmm;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Db, DBClient, Buttons, StdCtrls, Mask, ExtCtrls;
- type
- TfrmXgmm = class(TForm)
- Panel1: TPanel;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Panel2: TPanel;
- btnOK: TSpeedButton;
- btnCancel: TSpeedButton;
- edtOldPassword: TEdit;
- edtNewPassword: TEdit;
- edtConPassword: TEdit;
- procedure btnOKClick(Sender: TObject);
- procedure btnCancelClick(Sender: TObject);
- procedure edtOldPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure edtNewPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure edtConPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- frmXgmm: TfrmXgmm;
- implementation
- uses U_mainform, u_public;
- {$R *.DFM}
- //确定按钮点击过程
- procedure TfrmXgmm.btnOKClick(Sender: TObject);
- var
- Yhbh, Zh, Logined, succeed: OleVariant;
- AliasName, Password: string;
- begin
- AliasName := CurrentParam.userAliasName;
- Password := edtOldPassword.Text;
- //调用应用服务器的Logined方法,判断旧密码是否正确
- frmMain.SocketConnection.AppServer.Logined(AliasName, Password, Yhbh, zh, Logined);
- if not Logined then
- begin
- application.messagebox('旧密码输入不正确', '物资管理系统', mb_iconinformation + mb_defbutton1);
- edtOldPassword.text := '';
- edtOldPassword.SetFocus;
- exit;
- end;
- if edtConPassword.text <> edtNewPassword.text then
- begin
- application.messagebox('密码输入不一致', '物资管理系统', mb_iconinformation + mb_defbutton1);
- edtConPassword.text := '';
- edtNewPassword.text := '';
- edtNewPassword.SetFocus;
- exit;
- end;
- Password := edtNewPassword.Text;
- //调用应用服务器的UpdatePassword方法更新密码
- frmMain.SocketConnection.AppServer.UpdatePassword(AliasName, Password, succeed);
- if succeed then
- application.messagebox('密码修改成功', '物资管理系统', mb_iconinformation + mb_defbutton1)
- else
- begin
- application.messagebox('密码修改失败', '物资管理系统', mb_iconinformation + mb_defbutton1);
- exit;
- end;
- close;
- end;
- //取消按钮点击过程
- procedure TfrmXgmm.btnCancelClick(Sender: TObject);
- begin
- close;
- end;
- //旧密码输入框按键处理过程
- procedure TfrmXgmm.edtOldPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- //如果按键是“回车键”,就输入焦点切换到新密码输入框
- if key = 13 then
- edtNewPassword.SetFocus;
- end;
- //新密码输入框按键处理过程
- procedure TfrmXgmm.edtNewPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- //如果按键是“回车键”,就输入焦点切换到确认密码输入框
- if key = 13 then
- edtConPassword.SetFocus;
- end;
- //确认密码输入框按键处理过程
- procedure TfrmXgmm.edtConPasswordKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- //如果按键是“回车键”,调用“确定”按钮点击过程
- if key = 13 then
- btnOK.click;
- end;
- end.