⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chgpwd.pas

📁 销售帐目管理
💻 PAS
字号:
unit ChgPwd;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, SUIForm, SUIDlg, SUIButton;

type
  TFrmChgPwd = class(TForm)
    suiForm1: TsuiForm;
    Image3: TImage;
    Label_user: TLabel;
    Label1: TLabel;
    Edit_pwd1: TEdit;
    Label3: TLabel;
    Edit_pwd2: TEdit;
    Panel1: TPanel;
    suiMessageDialog1: TsuiMessageDialog;
    suiButton1: TsuiButton;
    suiButton2: TsuiButton;
    procedure FormShow(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmChgPwd: TFrmChgPwd;

implementation
  uses yhgl, Main, DataModule, pubunit;
{$R *.DFM}

procedure TFrmChgPwd.FormShow(Sender: TObject);
begin
  Edit_pwd1.SetFocus ;
end;

procedure TFrmChgPwd.Button2Click(Sender: TObject);
begin
  close;
end;

procedure TFrmChgPwd.Button1Click(Sender: TObject);
begin
       if trim(uppercase(Edit_Pwd1.Text)) <> Trim(uppercase(Edit_Pwd2.Text)) then begin
          Edit_pwd1.SetFocus ;
          suiMessageDialog1.ButtonCount := 1;
          suiMessageDialog1.Button1Caption := '确定(&S)';
          suiMessageDialog1.Button1ModalResult := mrOK;
          suiMessageDialog1.Caption := Self.Caption ;
          suiMessageDialog1.IconType := suiStop;
          suiMessageDialog1.Text := '新密码和确认密码不一致!';
          suiMessageDialog1.ShowModal ;
          Exit;
       end;
       with DataModule1.tbl_Power do begin
          Edit;
          Fieldvalues['密码']:=trim(Edit_pwd1.Text);
       end;
       close;
end;

procedure TFrmChgPwd.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
  with DataModule1 do
  begin
    tbl_Power.Next ;
    if tbl_Power.UpdatesPending then
    begin
       suiMessageDialog1.ButtonCount := 2;
       suiMessageDialog1.Button1Caption := '是';
       suiMessageDialog1.Button1ModalResult := mrYes;
       suiMessageDialog1.Button2Caption := '否';
       suiMessageDialog1.Button2ModalResult := mrNo ;
       suiMessageDialog1.Caption := suiForm1.Caption ;
       suiMessageDialog1.IconType := suiHelp ;
       suiMessageDialog1.Text := '是否保存所改变的密码?' ;
       if suiMessageDialog1.ShowModal = mrNo then
       begin
         tbl_Power.CancelUpdates ;
         Exit ;
       end;
       try
         db1.StartTransaction ;
         tbl_Power.ApplyUpdates ;
         tbl_Power.CommitUpdates ;
         db1.Commit ;
       except
         on E : Exception do
         begin
           suiMessageDialog1.ButtonCount := 1;
           suiMessageDialog1.Button1Caption := '确定(&S)';
           suiMessageDialog1.Button1ModalResult := mrOK;
           suiMessageDialog1.Caption := Self.Caption ;
           suiMessageDialog1.IconType := suiStop;
           suiMessageDialog1.Text := '数据错误无法保存:'+E.Message ;
           suiMessageDialog1.ShowModal ;
           tbl_Power.CancelUpdates ;
           db1.Rollback ;
           Abort ;
         end;
       end;
    end;
  end;
end;

procedure TFrmChgPwd.FormCreate(Sender: TObject);
begin
  ChangeInterface(Self,suiForm1);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -