unit uConexionOSC;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uFrameConfiguracion, ActnList, StdCtrls, cxControls, cxContainer,
  cxEdit, cxTextEdit, cxDBEdit, DB;

type
  TfrConexionOSC = class(TFrameConfiguracion)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    bComprobar: TButton;
    ActionList1: TActionList;
    actAceptar: TAction;
    actCancelar: TAction;
    actComprobar: TAction;
    edtBDSERVER: TcxTextEdit;
    procedure actComprobarExecute(Sender: TObject);
  protected
    procedure Finalize; override;
  public
    procedure Init; override;
  end;

var
  frConexionOSC: TfrConexionOSC;

implementation

uses
  uTiendaWebUtils, uDataModuleServer;

{$R *.dfm}

procedure TfrConexionOSC.actComprobarExecute(Sender: TObject);
var
  AErrorMsg : String; 
begin
  if HayConexionConTienda(edtBDSERVER.Text, AErrorMsg) then
    ShowMessage('Conexión válida con la tienda')
  else
    ShowMessage('No se ha podido establecer la conexión con la tienda web.' +
      #10#13 + #10#13 + AErrorMsg);
end;

procedure TfrConexionOSC.Finalize;
begin
  dmServer.FOSCServer := edtBDSERVER.Text;
end;

procedure TfrConexionOSC.Init;
begin
  edtBDSERVER.Text := dmServer.FOSCServer;
end;

end.
