unit srvRemesasCliente_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:} DataAbstractService_Impl,
  {Used RODLs:} DataAbstract4_Intf,
  {Generated:} uDABusinessProcessor, uDABin2DataStreamer, uDADataStreamer,
  uDAScriptingProvider, uDAClasses,
  FactuGES_Intf, uDAInterfaces, uDABinAdapter;

type
  { TsrvRemesasCliente }
  TsrvRemesasCliente = class(TDataAbstractService, IsrvRemesasCliente)
    Diagrams: TDADiagrams;
    bpRemesasCliente: TDABusinessProcessor;
    Bin2DataStreamer: TDABin2DataStreamer;
    schRemesasCliente: TDASchema;
    DataDictionary: TDADataDictionary;
    procedure DARemoteServiceCreate(Sender: TObject);
    procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset;
      const IncludeSchema: Boolean; const MaxRecords: Integer);
    procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
      var aConnectionName: string);
  protected
    { IsrvRemesasCliente methods }
    function GenerateReport(const ID: String): Binary;
  end;

implementation

{$R *.dfm}
uses
  {Generated:} FactuGES_Invk, uDataModuleServer,
  uDatabaseUtils, schRemesasClienteClient_Intf, uRestriccionesUsuarioUtils,
  uBizRemesasClienteServer,
//  uRptRemesasCliente_Server,
  Dialogs;

procedure Create_srvRemesasCliente(out anInstance : IUnknown);
begin
  anInstance := TsrvRemesasCliente.Create(NIL);
end;

{ srvRemesasCliente }

procedure TsrvRemesasCliente.DARemoteServiceBeforeGetDatasetData(
  const Dataset: IDADataset; const IncludeSchema: Boolean;
  const MaxRecords: Integer);
begin
  if DataSet.Name = nme_RemesasCliente then
  begin
    { Aquí se asegura que el usuario sólo accede a los RemesasCliente
      de las empresas a las que tiene permiso para acceder
      filtrando DataSet por ID_EMPRESA. }
    FiltrarAccesoUsuario(Session, Connection, schRemesasCliente, DataSet, fld_RemesasClienteID_EMPRESA);
  end;
end;

procedure TsrvRemesasCliente.DARemoteServiceCreate(Sender: TObject);
begin
  //SessionManager := dmServer.SessionManager;
  bpRemesasCliente.BusinessRulesID := BIZ_SERVER_REMESAS_CLIENTE;  
end;

procedure TsrvRemesasCliente.DataAbstractServiceBeforeAcquireConnection(
  aSender: TObject; var aConnectionName: string);
begin
  ConnectionName := dmServer.ConnectionName;
end;

function TsrvRemesasCliente.GenerateReport(const ID: String): Binary;
//var
//  AReportGenerator : TRptRemesasCliente;
begin
  Result := NIL;
{  AReportGenerator := TRptRemesasCliente.Create(nil);
  try
    Result := AReportGenerator.GenerarRemesa(ID);
  finally
    FreeAndNIL(AReportGenerator);
  end;
}  
end;

initialization
  TROClassFactory.Create('srvRemesasCliente', Create_srvRemesasCliente, TsrvRemesasCliente_Invoker);

finalization

end.
