2008-03-23 20:18:10 +00:00
|
|
|
|
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:} DataAbstractService_Impl,
|
|
|
|
|
|
{Used RODLs:} DataAbstract4_Intf,
|
|
|
|
|
|
{Generated:} uDABusinessProcessor, uDABin2DataStreamer, uDADataStreamer,
|
|
|
|
|
|
uDAScriptingProvider, uDAClasses,
|
2008-10-27 19:03:34 +00:00
|
|
|
|
FactuGES_Intf, uDAInterfaces, uRORemoteDataModule;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
{ TsrvObras }
|
|
|
|
|
|
TsrvObras = class(TDataAbstractService, IsrvObras)
|
|
|
|
|
|
Diagrams: TDADiagrams;
|
|
|
|
|
|
Bin2DataStreamer: TDABin2DataStreamer;
|
|
|
|
|
|
bpObras: TDABusinessProcessor;
|
2008-10-27 19:03:34 +00:00
|
|
|
|
bpObrasEjecuciones: TDABusinessProcessor;
|
|
|
|
|
|
bpObrasEjecucionesPresupuestos: TDABusinessProcessor;
|
|
|
|
|
|
bpObrasEjecucionesPedidosProv: TDABusinessProcessor;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
schObras: TDASchema;
|
|
|
|
|
|
DataDictionary: TDADataDictionary;
|
2008-10-27 19:03:34 +00:00
|
|
|
|
procedure DataAbstractServiceAfterAcquireConnection(aSender: TObject;
|
|
|
|
|
|
const aConnectionName: string;
|
|
|
|
|
|
const aAcquiredConnection: IDAConnection);
|
|
|
|
|
|
procedure DataAbstractServiceAfterExecuteCommand(aSender: TObject;
|
|
|
|
|
|
const aCommand: IDASQLCommand; aRowsAffacted: Integer);
|
|
|
|
|
|
procedure DataAbstractServiceAfterGetDatasetSchema(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset);
|
|
|
|
|
|
procedure DataAbstractServiceAfterProcessDeltas(aSender: TObject;
|
|
|
|
|
|
aDeltaStructs: TDADeltaStructList);
|
|
|
|
|
|
procedure DataAbstractServiceAfterReleaseConnection(aSender: TObject;
|
|
|
|
|
|
const aConnectionName: string);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeExecuteCommand(aSender: TObject;
|
|
|
|
|
|
const aCommand: IDASQLCommand);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeGetDatasetData(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset; const aIncludeSchema: Boolean;
|
|
|
|
|
|
const aMaxRecords: Integer);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeGetDatasetSchema(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeProcessDeltas(aSender: TObject;
|
|
|
|
|
|
aDeltaStructs: TDADeltaStructList);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeReleaseConnection(aSender: TObject;
|
|
|
|
|
|
const aConnectionName: string;
|
|
|
|
|
|
const aAcquiredConnection: IDAConnection);
|
|
|
|
|
|
procedure DataAbstractServiceGetSchemaAsXMLEvent(aSender: TObject;
|
|
|
|
|
|
var aSchemaXML: string);
|
|
|
|
|
|
procedure DataAbstractServiceProcessDeltasError(aSender: TObject;
|
|
|
|
|
|
aDeltaStructs: TDADeltaStructList; aError: Exception;
|
|
|
|
|
|
var aDoRaise: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceUpdateDataBeginTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceUpdateDataCommitTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceUpdateDataRollBackTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceValidateCommandExecution(Sender: TObject;
|
|
|
|
|
|
const aConnection: IDAConnection; const aDatasetName: string;
|
|
|
|
|
|
const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; aSchema: TDASchema;
|
|
|
|
|
|
var Allowed: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceValidateDatasetAccess(Sender: TObject;
|
|
|
|
|
|
const aConnection: IDAConnection; const aDatasetName: string;
|
|
|
|
|
|
const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; aSchema: TDASchema;
|
|
|
|
|
|
var Allowed: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceValidateDirectSQLAccess(Sender: TObject;
|
|
|
|
|
|
const aConnection: IDAConnection; const aSQLText: string;
|
|
|
|
|
|
const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; var Allowed: Boolean);
|
|
|
|
|
|
procedure DataAbstractServiceAcquireConnectionFailure(aSender: TObject;
|
|
|
|
|
|
const aConnectionName: string; aError: Exception);
|
|
|
|
|
|
procedure DataAbstractServiceDestroy(Sender: TObject);
|
|
|
|
|
|
procedure DataAbstractServiceActivate(const aClientID: TGUID;
|
|
|
|
|
|
aSession: TROSession; const aMessage: IROMessage);
|
|
|
|
|
|
procedure DataAbstractServiceDeactivate(const aClientID: TGUID;
|
|
|
|
|
|
aSession: TROSession);
|
|
|
|
|
|
procedure DataAbstractServiceBusinessProcessorAutoCreated(
|
|
|
|
|
|
aSender: TRORemoteDataModule;
|
|
|
|
|
|
BusinessProcessor: TDABusinessProcessor);
|
|
|
|
|
|
|
|
|
|
|
|
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
|
|
|
|
|
|
var aConnectionName: string);
|
2008-03-23 20:18:10 +00:00
|
|
|
|
procedure DARemoteServiceAfterGetDatasetData(const Dataset: IDADataset;
|
|
|
|
|
|
const IncludeSchema: Boolean; const MaxRecords: Integer);
|
|
|
|
|
|
procedure DARemoteServiceCreate(Sender: TObject);
|
2008-10-27 19:03:34 +00:00
|
|
|
|
procedure DataAbstractServiceAfterGetDatasetData(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset; const aIncludeSchema: Boolean;
|
|
|
|
|
|
const aMaxRecords: Integer);
|
|
|
|
|
|
private
|
|
|
|
|
|
procedure Log(Astr: string);
|
2008-11-05 12:46:33 +00:00
|
|
|
|
protected
|
2008-11-07 21:05:48 +00:00
|
|
|
|
function DarListaObras(const IDEmpresa: Integer): Binary;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
uses
|
2008-11-05 12:46:33 +00:00
|
|
|
|
{Generated:} FactuGES_Invk, uDataModuleServer, uROClasses,
|
2008-04-23 18:21:47 +00:00
|
|
|
|
uDatabaseUtils, schObrasClient_Intf, uRestriccionesUsuarioUtils,
|
2008-10-27 19:03:34 +00:00
|
|
|
|
uBizObrasServer, Variants;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
|
|
|
|
|
|
procedure Create_srvObras(out anInstance : IUnknown);
|
|
|
|
|
|
begin
|
|
|
|
|
|
anInstance := TsrvObras.Create(NIL);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{ srvObras }
|
|
|
|
|
|
procedure TsrvObras.DARemoteServiceAfterGetDatasetData(
|
|
|
|
|
|
const Dataset: IDADataset; const IncludeSchema: Boolean;
|
|
|
|
|
|
const MaxRecords: Integer);
|
|
|
|
|
|
begin
|
2008-04-23 18:21:47 +00:00
|
|
|
|
if Assigned(Dataset.FindField(fld_ObrasID_EMPRESA)) then
|
2008-03-23 20:18:10 +00:00
|
|
|
|
begin
|
|
|
|
|
|
{ Aqu<EFBFBD> se asegura que el usuario s<EFBFBD>lo accede a los Obras
|
|
|
|
|
|
de las empresas a las que tiene permiso para acceder
|
|
|
|
|
|
filtrando DataSet por ID_EMPRESA. }
|
|
|
|
|
|
FiltrarAccesoUsuario(Session, Connection, schObras, DataSet, fld_ObrasID_EMPRESA);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DARemoteServiceCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
2008-10-27 19:03:34 +00:00
|
|
|
|
// Log('***Create***');
|
|
|
|
|
|
// Log('************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
|
2008-03-23 20:18:10 +00:00
|
|
|
|
SessionManager := dmServer.SessionManager;
|
2008-04-23 18:21:47 +00:00
|
|
|
|
bpObras.BusinessRulesID := BIZ_SERVER_OBRA;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeAcquireConnection(
|
|
|
|
|
|
aSender: TObject; var aConnectionName: string);
|
|
|
|
|
|
begin
|
2008-10-27 19:03:34 +00:00
|
|
|
|
inherited;
|
2008-03-23 20:18:10 +00:00
|
|
|
|
ConnectionName := dmServer.ConnectionName;
|
2008-10-27 19:03:34 +00:00
|
|
|
|
|
|
|
|
|
|
// Log('***BeforeAcquireConnection***');
|
|
|
|
|
|
// Log('aConnectionName:'#9 + aConnectionName);
|
|
|
|
|
|
// Log('************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterAcquireConnection(
|
|
|
|
|
|
aSender: TObject; const aConnectionName: string;
|
|
|
|
|
|
const aAcquiredConnection: IDAConnection);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterAcquireConnection***');
|
|
|
|
|
|
// Log('ConnectionName:'#9 + aConnectionName);
|
|
|
|
|
|
// Log('aAcquiredConnection.Name:'#9 + aAcquiredConnection.Name);
|
|
|
|
|
|
// Log('aAcquiredConnection.ConnectionString:'#9 + aAcquiredConnection.ConnectionString);
|
|
|
|
|
|
// Log('****************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterExecuteCommand(
|
|
|
|
|
|
aSender: TObject; const aCommand: IDASQLCommand; aRowsAffacted: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterExecuteCommand***');
|
|
|
|
|
|
// Log('aCommand.Name:'#9 + aCommand.Name);
|
|
|
|
|
|
// Log('aCommand.SQL:'#9 + aCommand.SQL);
|
|
|
|
|
|
// Log('aRowsAffacted:'#9 + IntToStr(aRowsAffacted));
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterGetDatasetData(
|
|
|
|
|
|
aSender: TObject; const aDataset: IDADataset;
|
|
|
|
|
|
const aIncludeSchema: Boolean; const aMaxRecords: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterGetDatasetData***');
|
|
|
|
|
|
// Log('aDataset.Name:'#9 + aDataset.Name);
|
|
|
|
|
|
// Log('aDataset.SQL:'#9 + aDataset.SQL);
|
|
|
|
|
|
// Log('aIncludeSchema:'#9 + BoolStr[aIncludeSchema]);
|
|
|
|
|
|
// Log('aMaxRecords:'#9 + IntToStr(aMaxRecords));
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterGetDatasetSchema(
|
|
|
|
|
|
aSender: TObject; const aDataset: IDADataset);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterGetDatasetSchema***');
|
|
|
|
|
|
// Log('aDataset.Name:'#9 + aDataset.Name);
|
|
|
|
|
|
// Log('aDataset.SQL:'#9 + aDataset.SQL);
|
|
|
|
|
|
// Log('***************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterProcessDeltas(
|
|
|
|
|
|
aSender: TObject; aDeltaStructs: TDADeltaStructList);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterProcessDeltas***');
|
|
|
|
|
|
// Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count));
|
|
|
|
|
|
// Log('************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceAfterReleaseConnection(
|
|
|
|
|
|
aSender: TObject; const aConnectionName: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AfterReleaseConnection***');
|
|
|
|
|
|
// Log('aConnectionName:'#9 + aConnectionName);
|
|
|
|
|
|
// Log('****************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeExecuteCommand(
|
|
|
|
|
|
aSender: TObject; const aCommand: IDASQLCommand);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***BeforeExecuteCommand***');
|
|
|
|
|
|
// Log('aCommand.Name:'#9 + aCommand.Name);
|
|
|
|
|
|
// Log('aCommand.SQL:'#9 + aCommand.SQL);
|
|
|
|
|
|
// Log('************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeGetDatasetData(
|
|
|
|
|
|
aSender: TObject; const aDataset: IDADataset;
|
|
|
|
|
|
const aIncludeSchema: Boolean; const aMaxRecords: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***BeforeGetDatasetData***');
|
|
|
|
|
|
// Log('aDataset.Name:'#9 + aDataset.Name);
|
|
|
|
|
|
// Log('aDataset.SQL:'#9 + aDataset.SQL);
|
|
|
|
|
|
// Log('aIncludeSchema:'#9 + BoolStr[aIncludeSchema]);
|
|
|
|
|
|
// Log('aMaxRecords:'#9 + IntToStr(aMaxRecords));
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeGetDatasetSchema(
|
|
|
|
|
|
aSender: TObject; const aDataset: IDADataset);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***BeforeGetDatasetSchema***');
|
|
|
|
|
|
// Log('aDataset.Name:'#9 + aDataset.Name);
|
|
|
|
|
|
// Log('aDataset.SQL:'#9 + aDataset.SQL);
|
|
|
|
|
|
// Log('****************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeProcessDeltas(
|
|
|
|
|
|
aSender: TObject; aDeltaStructs: TDADeltaStructList);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***BeforeProcessDeltas***');
|
|
|
|
|
|
// Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count));
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBeforeReleaseConnection(
|
|
|
|
|
|
aSender: TObject; const aConnectionName: string;
|
|
|
|
|
|
const aAcquiredConnection: IDAConnection);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***BeforeReleaseConnection***');
|
|
|
|
|
|
// Log('aConnectionName:'#9 + aConnectionName);
|
|
|
|
|
|
// Log('aAcquiredConnection.Name:'#9 + aAcquiredConnection.Name);
|
|
|
|
|
|
// Log('aAcquiredConnection.ConnectionString:'#9 + aAcquiredConnection.ConnectionString);
|
|
|
|
|
|
// Log('*****************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceGetSchemaAsXMLEvent(
|
|
|
|
|
|
aSender: TObject; var aSchemaXML: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***GetSchemaAsXMLEvent***');
|
|
|
|
|
|
// Log('Length(aSchemaXML):'#9 + intTostr(Length(aSchemaXML)));
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceProcessDeltasError(
|
|
|
|
|
|
aSender: TObject; aDeltaStructs: TDADeltaStructList; aError: Exception;
|
|
|
|
|
|
var aDoRaise: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***ProcessDeltasError***');
|
|
|
|
|
|
// Log('aDeltaStructs.Count:'#9 + IntToStr(aDeltaStructs.Count));
|
|
|
|
|
|
// Log('aError.ClassName:'#9 + aError.ClassName);
|
|
|
|
|
|
// Log('aError.Message:'#9 + aError.Message);
|
|
|
|
|
|
// Log('aDoRaise:'#9 + BoolStr[aDoRaise]);
|
|
|
|
|
|
// Log('*************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceUpdateDataBeginTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***UpdateDataBeginTransaction***');
|
|
|
|
|
|
// Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]);
|
|
|
|
|
|
// Log('********************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceUpdateDataCommitTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***UpdateDataCommitTransaction***');
|
|
|
|
|
|
// Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]);
|
|
|
|
|
|
// Log('*********************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceUpdateDataRollBackTransaction(
|
|
|
|
|
|
Sender: TObject; var aUseDefaultTransactionLogic: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***UpdateDataRollBackTransaction***');
|
|
|
|
|
|
// Log('aUseDefaultTransactionLogic:'#9 + BoolStr[aUseDefaultTransactionLogic]);
|
|
|
|
|
|
// Log('***********************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceValidateCommandExecution(
|
|
|
|
|
|
Sender: TObject; const aConnection: IDAConnection;
|
|
|
|
|
|
const aDatasetName: string; const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; aSchema: TDASchema;
|
|
|
|
|
|
var Allowed: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
i: integer;
|
|
|
|
|
|
SQLCommand: TDASQLCommand;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***ValidateCommandExecution***');
|
|
|
|
|
|
// Log('aConnection.Name:'#9 + aConnection.Name);
|
|
|
|
|
|
// Log('aDatasetName:'#9 + aDatasetName);
|
|
|
|
|
|
// SQLCommand := aSchema.Commands.SQLCommandByName(aDatasetName);
|
|
|
|
|
|
// if (SQLCommand <> nil) and (SQLCommand.Statements.Count > 0) then
|
|
|
|
|
|
// Log('Command SQL:'#9 + SQLCommand.Statements[0].SQL);
|
|
|
|
|
|
// Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames))));
|
|
|
|
|
|
// for i := Low(aParamNames) to High(aParamNames) do
|
|
|
|
|
|
// Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i]));
|
|
|
|
|
|
// Log('aSchema.Name:'#9 + aSchema.Name);
|
|
|
|
|
|
// Log('Allowed:'#9 + BoolStr[Allowed]);
|
|
|
|
|
|
// Log('******************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceValidateDatasetAccess(
|
|
|
|
|
|
Sender: TObject; const aConnection: IDAConnection;
|
|
|
|
|
|
const aDatasetName: string; const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; aSchema: TDASchema;
|
|
|
|
|
|
var Allowed: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
i: integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***ValidateDatasetAccess***');
|
|
|
|
|
|
// Log('aConnection.Name:'#9 + aConnection.Name);
|
|
|
|
|
|
// Log('aDatasetName:'#9 + aDatasetName);
|
|
|
|
|
|
// Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames))));
|
|
|
|
|
|
// for i := Low(aParamNames) to High(aParamNames) do
|
|
|
|
|
|
// Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i]));
|
|
|
|
|
|
// Log('aSchema.Name:'#9 + aSchema.Name);
|
|
|
|
|
|
// Log('Allowed:'#9 + BoolStr[Allowed]);
|
|
|
|
|
|
// Log('***************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceValidateDirectSQLAccess(
|
|
|
|
|
|
Sender: TObject; const aConnection: IDAConnection;
|
|
|
|
|
|
const aSQLText: string; const aParamNames: array of string;
|
|
|
|
|
|
const aParamValues: array of Variant; var Allowed: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
i: integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***ValidateDirectSQLAccess***');
|
|
|
|
|
|
// Log('aConnection.Name:'#9 + aConnection.Name);
|
|
|
|
|
|
// Log('aSQLText:'#9 + aSQLText);
|
|
|
|
|
|
// Log('ParamCount:'#9 + intToStr(1 + ord(High(aParamNames)) - ord(Low(aParamNames))));
|
|
|
|
|
|
// for i := Low(aParamNames) to High(aParamNames) do
|
|
|
|
|
|
// Log(#9 + aParamNames[i] + ' = ' + VarToStr(aParamValues[i]));
|
|
|
|
|
|
// Log('Allowed:'#9 + BoolStr[Allowed]);
|
|
|
|
|
|
// Log('***************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.Log(Astr: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
dmServer.EscribirLog(Astr)
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-11-07 21:05:48 +00:00
|
|
|
|
function TsrvObras.DarListaObras(const IDEmpresa: Integer): Binary;
|
2008-11-05 12:46:33 +00:00
|
|
|
|
var
|
|
|
|
|
|
ASchema : TDASchema;
|
|
|
|
|
|
AConn : IDAConnection;
|
|
|
|
|
|
dsData: IDADataset;
|
|
|
|
|
|
ALista : TStringList;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := Binary.Create;
|
|
|
|
|
|
|
|
|
|
|
|
ASchema := schObras;
|
|
|
|
|
|
AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
|
|
|
|
|
|
|
|
|
|
|
try
|
2008-11-07 21:05:48 +00:00
|
|
|
|
dsData := ASchema.NewDataset(AConn, 'ListaObras', ['ID_EMPRESA'], [IntToStr(IDEmpresa)]);
|
2008-11-05 12:46:33 +00:00
|
|
|
|
except
|
|
|
|
|
|
RaiseError('No existe la tabla ALMACENES');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ALista := TStringList.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
dsData.Active := True;
|
2008-11-05 19:43:24 +00:00
|
|
|
|
// ALista.Sorted := True;
|
2008-11-05 12:46:33 +00:00
|
|
|
|
while not dsData.EOF do
|
|
|
|
|
|
begin
|
|
|
|
|
|
ALista.Add(Format('%s=%d', [dsData.Fields[1].AsString, dsData.Fields[0].AsInteger]));
|
|
|
|
|
|
dsData.Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ALista.SaveToStream(Result);
|
|
|
|
|
|
finally
|
|
|
|
|
|
FreeANDNIL(ALista);
|
|
|
|
|
|
dsData := NIL;
|
|
|
|
|
|
AConn := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-10-27 19:03:34 +00:00
|
|
|
|
procedure TsrvObras.DataAbstractServiceAcquireConnectionFailure(
|
|
|
|
|
|
aSender: TObject; const aConnectionName: string; aError: Exception);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// Log('***AcquireConnectionFailure***');
|
|
|
|
|
|
// Log('aConnectionName:'#9 + aConnectionName);
|
|
|
|
|
|
// Log('aError.ClassName:'#9 + aError.ClassName);
|
|
|
|
|
|
// Log('aError.Message:'#9 + aError.Message);
|
|
|
|
|
|
// Log('******************************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceDestroy(
|
|
|
|
|
|
Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Log('***Destroy***');
|
|
|
|
|
|
// Log('*************');
|
|
|
|
|
|
// Log('');
|
2008-03-23 20:18:10 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2008-10-27 19:03:34 +00:00
|
|
|
|
procedure TsrvObras.DataAbstractServiceActivate(
|
|
|
|
|
|
const aClientID: TGUID; aSession: TROSession;
|
|
|
|
|
|
const aMessage: IROMessage);
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Log('***Activate***');
|
|
|
|
|
|
// Log('aClientID:'#9 + GUIDToString(aClientID));
|
|
|
|
|
|
// // Log('aSession:'#9 + aSession.ClassName);
|
|
|
|
|
|
// // Log('aError.Message:'#9 + aError.Message);
|
|
|
|
|
|
// Log('**************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceDeactivate(
|
|
|
|
|
|
const aClientID: TGUID; aSession: TROSession);
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Log('***Deactivate***');
|
|
|
|
|
|
// Log('aClientID:'#9 + GUIDToString(aClientID));
|
|
|
|
|
|
// Log('****************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvObras.DataAbstractServiceBusinessProcessorAutoCreated(
|
|
|
|
|
|
aSender: TRORemoteDataModule; BusinessProcessor: TDABusinessProcessor);
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Log('***BusinessProcessorAutoCreated***');
|
|
|
|
|
|
// Log('****************');
|
|
|
|
|
|
// Log('');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-23 20:18:10 +00:00
|
|
|
|
initialization
|
|
|
|
|
|
TROClassFactory.Create('srvObras', Create_srvObras, TsrvObras_Invoker);
|
|
|
|
|
|
|
|
|
|
|
|
finalization
|
|
|
|
|
|
|
|
|
|
|
|
end.
|