am_yhgl_mms.~pas
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit am_yhgl_mms;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ExtCtrls, StdCtrls, Buttons, Mask, DBCtrlsEh, DB;
  6. type
  7.   Tam_yhgl_mm = class(TForm)
  8.     Image1: TImage;
  9.     Label1: TLabel;
  10.     GroupBox1: TGroupBox;
  11.     GroupBox2: TGroupBox;
  12.     DataSource1: TDataSource;
  13.     DBEditEh1: TDBEditEh;
  14.     DBEditEh2: TDBEditEh;
  15.     DBEditEh4: TDBEditEh;
  16.     Label2: TLabel;
  17.     Label3: TLabel;
  18.     Label4: TLabel;
  19.     Label5: TLabel;
  20.     SpeedButton1: TSpeedButton;
  21.     SpeedButton2: TSpeedButton;
  22.     DBEditEh3: TDBEditEh;
  23.     procedure SpeedButton2Click(Sender: TObject);
  24.     procedure DBEditEh2KeyPress(Sender: TObject; var Key: Char);
  25.     procedure DBEditEh3KeyPress(Sender: TObject; var Key: Char);
  26.     procedure DBEditEh4KeyPress(Sender: TObject; var Key: Char);
  27.     procedure DBEditEh2Exit(Sender: TObject);
  28.     procedure DBEditEh4Exit(Sender: TObject);
  29.     procedure SpeedButton1Click(Sender: TObject);
  30.     procedure FormCreate(Sender: TObject);
  31.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37. var
  38.   am_yhgl_mm: Tam_yhgl_mm;
  39. implementation
  40. uses dms,u_public,mainfrms;
  41. {$R *.dfm}
  42. procedure Tam_yhgl_mm.SpeedButton2Click(Sender: TObject);
  43. begin
  44.  close;
  45. end;
  46. procedure Tam_yhgl_mm.DBEditEh2KeyPress(Sender: TObject; var Key: Char);
  47. begin
  48.   if key=#13 then
  49.    begin
  50.      key:=#0;
  51.      selectNext(ActiveControl,true,true);
  52.    end;
  53. end;
  54. procedure Tam_yhgl_mm.DBEditEh3KeyPress(Sender: TObject; var Key: Char);
  55. begin
  56.    if key=#13 then
  57.    begin
  58.      key:=#0;
  59.      selectNext(ActiveControl,true,true);
  60.    end;
  61. end;
  62. procedure Tam_yhgl_mm.DBEditEh4KeyPress(Sender: TObject; var Key: Char);
  63. begin
  64.   {if key=#13 then
  65.    begin
  66.      key:=#0;
  67.      selectNext(ActiveControl,true,true);
  68.    end;}
  69. end;
  70. procedure Tam_yhgl_mm.DBEditEh2Exit(Sender: TObject);
  71. begin
  72.   if user_passWord<>Encrypt(trim(dbediteh2.Text)) then
  73.    begin
  74.       application.MessageBox('旧密码不正确','提示',mb_ok+mb_iconinformation);
  75.       dbediteh2.Text:='';
  76.       dbediteh2.SetFocus;
  77.       exit;
  78.    end;
  79. end;
  80. procedure Tam_yhgl_mm.DBEditEh4Exit(Sender: TObject);
  81. begin
  82.   if dbediteh4.Text<>dbediteh3.Text then
  83.    begin
  84.      application.MessageBox('请输入相同的密码','提示',mb_ok+mb_iconinformation);
  85.      dbediteh3.SetFocus;
  86.      exit;
  87.    end;
  88. end;
  89. procedure Tam_yhgl_mm.SpeedButton1Click(Sender: TObject);
  90. var N:integer;
  91. begin
  92.   if dbediteh4.Text<>dbediteh3.Text then
  93.    begin
  94.      application.MessageBox('请输入相同的密码','提示',mb_ok+mb_iconinformation);
  95.      dbediteh3.SetFocus;
  96.      exit;
  97.    end;
  98.   dm.xt_user.Edit;
  99.   dm.xt_user.FieldByName('user_dm').AsString:=user_dm;
  100.   dm.xt_user.FieldByName('user_name').AsString:=user_name;
  101.   dm.xt_user.FieldByName('user_passWord').AsString:=Encrypt(trim(dbediteh3.Text));
  102.   N:=dm.xt_user.ApplyUpdates(0);
  103.   if n=0 then
  104.    begin
  105.      application.MessageBox('密码修改成功','提示',mb_ok+mb_iconinformation);
  106.      close;
  107.    end
  108.   else
  109.    begin
  110.      application.MessageBox('密码修改失败','提示',mb_ok+mb_iconinformation);
  111.      exit;
  112.    end;
  113. end;
  114. procedure Tam_yhgl_mm.FormCreate(Sender: TObject);
  115. begin
  116.   dm.xt_user.Active:=true;
  117.   dm.xt_user.Edit;
  118.   dbediteh1.Text:=user_dm;
  119. end;
  120. procedure Tam_yhgl_mm.FormClose(Sender: TObject; var Action: TCloseAction);
  121. begin
  122.  dm.xt_user.Active:=false; 
  123.  action:=cafree;
  124.  am_yhgl_mm:=nil;
  125. end;
  126. end.