git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES/trunk@4 3f40d355-893c-4141-8e64-b1d9be72e7e7
116 lines
3.0 KiB
ObjectPascal
116 lines
3.0 KiB
ObjectPascal
unit PantallaAcceso;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||
cxContainer, cxEdit, cxControls, cxTextEdit, ExtCtrls, StdCtrls,
|
||
RdxBotones, RdxPaneles, pngimage, cxMaskEdit, cxDropDownEdit,
|
||
cxImageComboBox, cxDBEdit, JvFormPlacement, JvComponent, JvAppStorage,
|
||
JvAppRegistryStorage, cxGraphics, JvComponentBase;
|
||
|
||
type
|
||
TfPantallaAcceso = class(TForm)
|
||
pnlBarraSuperior: TRdxGradientePanel;
|
||
pnlInferior: TPanel;
|
||
bSalir: TRdxBoton;
|
||
bAceptar: TRdxBoton;
|
||
Shape1: TShape;
|
||
eBienvenido: TLabel;
|
||
eTexto: TLabel;
|
||
lblFullName: TLabel;
|
||
lblOrg: TLabel;
|
||
Image1: TImage;
|
||
imgFondo: TImage;
|
||
Image2: TImage;
|
||
imgSombra: TImage;
|
||
Label1: TLabel;
|
||
eEmpresa: TLabel;
|
||
eVersion: TLabel;
|
||
Image3: TImage;
|
||
Shape2: TShape;
|
||
Usuario: TcxTextEdit;
|
||
Clave: TcxTextEdit;
|
||
JvAppRegistryStorage1: TJvAppRegistryStorage;
|
||
JvFormStorage1: TJvFormStorage;
|
||
Timer1: TTimer;
|
||
Label2: TLabel;
|
||
cbBD: TcxComboBox;
|
||
procedure bAceptarClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure JvFormStorage1StoredValues0Save(Sender: TJvStoredValue;
|
||
var AValue: Variant);
|
||
procedure FormActivate(Sender: TObject);
|
||
procedure Timer1Timer(Sender: TObject);
|
||
private
|
||
FRuta : String;
|
||
property Ruta : String read FRuta write FRuta;
|
||
public
|
||
Version : string;
|
||
end;
|
||
|
||
var
|
||
fPantallaAcceso: TfPantallaAcceso;
|
||
|
||
implementation
|
||
|
||
{$R *.DFM}
|
||
|
||
uses
|
||
Principal, BaseDatos, IB, Mensajes, Configuracion, StrFunc, SysFunc,
|
||
Excepciones;
|
||
|
||
procedure TfPantallaAcceso.bAceptarClick(Sender: TObject);
|
||
begin
|
||
dmBaseDatos.NombreBD := cbBD.Text;
|
||
try
|
||
Ruta := ListaBD.Values[cbBD.Text];
|
||
dmBaseDatos.Conectar(Ruta, Usuario.Text, Clave.Text);
|
||
JvFormStorage1.SaveFormPlacement;
|
||
ModalResult := mrOk;
|
||
except
|
||
on E : EIBError do begin
|
||
TratarExcepcion(E);
|
||
Usuario.SetFocus;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfPantallaAcceso.FormShow(Sender: TObject);
|
||
var
|
||
i : integer;
|
||
begin
|
||
eVersion.Caption := 'Versi<73>n: ' + Version;
|
||
|
||
//Bases de datos
|
||
cbBD.Properties.Items.Clear;
|
||
for i := 0 to ListaBD.Count - 1 do
|
||
cbBD.Properties.Items.Add(ListaBD.Names[i]);
|
||
cbBD.Text := cbBD.Properties.Items.Strings[0];
|
||
ConfigurarPantallaAcceso(Self);
|
||
end;
|
||
|
||
procedure TfPantallaAcceso.JvFormStorage1StoredValues0Save(
|
||
Sender: TJvStoredValue; var AValue: Variant);
|
||
begin
|
||
AValue := ExtractFilePath(Application.ExeName);
|
||
end;
|
||
|
||
procedure TfPantallaAcceso.FormActivate(Sender: TObject);
|
||
begin
|
||
JvFormStorage1.RestoreFormPlacement;
|
||
// Hacer login autom<6F>tica si hay usuario/password y no hay m<>s de una base
|
||
// de datos como opci<63>n para conectarse.
|
||
if (cbBD.Properties.Items.Count < 2) and
|
||
((not EsCadenaVacia(Usuario.Text)) and (not EsCadenaVacia(Clave.Text))) then
|
||
Timer1.Enabled := True;
|
||
end;
|
||
|
||
procedure TfPantallaAcceso.Timer1Timer(Sender: TObject);
|
||
begin
|
||
Timer1.Enabled := False;
|
||
bAceptar.Click;
|
||
end;
|
||
|
||
end.
|