unit Ulogin;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.DBCtrls, Vcl.StdCtrls,
  Vcl.Imaging.pngimage, Vcl.ExtCtrls, Vcl.Buttons;

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Udm, Uconexion, UPrincipal;

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

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

end.
