- Servidor: mejorada la forma de llamar a los servicios desde otros servicios.
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@301 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
098fa7175a
commit
22b23d0589
@ -349,6 +349,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ if Result then
|
||||
// Para que el servidor cree la sesión del usuario
|
||||
FDataModule.Login(User, Password);}
|
||||
end;
|
||||
|
||||
constructor TUsuariosController.Create;
|
||||
|
||||
@ -423,4 +423,11 @@ inherited DataModuleUsuarios: TDataModuleUsuarios
|
||||
Left = 272
|
||||
Top = 136
|
||||
end
|
||||
object srvLogin: TRORemoteService
|
||||
Message = dmConexion.ROMessage
|
||||
Channel = dmConexion.ROChannel
|
||||
ServiceName = 'srvLogin'
|
||||
Left = 40
|
||||
Top = 208
|
||||
end
|
||||
end
|
||||
|
||||
@ -20,6 +20,7 @@ type
|
||||
ds_USUARIOS: TDADataSource;
|
||||
tbl_PERFILES: TDAMemDataTable;
|
||||
ds_PERFILES: TDADataSource;
|
||||
srvLogin: TRORemoteService;
|
||||
procedure DataModuleCreate(Sender: TObject);
|
||||
|
||||
private
|
||||
@ -38,6 +39,9 @@ type
|
||||
|
||||
procedure InicializarUserControl (AUserControl : TUserControl);
|
||||
function DarTiendaUsuario(const ID_Usuario: Integer; var AID_Tienda: Integer; var ATienda: String) : Boolean;
|
||||
|
||||
function Login(const AUser: String; const APassword: String): Boolean;
|
||||
procedure Logout;
|
||||
end;
|
||||
|
||||
|
||||
@ -476,5 +480,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDataModuleUsuarios.Login(const AUser: String; const APassword: String): Boolean;
|
||||
begin
|
||||
Result := (srvLogin as IsrvLogin).Login(AUser, APassword);
|
||||
end;
|
||||
|
||||
procedure TDataModuleUsuarios.Logout;
|
||||
begin
|
||||
(srvLogin as IsrvLogin).Logout;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -19,6 +19,9 @@ type
|
||||
function GetPerfil(const ID : Integer) : IBizPerfilUsuario;
|
||||
|
||||
function DarTiendaUsuario(const ID_Usuario: Integer; var AID_Tienda: Integer; var ATienda: String) : Boolean;
|
||||
|
||||
function Login(const AUser: String; const APassword: String): Boolean;
|
||||
procedure Logout;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -19,22 +19,26 @@ implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
srvContabilidad_Impl;
|
||||
SysUtils, uROServer, FactuGES_Intf;
|
||||
|
||||
{ TBizAsientosServer }
|
||||
|
||||
procedure TBizAsientosServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
AContabilidadService : IsrvContabilidad;
|
||||
Intf : IInterface;
|
||||
AClientID : TGUID;
|
||||
begin
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si el orden del asiento no ha sido asignado le asignamos uno nosotros
|
||||
if (ORDENIsNull) or (ORDEN = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(Nil) do
|
||||
begin
|
||||
ORDEN := DarNumOrden;
|
||||
Free;
|
||||
end;
|
||||
CreateGUID(AClientID);
|
||||
|
||||
GetClassFactory('srvContabilidad').CreateInstance(AClientID, Intf);
|
||||
AContabilidadService := Intf as IsrvContabilidad;
|
||||
ORDEN := AContabilidadService.DarNumOrdenAsiento;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -38,13 +38,13 @@ type
|
||||
procedure DARemoteServiceCreate(Sender: TObject);
|
||||
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string);
|
||||
private
|
||||
function darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
function DarEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
|
||||
public
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer; const CLIENTE: String): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ES_ACREEDOR: Integer; const ID_EMPRESA: Integer; const PROVEEDOR: String): Boolean;
|
||||
function DarNumOrden : Integer;
|
||||
function DarNumOrdenAsiento : Integer;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -226,14 +226,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TsrvContabilidad.darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
function TsrvContabilidad.DarEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
var
|
||||
AEjerciciosService : IsrvEjercicios;
|
||||
Intf : IInterface;
|
||||
AClientID : TGUID;
|
||||
begin
|
||||
with TsrvEjercicios.Create(NIL) do
|
||||
try
|
||||
Result := DarEjercicioActivo(ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
CreateGUID(AClientID);
|
||||
|
||||
GetClassFactory('srvEjercicios').CreateInstance(AClientID, Intf);
|
||||
AEjerciciosService := Intf as IsrvEjercicios;
|
||||
Result := AEjerciciosService.darEjercicioActivo(ID_EMPRESA)
|
||||
end;
|
||||
|
||||
procedure TsrvContabilidad.DARemoteServiceCreate(Sender: TObject);
|
||||
@ -242,7 +245,7 @@ begin
|
||||
bpAsientos.BusinessRulesID := BIZ_SERVER_ASIENTOS;
|
||||
end;
|
||||
|
||||
function TsrvContabilidad.DarNumOrden: Integer;
|
||||
function TsrvContabilidad.DarNumOrdenAsiento: Integer;
|
||||
var
|
||||
AConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
|
||||
@ -15,6 +15,7 @@ type
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
procedure CrearCuentaContable(aChange: TDADeltaChange);
|
||||
protected
|
||||
procedure Insert_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Update_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
@ -28,7 +29,8 @@ implementation
|
||||
|
||||
uses
|
||||
uDataModuleServer, uDAClasses, srvContabilidad_Impl,
|
||||
schContactosClient_Intf, uBusinessUtils;
|
||||
schContactosClient_Intf, uBusinessUtils, FactuGES_Intf,
|
||||
uROServer, SysUtils;
|
||||
|
||||
const
|
||||
REF_CLIENTE = 'REF_CLIENTE';
|
||||
@ -51,6 +53,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizClienteServer.CrearCuentaContable(aChange: TDADeltaChange);
|
||||
var
|
||||
AContabilidadService : IsrvContabilidad;
|
||||
Intf : IInterface;
|
||||
AClientID : TGUID;
|
||||
|
||||
ANombre: string;
|
||||
AIDEmpresa: Integer;
|
||||
AIDCliente: Integer;
|
||||
AIDTienda: Integer;
|
||||
begin
|
||||
AIDCliente := aChange.NewValueByName[fld_ClientesID];
|
||||
AIDTienda := aChange.NewValueByName[fld_ClientesID_TIENDA];
|
||||
AIDEmpresa := aChange.NewValueByName[fld_ClientesID_EMPRESA];
|
||||
ANombre := aChange.NewValueByName[fld_ClientesNOMBRE];
|
||||
|
||||
CreateGUID(AClientID);
|
||||
GetClassFactory('srvContabilidad').CreateInstance(AClientID, Intf);
|
||||
AContabilidadService := Intf as IsrvContabilidad;
|
||||
|
||||
if not AContabilidadService.TieneCuentaAsociada(AIDCliente, AIDEmpresa) then
|
||||
AContabilidadService.AnadirSubCuentaCliente(AIDCliente, AIDTienda, AIDEmpresa, ANombre);
|
||||
end;
|
||||
|
||||
procedure TBizClienteServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
@ -105,12 +131,6 @@ var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
|
||||
idCliente: integer;
|
||||
idTienda: integer;
|
||||
idEmpresa: integer;
|
||||
Nombre: string;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
|
||||
@ -142,20 +162,10 @@ begin
|
||||
|
||||
|
||||
//En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0)
|
||||
and (aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0) and
|
||||
(aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(NIL) do
|
||||
try
|
||||
IdCliente := aChange.NewValueByName[fld_ClientesID];
|
||||
IdTienda := aChange.NewValueByName[fld_ClientesID_TIENDA];
|
||||
IdEmpresa := aChange.NewValueByName[fld_ClientesID_EMPRESA];
|
||||
Nombre := aChange.NewValueByName[fld_ClientesNOMBRE];
|
||||
if not TieneCuentaAsociada(idCliente, idEmpresa) then
|
||||
AnadirSubCuentaCliente(idCliente, idTienda, idEmpresa, Nombre);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
CrearCuentaContable(aChange);
|
||||
end;
|
||||
|
||||
finally
|
||||
@ -169,11 +179,6 @@ var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
|
||||
idCliente: integer;
|
||||
idTienda: integer;
|
||||
idEmpresa: integer;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
|
||||
@ -205,20 +210,10 @@ begin
|
||||
end;
|
||||
|
||||
//En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0)
|
||||
and (aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0) and
|
||||
(aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(NIL) do
|
||||
try
|
||||
IdCliente := aChange.NewValueByName[fld_ClientesID];
|
||||
IdTienda := aChange.NewValueByName[fld_ClientesID_TIENDA];
|
||||
IdEmpresa := aChange.NewValueByName[fld_ClientesID_EMPRESA];
|
||||
Nombre := aChange.NewValueByName[fld_ClientesNOMBRE];
|
||||
if not TieneCuentaAsociada(idCliente, idEmpresa) then
|
||||
AnadirSubCuentaCliente(idCliente, idTienda, idEmpresa, Nombre);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
CrearCuentaContable(aChange);
|
||||
end;
|
||||
|
||||
finally
|
||||
|
||||
@ -15,6 +15,7 @@ type
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
procedure CrearCuentaContable(aChange: TDADeltaChange);
|
||||
protected
|
||||
procedure Insert_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Update_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
@ -28,7 +29,8 @@ implementation
|
||||
|
||||
uses
|
||||
uDataModuleServer, uDAClasses, srvContabilidad_Impl,
|
||||
schContactosClient_Intf, uBusinessUtils;
|
||||
schContactosClient_Intf, uBusinessUtils, FactuGES_Intf,
|
||||
uROServer, SysUtils;
|
||||
|
||||
const
|
||||
REF_PROVEEDOR = 'REF_PROVEEDOR';
|
||||
@ -51,6 +53,31 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizProveedorServer.CrearCuentaContable(aChange: TDADeltaChange);
|
||||
var
|
||||
AIDProveedor: Integer;
|
||||
bEsAcreedor: Integer;
|
||||
ANombre: string;
|
||||
AIDEmpresa: Integer;
|
||||
|
||||
Intf: IInterface;
|
||||
AContabilidadService: IsrvContabilidad;
|
||||
AClientID: TGUID;
|
||||
begin
|
||||
AIDProveedor := aChange.NewValueByName[fld_ProveedoresID];
|
||||
bEsAcreedor := aChange.NewValueByName[fld_ProveedoresES_ACREEDOR];
|
||||
AIDEmpresa := aChange.NewValueByName[fld_ProveedoresID_EMPRESA];
|
||||
ANombre := aChange.NewValueByName[fld_ProveedoresNOMBRE];
|
||||
|
||||
CreateGUID(AClientID);
|
||||
GetClassFactory('srvContabilidad').CreateInstance(AClientID, Intf);
|
||||
AContabilidadService := Intf as IsrvContabilidad;
|
||||
|
||||
if not AContabilidadService.TieneCuentaAsociada(AIDProveedor, AIDEmpresa) then
|
||||
AContabilidadService.AnadirSubCuentaProveedor(AIDProveedor, bEsAcreedor, AIDEmpresa, ANombre);
|
||||
end;
|
||||
|
||||
|
||||
procedure TBizProveedorServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
@ -102,15 +129,9 @@ end;
|
||||
|
||||
procedure TBizProveedorServer.Insert_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
|
||||
idProveedor: integer;
|
||||
EsAcreedor: integer;
|
||||
idEmpresa: integer;
|
||||
Nombre: string;
|
||||
|
||||
ASchema : TDASchema;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
@ -140,22 +161,11 @@ begin
|
||||
end;
|
||||
|
||||
//En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado
|
||||
if (aChange.NewValueByName[fld_ProveedoresIGNORAR_CONTABILIDAD] = 0)
|
||||
and (aChange.NewValueByName[fld_ProveedoresTIENE_SUBCUENTA] = 0) then
|
||||
if (aChange.NewValueByName[fld_ProveedoresIGNORAR_CONTABILIDAD] = 0) and
|
||||
(aChange.NewValueByName[fld_ProveedoresTIENE_SUBCUENTA] = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(NIL) do
|
||||
try
|
||||
IdProveedor := aChange.NewValueByName[fld_ProveedoresID];
|
||||
EsAcreedor := aChange.NewValueByName[fld_ProveedoresES_ACREEDOR];
|
||||
IdEmpresa := aChange.NewValueByName[fld_ProveedoresID_EMPRESA];
|
||||
Nombre := aChange.NewValueByName[fld_ProveedoresNOMBRE];
|
||||
if not TieneCuentaAsociada(IdProveedor, IdEmpresa) then
|
||||
AnadirSubCuentaProveedor(IdProveedor, EsAcreedor, IdEmpresa, Nombre);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
CrearCuentaContable(aChange);
|
||||
end;
|
||||
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
@ -167,12 +177,6 @@ var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
|
||||
idProveedor: integer;
|
||||
EsAcreedor: integer;
|
||||
idEmpresa: integer;
|
||||
Nombre: string;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
|
||||
@ -198,25 +202,15 @@ begin
|
||||
ParamByName('IGNORAR_CONTABILIDAD').Value := aChange.NewValueByName[fld_ProveedoresIGNORAR_CONTABILIDAD];
|
||||
ParamByName('TIENE_SUBCUENTA').Value := aChange.NewValueByName[fld_ProveedoresTIENE_SUBCUENTA];
|
||||
ParamByName('NOMBRE_COMERCIAL').Value := aChange.NewValueByName[fld_ProveedoresNOMBRE_COMERCIAL];
|
||||
ParamByName('ES_ACREEDOR').Value := aChange.NewValueByName[fld_ProveedoresES_ACREEDOR];
|
||||
ParamByName('ES_ACREEDOR').Value := aChange.NewValueByName[fld_ProveedoresES_ACREEDOR];
|
||||
Execute;
|
||||
end;
|
||||
|
||||
//En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0)
|
||||
and (aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0) and
|
||||
(aChange.NewValueByName[fld_ClientesTIENE_SUBCUENTA] = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(NIL) do
|
||||
try
|
||||
IdProveedor := aChange.NewValueByName[fld_ProveedoresID];
|
||||
EsAcreedor := aChange.NewValueByName[fld_ProveedoresEs_ACREEDOR];
|
||||
IdEmpresa := aChange.NewValueByName[fld_ProveedoresID_EMPRESA];
|
||||
Nombre := aChange.NewValueByName[fld_ProveedoresNOMBRE];
|
||||
if not TieneCuentaAsociada(IdProveedor, IdEmpresa) then
|
||||
AnadirSubCuentaProveedor(IdProveedor, EsAcreedor, IdEmpresa, Nombre);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
CrearCuentaContable(aChange);
|
||||
end;
|
||||
|
||||
finally
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<Interfaces>
|
||||
<Interface Name="Default" UID="{399F9DB4-1B34-4140-AB6E-3BC10C0A7034}">
|
||||
<Operations>
|
||||
<Operation Name="Login" UID="{849EDFCE-0C6A-4D3C-B9E9-7770C5A7F0A4}">
|
||||
<Operation Name="Login2" UID="{849EDFCE-0C6A-4D3C-B9E9-7770C5A7F0A4}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Boolean" Flag="Result">
|
||||
</Parameter>
|
||||
@ -48,6 +48,16 @@
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="Login" UID="{2BA6C933-4C83-4931-80C7-4D3E32C46A26}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Boolean" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="User" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="Password" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="Logout" UID="{3E5391BA-B717-44BB-88DC-C48CB3F7C789}">
|
||||
<Parameters>
|
||||
</Parameters>
|
||||
@ -439,6 +449,12 @@
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="DarNumOrdenAsiento" UID="{D22D8C7D-A8E9-4B30-BAEE-7D856C7F6C1F}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Integer" Flag="Result">
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
</Operations>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
|
||||
@ -185,7 +185,8 @@ type
|
||||
{ IsrvLogin }
|
||||
IsrvLogin = interface(IDataAbstractService)
|
||||
['{399F9DB4-1B34-4140-AB6E-3BC10C0A7034}']
|
||||
function Login(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login2(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login(const User: String; const Password: String): Boolean;
|
||||
procedure Logout;
|
||||
function Ping: Boolean;
|
||||
end;
|
||||
@ -200,7 +201,8 @@ type
|
||||
protected
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function Login(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login2(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login(const User: String; const Password: String): Boolean;
|
||||
procedure Logout;
|
||||
function Ping: Boolean;
|
||||
end;
|
||||
@ -622,6 +624,7 @@ type
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer; const CLIENTE: String): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ES_ACREEDOR: Integer; const ID_EMPRESA: Integer; const PROVEEDOR: String): Boolean;
|
||||
function DarNumOrdenAsiento: Integer;
|
||||
end;
|
||||
|
||||
{ CosrvContabilidad }
|
||||
@ -637,6 +640,7 @@ type
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer; const CLIENTE: String): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ES_ACREEDOR: Integer; const ID_EMPRESA: Integer; const PROVEEDOR: String): Boolean;
|
||||
function DarNumOrdenAsiento: Integer;
|
||||
end;
|
||||
|
||||
{ IsrvUnidadesMedida }
|
||||
@ -1033,11 +1037,11 @@ begin
|
||||
result := 'srvLogin';
|
||||
end;
|
||||
|
||||
function TsrvLogin_Proxy.Login(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function TsrvLogin_Proxy.Login2(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
begin
|
||||
try
|
||||
LoginInfo := nil;
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'Login');
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'Login2');
|
||||
__Message.Write('User', TypeInfo(String), User, []);
|
||||
__Message.Write('Password', TypeInfo(String), Password, []);
|
||||
__Message.Finalize;
|
||||
@ -1052,6 +1056,23 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvLogin_Proxy.Login(const User: String; const Password: String): Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'Login');
|
||||
__Message.Write('User', TypeInfo(String), User, []);
|
||||
__Message.Write('Password', TypeInfo(String), Password, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Boolean), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TsrvLogin_Proxy.Logout;
|
||||
begin
|
||||
try
|
||||
@ -1732,6 +1753,21 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvContabilidad_Proxy.DarNumOrdenAsiento: Integer;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'DarNumOrdenAsiento');
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Integer), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
{ CosrvUnidadesMedida }
|
||||
|
||||
class function CosrvUnidadesMedida.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvUnidadesMedida;
|
||||
|
||||
@ -32,6 +32,7 @@ type
|
||||
private
|
||||
protected
|
||||
published
|
||||
procedure Invoke_Login2(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_Login(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_Logout(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_Ping(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
@ -193,6 +194,7 @@ type
|
||||
procedure Invoke_TieneCuentaAsociada(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_AnadirSubCuentaCliente(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_AnadirSubCuentaProveedor(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_DarNumOrdenAsiento(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
end;
|
||||
|
||||
TsrvUnidadesMedida_Invoker = class(TDataAbstractService_Invoker)
|
||||
@ -275,8 +277,8 @@ end;
|
||||
|
||||
{ TsrvLogin_Invoker }
|
||||
|
||||
procedure TsrvLogin_Invoker.Invoke_Login(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function Login(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean; }
|
||||
procedure TsrvLogin_Invoker.Invoke_Login2(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function Login2(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean; }
|
||||
var
|
||||
User: String;
|
||||
Password: String;
|
||||
@ -289,9 +291,9 @@ begin
|
||||
__Message.Read('User', TypeInfo(String), User, []);
|
||||
__Message.Read('Password', TypeInfo(String), Password, []);
|
||||
|
||||
lResult := (__Instance as IsrvLogin).Login(User, Password, LoginInfo);
|
||||
lResult := (__Instance as IsrvLogin).Login2(User, Password, LoginInfo);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvLogin', 'LoginResponse');
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvLogin', 'Login2Response');
|
||||
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
|
||||
__Message.Write('LoginInfo', TypeInfo(FactuGES_Intf.TRdxLoginInfo), LoginInfo, []);
|
||||
__Message.Finalize;
|
||||
@ -307,6 +309,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvLogin_Invoker.Invoke_Login(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function Login(const User: String; const Password: String): Boolean; }
|
||||
var
|
||||
User: String;
|
||||
Password: String;
|
||||
lResult: Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.Read('User', TypeInfo(String), User, []);
|
||||
__Message.Read('Password', TypeInfo(String), Password, []);
|
||||
|
||||
lResult := (__Instance as IsrvLogin).Login(User, Password);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvLogin', 'LoginResponse');
|
||||
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvLogin_Invoker.Invoke_Logout(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ procedure Logout; }
|
||||
begin
|
||||
@ -887,6 +911,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvContabilidad_Invoker.Invoke_DarNumOrdenAsiento(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function DarNumOrdenAsiento: Integer; }
|
||||
var
|
||||
lResult: Integer;
|
||||
begin
|
||||
try
|
||||
lResult := (__Instance as IsrvContabilidad).DarNumOrdenAsiento;
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'DarNumOrdenAsientoResponse');
|
||||
__Message.Write('Result', TypeInfo(Integer), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TsrvComisiones_Invoker }
|
||||
|
||||
procedure TsrvComisiones_Invoker.Invoke_GenerateReport(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -58,8 +58,6 @@ uses
|
||||
uBizPedidosProveedorServer in '..\Modulos\Pedidos a proveedor\Model\uBizPedidosProveedorServer.pas',
|
||||
uBizAlbaranProveedorServer in '..\Modulos\Albaranes de proveedor\Model\uBizAlbaranProveedorServer.PAS',
|
||||
uBizFacturasProveedorServer in '..\Modulos\Facturas de proveedor\Model\uBizFacturasProveedorServer.pas',
|
||||
schAlmacenesClient_Intf in '..\Modulos\Almacenes\Model\schAlmacenesClient_Intf.pas',
|
||||
schAlmacenesServer_Intf in '..\Modulos\Almacenes\Model\schAlmacenesServer_Intf.pas',
|
||||
schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_Intf.pas',
|
||||
schArticulosServer_Intf in '..\Modulos\Articulos\Model\schArticulosServer_Intf.pas',
|
||||
srvRemesasCliente_Impl in '..\Modulos\Remesas de cliente\Servidor\srvRemesasCliente_Impl.pas' {srvRemesasCliente: TDataAbstractService},
|
||||
@ -125,7 +123,9 @@ uses
|
||||
schEjerciciosClient_Intf in '..\ApplicationBase\Ejercicios\Model\schEjerciciosClient_Intf.pas',
|
||||
schEjerciciosServer_Intf in '..\ApplicationBase\Ejercicios\Model\schEjerciciosServer_Intf.pas',
|
||||
schUsuariosClient_Intf in '..\ApplicationBase\Usuarios\Model\schUsuariosClient_Intf.pas',
|
||||
schUsuariosServer_Intf in '..\ApplicationBase\Usuarios\Model\schUsuariosServer_Intf.pas';
|
||||
schUsuariosServer_Intf in '..\ApplicationBase\Usuarios\Model\schUsuariosServer_Intf.pas',
|
||||
schAlmacenesClient_Intf in '..\Modulos\Almacenes\Model\schAlmacenesClient_Intf.pas',
|
||||
schAlmacenesServer_Intf in '..\Modulos\Almacenes\Model\schAlmacenesServer_Intf.pas';
|
||||
|
||||
{$R *.res}
|
||||
{$R ..\Servicios\RODLFile.res}
|
||||
|
||||
@ -16,7 +16,7 @@ BEGIN
|
||||
VALUE "FileVersion", "2.2.3.0\0"
|
||||
VALUE "ProductName", "FactuGES (Servidor)\0"
|
||||
VALUE "ProductVersion", "2.2.3.0\0"
|
||||
VALUE "CompileDate", "lunes, 28 de julio de 2008 12:58\0"
|
||||
VALUE "CompileDate", "miércoles, 30 de julio de 2008 12:09\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@ -31,7 +31,8 @@ type
|
||||
procedure DataAbstractServiceCreate(Sender: TObject);
|
||||
private
|
||||
protected
|
||||
function Login(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login2(const User: String; const Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function Login(const User: String; const Password: String): Boolean;
|
||||
procedure Logout;
|
||||
function Ping: Boolean;
|
||||
end;
|
||||
@ -63,7 +64,68 @@ begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
end;
|
||||
|
||||
function TsrvLogin.Login(const User, Password: String; out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
function TsrvLogin.Login(const User, Password: String): Boolean;
|
||||
var
|
||||
dsUser,
|
||||
dsPerfiles,
|
||||
dsEmpresas : IDADataset;
|
||||
LoginInfo : TRdxLoginInfo;
|
||||
begin
|
||||
LoginInfo := NIL;
|
||||
Result := False;
|
||||
|
||||
dsUser := schLogin.NewDataset(Connection, 'UsuarioPermitido', ['Usuario', 'Pass'], [User, Password]);
|
||||
|
||||
if (dsUser.RecordCount = 1) then
|
||||
begin
|
||||
try
|
||||
LoginInfo := TRdxLoginInfo.Create();
|
||||
with LoginInfo do
|
||||
begin
|
||||
UserID := dsUser.FieldValues[0];
|
||||
Usuario := User;
|
||||
SessionID := GUIDToString(Session.SessionID);
|
||||
Perfiles := StringArray.Create();
|
||||
Empresas := TRdxEmpresasArray.Create;
|
||||
end;
|
||||
|
||||
// Asigna los perfiles del usuario
|
||||
LoginInfo.Perfiles.Clear;
|
||||
dsPerfiles := schLogin.NewDataset(Connection, 'PerfilesUsuario', ['ID_USUARIO'], [LoginInfo.UserID]);
|
||||
while not dsPerfiles.EOF do
|
||||
begin
|
||||
LoginInfo.Perfiles.Add(VarToStr(dsPerfiles.FieldValues[0]));
|
||||
dsPerfiles.Next;
|
||||
end;
|
||||
|
||||
// Asigna las empresas del usuario
|
||||
LoginInfo.Empresas.Clear;
|
||||
dsEmpresas := schLogin.NewDataset(Connection, 'EmpresasUsuario', ['ID_USUARIO'], [LoginInfo.UserID]);
|
||||
while not dsEmpresas.EOF do
|
||||
begin
|
||||
LoginInfo.Empresas.Add(dsEmpresas.FieldValues[0]);
|
||||
dsEmpresas.Next;
|
||||
end;
|
||||
|
||||
SesionesHelper.SaveSessionObject(Session, SESION_LOGININFO, LoginInfo);
|
||||
|
||||
Result := True;
|
||||
except
|
||||
on e : exception do
|
||||
begin
|
||||
ShowMessage(e.Message);
|
||||
raise
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
// Invalid login. The temporary session is not to be kept.
|
||||
DestroySession;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TsrvLogin.Login2(const User, Password: String;
|
||||
out LoginInfo: TRdxLoginInfo): Boolean;
|
||||
var
|
||||
dsUser,
|
||||
dsPerfiles,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user