unit uDataModuleControles;

interface

uses {vcl:} SysUtils, Classes, DB, DBClient, 
     {RemObjects:} uDAClientDataModule, uDADataTable, uDAScriptingProvider,
  uDACDSDataTable, uROClient, uROServiceComponent, uRORemoteService;

type
  TdmControles = class(TDAClientDataModule)
    RemoteService: TRORemoteService;
    tbl_Controles: TDACDSDataTable;
    ds_Controles: TDADataSource;
    procedure DAClientDataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    function GetItems (const ACategoria : String): TDACDSDataTable;
  end;

var
  dmControles: TdmControles;

implementation

{$R *.DFM}

uses
  Forms, Controls,
  schControlesClient_Intf,
  uDataModuleBase, uDataTableUtils, DataAbstract_Intf, cxControls;

procedure TdmControles.DAClientDataModuleCreate(Sender: TObject);
begin
  RemoteService.Channel := dmBase.Channel;
  RemoteService.Message := dmBase.Message;
end;

function TdmControles.GetItems (const ACategoria : String): TDACDSDataTable;
var
  dtControles: TDACDSDataTable;
  AParams : TDADatasetParamArray;
begin
  ShowHourglassCursor;
  try
    dtControles := TDACDSDataTable.Create(NIL);
    CloneDataTable(tbl_Controles, dtControles);

    AParams := TDADatasetParamArray.Create;
    with AParams.Add do begin
      Name := fld_ListaControlesPorCategoriaCATEGORIA;
      Value := ACategoria;
    end;

    dtControles.DataRequestCall.ParamByName(par_Params).AsComplexType := AParams;

    Result := dtControles;
  finally
    HideHourglassCursor;
  end;
end;

initialization
  dmControles := TdmControles.Create(nil);

finalization
  FreeAndNil(dmControles);

end.

