git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@540 0c75b7a4-871f-7646-8a2f-f78d34cc349f
116 lines
3.6 KiB
ObjectPascal
116 lines
3.6 KiB
ObjectPascal
unit uDataModuleGestorDocumentos;
|
|
|
|
interface
|
|
|
|
uses
|
|
DB, uDataModuleBase, uROClient, uRORemoteService, Classes, uDADataStreamer,
|
|
uDABin2DataStreamer, uROTypes, uDADataTable;
|
|
|
|
type
|
|
IDataModuleGestorDocumentos = interface
|
|
['{03537996-181D-428C-9B1D-56B499F0048E}']
|
|
function DarListaDocumentos(const ID : Integer): TStringList;
|
|
function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
|
|
function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
|
|
function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean;
|
|
function EliminarID(const ID : Integer): Boolean;
|
|
end;
|
|
|
|
TDataModuleGestorDocumentos = class(TDataModuleBase, IDataModuleGestorDocumentos)
|
|
Bin2DataStreamer: TDABin2DataStreamer;
|
|
RORemoteService: TRORemoteService;
|
|
procedure DAClientDataModuleCreate(Sender: TObject);
|
|
|
|
protected
|
|
procedure AsignarClaseNegocio(APresupuesto: TDADataTable); virtual;
|
|
|
|
public
|
|
function DarListaDocumentos(const ID : Integer): TStringList;
|
|
function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
|
|
function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
|
|
function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean;
|
|
function EliminarID(const ID : Integer): Boolean;
|
|
end;
|
|
|
|
implementation
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
SysUtils, FactuGES_Intf, uDataModuleConexion, DataAbstract4_Intf;
|
|
|
|
{ TdmGestorDocumentos }
|
|
|
|
procedure TDataModuleGestorDocumentos.AsignarClaseNegocio(APresupuesto: TDADataTable);
|
|
begin
|
|
//
|
|
end;
|
|
|
|
procedure TDataModuleGestorDocumentos.DAClientDataModuleCreate(Sender: TObject);
|
|
begin
|
|
RORemoteService.Channel := dmConexion.Channel;
|
|
RORemoteService.Message := dmConexion.Message;
|
|
end;
|
|
|
|
function TDataModuleGestorDocumentos.DarListaDocumentos(const ID: Integer): TStringList;
|
|
var
|
|
AResultado : StringArray;
|
|
i: Integer;
|
|
begin
|
|
try
|
|
AResultado := (RORemoteService as IsrvGestorDocumentos).DarListaFicheros(TRdxAlmacenes_Presupuestos, ID);
|
|
Result := TStringList.Create;
|
|
for i:= 0 to AResultado.Count - 1 do
|
|
Result.Add(AResultado.Items[i]);
|
|
finally
|
|
FreeANDNIL(AResultado)
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleGestorDocumentos.DescargarFichero(const ID: Integer; const NombreFichero: String;
|
|
const DestinoFichero: String): Boolean;
|
|
var
|
|
AFichero: Binary;
|
|
|
|
begin
|
|
Result := False;
|
|
try
|
|
AFichero := (RORemoteService as IsrvGestorDocumentos).DescargarFichero(TRdxAlmacenes_Presupuestos, ID, NombreFichero);
|
|
AFichero.SaveToFile((DestinoFichero + NombreFichero));
|
|
Result := True;
|
|
finally
|
|
FreeAndNil(AFichero);
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleGestorDocumentos.EliminarFichero(const ID: Integer; const NombreFichero: String): Boolean;
|
|
begin
|
|
Result := False;
|
|
try
|
|
Result := (RORemoteService as IsrvGestorDocumentos).EliminarFichero(TRdxAlmacenes_Presupuestos, ID, NombreFichero);
|
|
finally
|
|
//
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleGestorDocumentos.EliminarID(const ID: Integer): Boolean;
|
|
begin
|
|
Result := False;
|
|
try
|
|
Result := (RORemoteService as IsrvGestorDocumentos).EliminarID(TRdxAlmacenes_Presupuestos, ID);
|
|
finally
|
|
//
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleGestorDocumentos.SubirFichero(const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
|
|
begin
|
|
Result := False;
|
|
try
|
|
Result := (RORemoteService as IsrvGestorDocumentos).SubirFichero(TRdxAlmacenes_Presupuestos, ID, NombreFichero, Fichero);
|
|
finally
|
|
//
|
|
end;
|
|
end;
|
|
|
|
end.
|