unit srvObras_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, uDAClasses, uDAScriptingProvider,
  uDABusinessProcessor, uDADataTable, uDABINAdapter;

type
  { TsrvObras }
  TsrvObras = class(TDARemoteService, IsrvObras)
    bpContactosObra: TDABusinessProcessor;
    bpObras: TDABusinessProcessor;
    bpPresupuestosObra: TDABusinessProcessor;
    DABINAdapter: TDABINAdapter;
    schObras: TDASchema;
  private
  protected
    { IsrvObras methods }
    function getCodigo(const GeneratorName: String): Integer;
  end;

implementation

{$R *.dfm}
uses
  {Generated:} FactuGES_Invk, uDataModuleServer, uDAInterfaces;

procedure Create_srvObras(out anInstance : IUnknown);
begin
  anInstance := TsrvObras.Create(NIL);
end;

{ srvObras }
function TsrvObras.getCodigo(const GeneratorName: String): Integer;
var
  ds: IDADataset;
begin
  ds := Connection.NewDataset(Format('SELECT Gen_id(%s,1) FROM RDB$DataBase', [GeneratorName]));
  ds.Open;
  Result := ds.Fields[0].Value;
  ds.Close;
end;

{ srvObras }
initialization
  TROClassFactory.Create('srvObras', Create_srvObras, TsrvObras_Invoker);

finalization

end.
