unit srvCobrosCliente_Impl; {----------------------------------------------------------------------------} { This unit was automatically generated by the RemObjects SDK after reading } { the RODL file associated with this project . } { } { This is where you are supposed to code the implementation of your objects. } {----------------------------------------------------------------------------} interface uses {vcl:} Classes, SysUtils, {RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions, {Ancestor Implementation:} DARemoteService_Impl, {Used RODLs:} DataAbstract_Intf, {Generated:} FactuGES_Intf, uDADataTable, uDABINAdapter, uDAClasses, uDAScriptingProvider, uDABusinessProcessor, uDAInterfaces; type { TsrvCobrosCliente } TsrvCobrosCliente = class(TDARemoteService, IsrvCobrosCliente) Diagrams: TDADiagrams; DABINAdapter: TDABINAdapter; bpCobros: TDABusinessProcessor; schCobrosCliente: TDASchema; DataDictionary: TDADataDictionary; procedure DARemoteServiceBeforeAcquireConnection(Sender: TDARemoteService; var ConnectionName: string); procedure DARemoteServiceAfterGetDatasetData(const Dataset: IDADataset; const IncludeSchema: Boolean; const MaxRecords: Integer); procedure DARemoteServiceCreate(Sender: TObject); private protected { IsrvCobrosCliente methods } function GetNextAutoInc(const GeneratorName: String): Integer; function GenerateReport(const CobroID: Integer): Binary; end; implementation {$R *.dfm} uses {Generated:} FactuGES_Invk, uDataModuleServer, uBizCobrosClienteServer, uDatabaseUtils, schCobrosClienteClient_Intf, uRestriccionesUsuarioUtils, uRptCobrosMontaje_Server; procedure Create_srvCobrosCliente(out anInstance : IUnknown); begin anInstance := TsrvCobrosCliente.Create(NIL); end; { srvCobrosCliente } procedure TsrvCobrosCliente.DARemoteServiceAfterGetDatasetData( const Dataset: IDADataset; const IncludeSchema: Boolean; const MaxRecords: Integer); begin if DataSet.Name = nme_CobrosCliente then begin { Aquí se asegura que el usuario sólo accede a facturas de las empresas a las que tiene permiso para acceder filtrando DataSet por ID_EMPRESA. } FiltrarAccesoUsuario(Session, Connection, schCobrosCliente, DataSet, fld_CobrosClienteID_EMPRESA); end; end; procedure TsrvCobrosCliente.DARemoteServiceBeforeAcquireConnection( Sender: TDARemoteService; var ConnectionName: string); begin ConnectionName := dmServer.ConnectionName; end; procedure TsrvCobrosCliente.DARemoteServiceCreate(Sender: TObject); begin SessionManager := dmServer.SessionManager; bpCobros.BusinessRulesID := BIZ_SERVER_COBROS_CLIENTE; end; function TsrvCobrosCliente.GenerateReport(const CobroID: Integer): Binary; var AReportGenerator : TRptCobrosMontaje; begin AReportGenerator := TRptCobrosMontaje.Create(nil); try Result := AReportGenerator.GenerarCobro(CobroID); finally FreeAndNIL(AReportGenerator); end; end; function TsrvCobrosCliente.GetNextAutoInc(const GeneratorName: String): Integer; begin Result := uDatabaseUtils.GetNextAutoInc(GeneratorName) end; initialization TROClassFactory.Create('srvCobrosCliente', Create_srvCobrosCliente, TsrvCobrosCliente_Invoker); finalization end.