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;