unit LoginUnit;

interface

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

type
  TLoginForm = class(TForm)
    Label1: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    BtnConfirm: TButton;
    BtnQuit: TButton;
    procedure BtnConfirmClick(Sender: TObject);
    procedure BtnQuitClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  LoginForm: TLoginForm;

implementation

{$R *.dfm}
uses ExamUnit;  //ExamUnit是对话框Form2的单元文件
const glmm='ksxt'; //定义管理员密码
procedure TLoginForm.BtnConfirmClick(Sender: TObject);
begin
  if (not RadioButton1.checked) and (not RadioButton2.Checked)  then
    MessageDlg('请选择用户身份！',mtWarning,[mbOK],0);  //必须选择用户身份
  if  RadioButton1.checked  then   //用户身份为管理员
    if edit1.text=glmm then
      begin
         ExamForm.caption:=' 系统管理';
         ExamForm.ShowModal;
         close;
      end
    else
        MessageDlg('密码错误,请重新输入!',mtError,[mbOK],0);
  if RadioButton2.checked then  //用户身份为考生
    if Length(Edit2.text)<>8 then
      MessageDlg('重新输入准考号！',mtWarning,[mbOK],0)
    else
      begin
        ExamForm.caption:='祝你成功';
        ExamForm.ShowModal;
        close;
      end;
end;

procedure TLoginForm.BtnQuitClick(Sender: TObject);
begin
  close;
end;

end.
