unit uDataModuleParametros;

interface

uses {vcl:} SysUtils, Classes, DB, DBClient,
     {RemObjects:} uDAClientDataModule, uDADataTable, uDAScriptingProvider,
  uDACDSDataTable, uDABINAdapter, uDataModuleBase, uROClient,
  uROServiceComponent, uRORemoteService, uBizParametros, uDARemoteDataAdapter,
  uDAInterfaces;

type
  TdmParametros = class(TDAClientDataModule)
    RORemoteService: TRORemoteService;
    tbl_ListaCentros: TDACDSDataTable;
    ds_ListaCentros: TDADataSource;
    tbl_ListaColecciones: TDACDSDataTable;
    dsListaColecciones: TDADataSource;
    DARemoteDataAdapter: TDARemoteDataAdapter;
    procedure DAClientDataModuleCreate(Sender: TObject);
  public
    function GetCentros : IBizCentros;
    function GetColecciones : IBizColecciones;
  end;

var
  dmParametros: TdmParametros;

implementation

{$R *.DFM}

uses
  Forms, Windows, Controls, VARELA_Intf, uEditorPreview,
  uDataTableUtils, uROTypes, cxControls;

procedure TdmParametros.DAClientDataModuleCreate(Sender: TObject);
begin
  RORemoteService.Channel := dmBase.Channel;
  RORemoteService.Message := dmBase.Message;
end;

function TdmParametros.GetCentros: IBizCentros;
var
  dtLista: TDACDSDataTable;
begin
  ShowHourglassCursor;
  try
    dtLista := TDACDSDataTable.Create(NIL);
    CloneDataTable(tbl_ListaCentros, dtLista);
    dtLista.BusinessRulesID := BIZ_CENTROS;
    Result := (dtLista as IBizCentros);
  finally
    HideHourglassCursor;
  end;
end;

function TdmParametros.GetColecciones: IBizColecciones;
var
  dtLista: TDACDSDataTable;
begin
  ShowHourglassCursor;
  try
    dtLista := TDACDSDataTable.Create(NIL);
    CloneDataTable(tbl_ListaColecciones, dtLista);
    dtLista.BusinessRulesID := BIZ_COLECCIONES;
    Result := (dtLista as IBizColecciones);
  finally
    HideHourglassCursor;
  end;
end;

initialization
  dmParametros := TdmParametros.Create(nil);

finalization
  FreeAndNil(dmParametros);

end.
