ukl.pas
上传用户:jiete_yjc
上传日期:2010-02-11
资源大小:422k
文件大小:2k
源码类别:

医药行业

开发平台:

Delphi

  1. unit ukl;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Buttons,udm;
  6. type
  7.   TFkl = class(TForm)
  8.     old: TEdit;
  9.     new: TEdit;
  10.     new2: TEdit;
  11.     Label1: TLabel;
  12.     Label2: TLabel;
  13.     Label3: TLabel;
  14.     BitBtn1: TBitBtn;
  15.     BitBtn2: TBitBtn;
  16.     procedure BitBtn2Click(Sender: TObject);
  17.     procedure BitBtn1Click(Sender: TObject);
  18.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  19.     procedure FormActivate(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25. var
  26.   Fkl: TFkl;
  27. implementation
  28.  uses umain;
  29. {$R *.dfm}
  30. procedure TFkl.BitBtn2Click(Sender: TObject);
  31. begin
  32.   close;
  33. end;
  34. procedure TFkl.BitBtn1Click(Sender: TObject);
  35. begin
  36. if trim(old.Text)='' then
  37. begin
  38. showmessage('请录入旧密码');
  39. old.SetFocus;
  40. exit;
  41. end;
  42. if trim(new.Text)='' then
  43. begin
  44. showmessage('请录入新密码');
  45. new.SetFocus;
  46. exit;
  47. end;
  48. if trim(new2.Text)='' then
  49. begin
  50. showmessage('请验证新密码');
  51. new2.SetFocus;
  52. exit;
  53. end;
  54. if new.Text<>new2.Text then
  55. begin
  56. showmessage('请验证新密码');
  57. new2.SetFocus;
  58. exit;
  59. end;
  60. if adodm.tuser.Locate('userid',fmain.auser.id,[]) then
  61.   begin
  62.    if adodm.tuser.FieldByName('password').Asstring<>trim(old.Text) then
  63.       begin
  64.       showmessage('原密码不对!请重新录入');
  65.       old.SetFocus;
  66.       end
  67.     else
  68.       begin
  69.       adodm.tuser.Open;
  70.       adodm.tuser.Edit;
  71.       adodm.tuser.FieldByName('password').Asstring:=new.Text;
  72.       adodm.tuser.Post;
  73.       end;
  74.   end
  75.   else showmessage('当前用户信息被破坏,请重新录入后再进行修改');
  76.   close;
  77. end;
  78. procedure TFkl.FormClose(Sender: TObject; var Action: TCloseAction);
  79. begin
  80. action:=cafree;
  81. end;
  82. procedure TFkl.FormActivate(Sender: TObject);
  83. begin
  84. top:=150;
  85. end;
  86. end.