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

📄 loginformunit.pas

📁 人事管理系统帮助人们管理复杂的关系
💻 PAS
字号:
unit LoginFormUnit;

interface

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

type
  TLoginForm = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    Panel2: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    edtAccount: TEdit;
    Label3: TLabel;
    edtPwd: TEdit;
    Label4: TLabel;
    CBPurview: TComboBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  LoginForm: TLoginForm;

implementation

uses DataMUnit, MainFormUnit;

{$R *.dfm}

procedure TLoginForm.Button1Click(Sender: TObject);
begin
  if CBPurview.Text = '普通员工' then
    begin

      if DataM.ADOMSG.Active = true then
        DataM.ADOMSG.Close;

      DataM.ADOMSG.SQL.Clear;
      DataM.ADOMSG.SQL.Text:='select * from MSG Where 员工姓名 = '''+edtAccount.Text
                              + '''';
      DataM.ADOMSG.Prepared;
      DataM.ADOMSG.Open;

      if DataM.ADOMSG.RecordCount <> 0 then
        begin

          if edtPwd.Text = DataM.ADOMSG.FieldValues['密码'] then
            begin
              MainForm.Show;
              LoginForm.Hide;
            end
          else
            MessageBox(0,'密码错误!','人事管理系统V1.0',MB_OK+MB_ICONWARNING);

        end
      else
        begin
          MessageBox(0,'用户名不存在!','人事管理系统V1.0',MB_OK+MB_ICONWARNING);
        end;

    end
  else
    begin

      if DataM.ADOLogin.Active = true then
        DataM.ADOLogin.Close;

      DataM.ADOLogin.SQL.Clear;
      DataM.ADOLogin.SQL.Text:='select * from Login Where User = '''+edtAccount.Text
                              + '''';
      DataM.ADOLogin.Prepared;
      DataM.ADOLogin.Open;

      if DataM.ADOLogin.RecordCount <> 0 then
        begin

          if edtPwd.Text = DataM.ADOLogin.FieldValues['Pwd'] then
            begin

              if CBPurview.Text = DataM.ADOLogin.FieldValues['Purview'] then
                begin
                  MainForm.Show;
                  LoginForm.Hide;
                end
              else
                begin
                  MessageBox(0,'身份不匹配!','人事管理系统V1.0',MB_OK+MB_ICONWARNING);
                end;

            end
          else
            begin
              MessageBox(0,'密码错误!','人事管理系统V1.0',MB_OK+MB_ICONWARNING);
            end;

        end
      else
        MessageBox(0,'用户名不存在!','人事管理系统V1.0',MB_OK+MB_ICONWARNING);

    end;
end;

procedure TLoginForm.Button2Click(Sender: TObject);
begin
  CLOSE;
end;

end.

⌨️ 快捷键说明

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