This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Contactos/Servidor/srvContactos_Impl.pas
2014-07-14 17:22:53 +00:00

115 lines
3.5 KiB
ObjectPascal

unit srvContactos_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, uDAScriptingProvider, uDABusinessProcessor,
uDAClasses, uDADataTable, uDAInterfaces, uDAEngine, uDAIBXDriver, DB,
IBDatabase, frxClass, frxIBXComponents, uDACDSDataTable, uDABINAdapter,
frxDBSet, frxExportPDF;
type
{ TsrvContactos }
TsrvContactos = class(TDARemoteService, IsrvContactos)
DACDSDataTable1: TDACDSDataTable;
DADataSource1: TDADataSource;
frxDBDataset1: TfrxDBDataset;
frxReport1: TfrxReport;
DABINAdapter: TDABINAdapter;
bpContactos: TDABusinessProcessor;
schContactos: TDASchema;
procedure DARemoteServiceActivate(const aClientID: TGUID; aSession:
TROSession; const aMessage: IROMessage);
procedure DARemoteServiceCreate(Sender: TObject);
protected
function GenerateReport: Binary;
function GetNextAutoinc: Integer;
function PuedoEliminarContacto(const CodigoContacto: Integer): Boolean;
end;
implementation
{$R *.dfm}
uses
{Generated:} FactuGES_Invk,
Dialogs, schContactosClient_Intf, fServerForm, IB,
Variants, schContactosServer_Intf, uDataModuleServer;
procedure Create_srvContactos(out anInstance : IUnknown);
begin
anInstance := TsrvContactos.Create(NIL);
end;
{ srvContactos }
{
******************************** TsrvContactos *********************************
}
procedure TsrvContactos.DARemoteServiceActivate(const aClientID: TGUID;
aSession: TROSession; const aMessage: IROMessage);
begin
((Connection as IDAConnectionObjectAccess).ConnectionObject as
TIBXConnection).Database.TraceFlags := [tfQPrepare, tfQExecute, tfQFetch, tfError, tfStmt, tfConnect, tfTransact, tfBlob, tfService, tfMisc];
end;
function TsrvContactos.GenerateReport: Binary;
var
AStream: TMemoryStream;
begin
AStream := TMemoryStream.Create;
Result := Binary.Create;
try
DACDSDataTable1.Active := True;
frxReport1.PrepareReport;
frxReport1.PreviewPages.SaveToStream(AStream);
Result.LoadFromStream(AStream);
finally
DACDSDataTable1.Active := False;
AStream.Free;
end;
end;
procedure TsrvContactos.DARemoteServiceCreate(Sender: TObject);
begin
//RequiresSession := True;
end;
function TsrvContactos.GetNextAutoinc: Integer;
begin
Result := uDataModuleServer.GetNextAutoinc(Connection, 'GEN_CONTACTOS');
end;
function TsrvContactos.PuedoEliminarContacto(
const CodigoContacto: Integer): Boolean;
var
dsContacto: IDASQLCommand;
begin
Result := True;
Connection.BeginTransaction;
try
dsContacto := schContactos.NewCommand(Connection, 'Delete_Contactos', ['OLD_CODIGO'], [CodigoContacto]);
except
on E: Exception do
Result := False;
end;
Connection.RollbackTransaction;
end;
initialization
TROClassFactory.Create('srvContactos', Create_srvContactos, TsrvContactos_Invoker);
finalization
end.