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

📄 xtdl.pas

📁 企业安防管理系统
💻 PAS
字号:
unit Xtdl;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls, jpeg, ExtCtrls;

type
  TForm6 = class(TForm)
    Image4: TImage;
    Edit1: TEdit;
    Edit2: TEdit;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Edit2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form6: TForm6;
  Num: Integer = 0;//记录登录数,如果三次登录失败将退出系统
  m: Boolean = False;//防止直接关闭窗体进入主程序
implementation
  uses DataModal,Main;
{$R *.dfm}

procedure TForm6.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key = vk_Return)and (Trim(Edit1.Text)<>'')then
    Edit2.SetFocus;
end;

procedure TForm6.Edit2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = vk_up then
    Edit1.SetFocus;
  if(Key = vk_ReTurn)and(Trim(Edit2.Text)<>'') then
    if Trim(Edit1.Text)<>'' then
      SpeedButton1.OnClick(Sender)
    else
      Edit1.SetFocus;
end;

procedure TForm6.SpeedButton1Click(Sender: TObject);
var
  qx: integer;//记录操作员权限
begin
  if (Trim(Edit1.Text)<>'')and(Trim(Edit2.Text)<>'')then
  begin
    with Data.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from 操作员信息表 where 操作员名称 = :a and 操作员密码 = :b ');
      Parameters.ParamByName('a').Value := Trim(Edit1.Text);
      Parameters.ParamByName('b').Value := Trim(Edit2.Text);
      Open;
    end;
    if Data.ADOQuery1.RecordCount>0 then
    begin
      m:= True;
      Czy := Data.ADOQuery1.FieldByName('操作员名称').Value;
      Czybh:= Data.ADOQuery1.FieldByName('操作员编号').Value;
      Form1.StatusBar1.Panels[3].Text := Czy;
      Czymm:= Data.ADOQuery1.FieldByName('操作员密码').Value;
      qx:= Data.ADOQuery1.FieldByName('操作员权限').Value;
      Form1.ShowMenu;
      Case qx of
        0: begin
             Form1.PNovisible;
           end;
        1: begin
             Form1.GNovisible;
           end;
       end;
       Close;
       Form1.Show;
    end
    else
    begin
      if Num< 2 then
      begin
        Inc(Num);
        Application.MessageBox('用户名或密码不正确.','提示',64);
        Edit1.Clear;
        Edit2.Clear;
        Edit1.SetFocus;
      end
      else
      begin
        Application.MessageBox('您无权使用本系统.','提示',64);
        Application.Terminate;
      end;
    end;
  end
  else
  begin
    Application.MessageBox('操作员名称或密码不能为空.','提示',64);
    Edit1.SetFocus;
  end;
end;

procedure TForm6.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if m = False then
    Application.Terminate;
end;

procedure TForm6.SpeedButton2Click(Sender: TObject);
begin
  Application.Terminate;
end;

end.

⌨️ 快捷键说明

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