unit uDataModuleInformes; interface uses SysUtils, Classes, DB, DBClient, uDAClientDataModule, uDADataTable, uDAScriptingProvider, uDACDSDataTable, uROClient, uROServiceComponent, uRORemoteService, uROBinMessage, uROWinInetHttpChannel, uDADesigntimeCall, uDABINAdapter, uBizInformes, uIDataModuleInformes; type TdmInformes = class(TDAClientDataModule, IDataModuleInformes) DABinAdapter: TDABINAdapter; RORemoteService: TRORemoteService; DADesigntimeCall1: TDADesigntimeCall; LoginRemoteService: TRORemoteService; ROWinInetHTTPChannel1: TROWinInetHTTPChannel; ROBinMessage1: TROBinMessage; tbl_Informes: TDACDSDataTable; ds_Informes: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); protected function _CloneDataTable (const ADataTable : TDACDSDataTable): TDACDSDataTable; overload; public function GetNextID(const DataSetName : String) : Integer; // function GetItems (const ACategoria : String): TDACDSDataTable; overload; function GetItems : IBizInforme; overload; end; var dmInformes: TdmInformes; implementation {$R *.DFM} uses FactuGES_Intf, uDataTableUtils, uDataModuleConexion, schInformesClient_Intf, cxControls; procedure TdmInformes.DAClientDataModuleCreate(Sender: TObject); begin RORemoteService.Channel := dmConexion.Channel; RORemoteService.Message := dmConexion.Message; end; {function TdmInformes.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;} function TdmInformes.GetItems: IBizInforme; var AInformes : TDACDSDataTable; begin ShowHourglassCursor; try AInformes := _CloneDataTable(tbl_Informes); AInformes.BusinessRulesID := BIZ_CLIENT_INFORMES; Result := (AInformes as IBizInforme); finally HideHourglassCursor; end; end; function TdmInformes.GetNextID(const DataSetName: String): Integer; var aGeneratorName : String; begin if DataSetName = nme_Informes then aGeneratorName := 'GEN_INFORMES_ID'; Result := (RORemoteService as IsrvInformes).GetNextAutoInc(aGeneratorName) end; function TdmInformes._CloneDataTable(const ADataTable: TDACDSDataTable): TDACDSDataTable; begin Result := NIL; if not Assigned(ADataTable) then raise Exception.Create ('No se ha asignado la tabla de origen (CloneDataTable)'); Result := TDACDSDataTable.Create(NIL); CloneDataTable(ADataTable, Result); end; end.