unit6.pas

来自「商品管理系统是面向超市类的商品数据库管理系统。其主要功能包括用户购买商品」· PAS 代码 · 共 105 行

PAS
105
字号
unit Unit6;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm6 = class(TForm)
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form6: TForm6;
  inputtimes:integer;

implementation

uses Unit7, maen;

{$R *.DFM}

procedure TForm6.FormActivate(Sender: TObject);

  //inputstimes:integer;
begin
     edit1.text:='';
     inputtimes:=0;
end;

procedure TForm6.Button1Click(Sender: TObject);
var
   password1:textfile;
   passwordstr1:string;
   password:textfile;
   passwordstr:string;
   //inputstimes:integer;
begin
     if form6.Caption='经理输入密码' then
     begin
     assignfile(password,'config1.cfg');
     reset(password);
     readln(password,passwordstr);
     closefile(password);
     inputtimes:=inputtimes+1;
     if inputtimes<=3 then
       begin
           if edit1.Text=passwordstr then
               begin
                 form7.show;
                 close;
                end   else
               begin
                 edit1.Text:='';
                 showmessage('密码错误,请重新输入');
               end;
       end
    else
      begin
       showmessage('密码错误,你已经无权使用该系统');
       application.Terminate;
      end;
     end;

     if form6.Caption='管理员输入密码' then
     begin
     assignfile(password1,'config.cfg');
     reset(password1);
     readln(password1,passwordstr1);
     closefile(password1);
     inputtimes:=inputtimes+1;
     if inputtimes<=3 then
       begin
         if edit1.Text=passwordstr1 then
            begin
              form2.show;
              close;
            end else
            begin
             edit1.Text:='';
             showmessage('密码错误,请重新输入');
            end;
       end
    else
      begin
       showmessage('密码错误,你已经无权使用该系统');
       application.Terminate;
      end;
    end;
end;

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

end.

⌨️ 快捷键说明

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