From f8d2253dfdb30d58dfcd7e4e1793f0b97a65bb7b Mon Sep 17 00:00:00 2001 From: roberto Date: Fri, 18 Nov 2011 10:33:15 +0000 Subject: [PATCH] =?UTF-8?q?Conexi=C3=B3n=20autom=C3=A1tica=20sin=20pantall?= =?UTF-8?q?a=20de=20login=20S=C3=B3lo=20aparece=20si=20hay=20alg=C3=BAn=20?= =?UTF-8?q?error=20de=20conexi=C3=B3n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.FarmaciaPH_Etiquetas/trunk@10 7b0b1a58-4aa1-b946-8089-8453ede31e50 --- Source/ApplicationBase/uFactuGES_App.pas | 18 ++++++++++++++++-- Source/Base/Conexion/uDataModuleConexion.pas | 15 +++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Source/ApplicationBase/uFactuGES_App.pas b/Source/ApplicationBase/uFactuGES_App.pas index f1d4011..3505c16 100644 --- a/Source/ApplicationBase/uFactuGES_App.pas +++ b/Source/ApplicationBase/uFactuGES_App.pas @@ -154,7 +154,7 @@ implementation uses Windows, Dialogs, JSDialog, JSDialogs, uDialogUtils, cxControls, uUsuariosViewRegister, - uEmpresasViewRegister, uAppInfoUtils, uDMBase; + uEmpresasViewRegister, uAppInfoUtils, uDMBase, uDataModuleConexion, Controls; procedure TAppFactuGES.CambiarEmpresa(const AIDEmpresa: Integer); var @@ -338,8 +338,22 @@ begin end; procedure TAppFactuGES.Run; +var + ALogin : Boolean; + AResult : TModalResult; begin - if UsuariosController.StartLogin then + while not dmConexion.HayConexion do + begin + AResult := dmConexion.ConfigurarConexion; + if AResult <> mrOK then + Exit; + end; + + ALogin := UsuariosController.ComprobarUsuario('admin', '1'); + if not ALogin then + ALogin := UsuariosController.StartLogin; + + if ALogin then begin ShowHourglassCursor; ShowSplashForm; diff --git a/Source/Base/Conexion/uDataModuleConexion.pas b/Source/Base/Conexion/uDataModuleConexion.pas index e49e3ce..78b6e29 100644 --- a/Source/Base/Conexion/uDataModuleConexion.pas +++ b/Source/Base/Conexion/uDataModuleConexion.pas @@ -4,7 +4,7 @@ interface uses SysUtils, Classes, uRORemoteService, uDADataTable, - uDABINAdapter, uROClient, uROBinMessage, + uDABINAdapter, uROClient, uROBinMessage, Dialogs, Controls, uDADataStreamer, uROWinInetHttpChannel; const @@ -27,7 +27,7 @@ type public function HayConexion : Boolean; function ProbarConexion(const ATargetURL : String): Boolean; - procedure ConfigurarConexion; + function ConfigurarConexion: TModalResult; property TargetURL : String read GetTargetURL write SetTargetURL; property Channel: TROTransportChannel read GetChannel; property Message: TROBinMessage read GetMessage; @@ -41,7 +41,7 @@ implementation {$R *.dfm} uses - uROEncryption, Windows, WinInet, cxControls, uConfigurarConexion, Dialogs, Controls, + uROEncryption, Windows, WinInet, cxControls, uConfigurarConexion, uDMBase, Etiquetas_Intf, uDialogUtils; const @@ -59,20 +59,19 @@ begin Result := ROChannel.Connected; end; -procedure TdmConexion.ConfigurarConexion; +function TdmConexion.ConfigurarConexion: TModalResult; begin with TfConfigurarConexion.Create(NIL) do try TargetURL := ROChannel.TargetURL; - if ShowModal = mrOk then + Result := ShowModal; + if Result = mrOk then begin ROChannel.TargetURL := TargetURL; - ROChannel.Connected := False; - ROChannel.Connected := True; dmBase.SalvarConfiguracion; end; finally - Free; + Release; end; end;