2011-11-14 17:40:41 +00:00
|
|
|
|
unit srvEmpresas_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
|
2011-12-09 14:33:54 +00:00
|
|
|
|
{vcl:} Classes, SysUtils,
|
2011-11-14 17:40:41 +00:00
|
|
|
|
{RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
|
|
|
|
|
{Ancestor Implementation:} DataAbstractService_Impl,
|
|
|
|
|
|
{Used RODLs:} DataAbstract4_Intf,
|
|
|
|
|
|
{Generated:} FactuGES_Intf, uDAScriptingProvider, uDABusinessProcessor,
|
|
|
|
|
|
uDABin2DataStreamer, uDADataStreamer, uDAClasses, uDAInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
{ TsrvEmpresas }
|
|
|
|
|
|
TsrvEmpresas = class(TDataAbstractService, IsrvEmpresas)
|
|
|
|
|
|
Diagrams: TDADiagrams;
|
|
|
|
|
|
DABin2DataStreamer: TDABin2DataStreamer;
|
2016-11-10 17:05:04 +00:00
|
|
|
|
bpEmpresas: TDABusinessProcessor;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
schEmpresas: TDASchema;
|
|
|
|
|
|
DataDictionary: TDADataDictionary;
|
|
|
|
|
|
procedure DARemoteServiceCreate(Sender: TObject);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
|
|
|
|
|
|
var aConnectionName: string);
|
|
|
|
|
|
procedure DataAbstractServiceBeforeGetDatasetData(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset; const aIncludeSchema: Boolean;
|
|
|
|
|
|
const aMaxRecords: Integer);
|
|
|
|
|
|
private
|
|
|
|
|
|
protected
|
|
|
|
|
|
function DarTiendaUsuario(const ID_EMPRESA: Integer; const ID_USUARIO: Integer): Integer;
|
2011-12-09 14:33:54 +00:00
|
|
|
|
function DarNombre(const ID_EMPRESA: Integer): AnsiString;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
function DarListaFormasPago: Binary;
|
|
|
|
|
|
function DarListaTiposIVA: Binary;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
uses
|
|
|
|
|
|
{Generated:} FactuGES_Invk, uDataModuleServer, uRORemoteDataModule,
|
|
|
|
|
|
uDatabaseUtils, Dialogs, Variants, uROStreamSerializer, uROBinaryHelpers,
|
|
|
|
|
|
uSesionesUtils, schEmpresasClient_Intf, uUsersManager,
|
|
|
|
|
|
uRestriccionesUsuarioUtils, srvFormasPago_Impl, srvTiposIva_Impl;
|
|
|
|
|
|
|
|
|
|
|
|
procedure Create_srvEmpresas(out anInstance : IUnknown);
|
|
|
|
|
|
begin
|
|
|
|
|
|
anInstance := TsrvEmpresas.Create(NIL);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{ srvEmpresas }
|
|
|
|
|
|
procedure TsrvEmpresas.DARemoteServiceCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//SessionManager := dmServer.SessionManager;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvEmpresas.DarListaFormasPago: Binary;
|
|
|
|
|
|
var
|
|
|
|
|
|
AFormasPagoServer : TsrvFormasPago;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AFormasPagoServer := TsrvFormasPago.Create(nil);
|
|
|
|
|
|
try
|
|
|
|
|
|
Result := AFormasPagoServer.DarListaFormasPago;
|
|
|
|
|
|
finally
|
|
|
|
|
|
FreeAndNIL(AFormasPagoServer);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvEmpresas.DarListaTiposIVA: Binary;
|
|
|
|
|
|
var
|
|
|
|
|
|
ATiposIVAServer : TsrvTiposIVA;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ATiposIVAServer := TsrvTiposIVA.Create(nil);
|
|
|
|
|
|
try
|
|
|
|
|
|
Result := ATiposIVAServer.DarListaTiposIVA;
|
|
|
|
|
|
finally
|
|
|
|
|
|
FreeAndNIL(ATiposIVAServer);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-12-09 14:33:54 +00:00
|
|
|
|
function TsrvEmpresas.DarNombre(const ID_EMPRESA: Integer): AnsiString;
|
|
|
|
|
|
var
|
|
|
|
|
|
ADataSet : IDADataset;
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
ADataSet := schEmpresas.NewDataset(Connection, 'DarNombre', ['ID_EMPRESA'], [ID_EMPRESA]);
|
|
|
|
|
|
ADataSet.Open;
|
|
|
|
|
|
if ADataSet.Dataset.RecordCount > 0 then
|
|
|
|
|
|
Result := ADataSet.Dataset.Fields[0].AsString
|
|
|
|
|
|
else
|
|
|
|
|
|
Result := 'NO EXISTE'
|
|
|
|
|
|
finally
|
|
|
|
|
|
ADataSet.Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
function TsrvEmpresas.DarTiendaUsuario(const ID_EMPRESA, ID_USUARIO: Integer): Integer;
|
|
|
|
|
|
var
|
|
|
|
|
|
AContactosService : IsrvContactos;
|
|
|
|
|
|
Intf : IInterface;
|
|
|
|
|
|
begin
|
|
|
|
|
|
GetClassFactory('srvContactos').CreateInstance(ClientID, Intf);
|
|
|
|
|
|
AContactosService := Intf as IsrvContactos;
|
|
|
|
|
|
Result := AContactosService.DarTiendaDeUsuario(ID_EMPRESA, ID_USUARIO)
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvEmpresas.DataAbstractServiceBeforeAcquireConnection(
|
|
|
|
|
|
aSender: TObject; var aConnectionName: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ConnectionName := dmServer.ConnectionName;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TsrvEmpresas.DataAbstractServiceBeforeGetDatasetData(aSender: TObject;
|
|
|
|
|
|
const aDataset: IDADataset; const aIncludeSchema: Boolean;
|
|
|
|
|
|
const aMaxRecords: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if (aDataset.Name <> nme_EmpresasDatosBanco) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
{ Aqu<EFBFBD> se asegura que el usuario s<EFBFBD>lo accede a las empresas a
|
|
|
|
|
|
las que tiene permiso para acceder filtrando DataSet por ID_EMPRESA. }
|
|
|
|
|
|
FiltrarAccesoUsuario(Session, Connection, ServiceSchema, aDataset, fld_EmpresasID);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
initialization
|
|
|
|
|
|
TROClassFactory.Create('srvEmpresas', Create_srvEmpresas, TsrvEmpresas_Invoker);
|
|
|
|
|
|
|
|
|
|
|
|
finalization
|
|
|
|
|
|
|
|
|
|
|
|
end.
|