unit Uentrada;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
  Buttons, DBCtrls, ExtCtrls, variants, dialogs;

type
  TPasswordDlg = class(TForm)
    Label1: TLabel;
    Password: TEdit;
    DBLookupComboBox1: TDBLookupComboBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Image1: TImage;
    Label2: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure DBLookupComboBox1CloseUp(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  PasswordDlg: TPasswordDlg;

implementation

uses Udm, UPrincipal, Uconexion;

{$R *.dfm}

procedure TPasswordDlg.BitBtn1Click(Sender: TObject);
begin
if not (dm.Tusuarios.Locate('Usuario;pass', vararrayof([DBLookupComboBox1.text, Password.Text]), [])) then
   messageDLG('Acceso Denegado',mterror,[mbok],0)
  else
   begin
    hide;
    Form1.Show;
   end
end;

procedure TPasswordDlg.BitBtn2Click(Sender: TObject);
begin
close
end;

procedure TPasswordDlg.DBLookupComboBox1CloseUp(Sender: TObject);
begin
Password.SetFocus;
end;

procedure TPasswordDlg.FormCreate(Sender: TObject);
begin
if not(conectar(dm.conector,'empleados','','',application)) then
 begin
    messageDLG('Error de conexión con la BD', mterror, [mbok],0)
 end
 else
   dm.Tusuarios.Active:= true
end;

end.

