diff --git a/Build/Build.fbp5 b/Build/Build.fbp5
index 5573f26d..d1df4ed2 100644
--- a/Build/Build.fbp5
+++ b/Build/Build.fbp5
@@ -5839,6 +5839,665 @@ Comments=
+
diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj
index 33ccbea1..ab75d05c 100644
--- a/Source/Base/Base.dproj
+++ b/Source/Base/Base.dproj
@@ -53,58 +53,58 @@
MainSource
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
TForm
diff --git a/Source/Base/Utiles/uSistemaFunc.pas b/Source/Base/Utiles/uSistemaFunc.pas
index 8d5b03ed..a1394444 100644
--- a/Source/Base/Utiles/uSistemaFunc.pas
+++ b/Source/Base/Utiles/uSistemaFunc.pas
@@ -20,15 +20,17 @@
---------------------------------------------------------------------------
===============================================================================
}
-
unit uSistemaFunc;
interface
+uses SysUtils, Classes;
+
{ Funciones del sistema }
function Ejecutar (const LineaComando: String; Oculto, Esperar: Boolean) : Boolean;
procedure EscribirEnFichero (NombreFichero, Texto : string);
function DarRutaTemporal : String;
+function DarDirectorioTemporal : String;
function DarFicheroTemporal : String;
function DarFicheroJPGTemporal : String;
function DarFicheroBMPTemporal : String;
@@ -46,12 +48,14 @@ function PreguntarRuta(const ATitulo: String; const AComentario: String; var ARu
function PreguntarFicheroWordExportar (var Fichero : String) : Boolean;
function PreguntarFicheroExcelExportar (var Fichero : String) : Boolean;
function EscapeIllegalChars(AFileName: string): string;
+function FindFile(const filespec: TFileName; attributes: integer = faReadOnly Or faHidden Or faSysFile Or faArchive): TStringList;
+
implementation
uses
- SysUtils, Windows, Dialogs, JclFileUtils,
- Messages, Classes, Graphics, Controls, Forms,
+ Windows, Dialogs, JclFileUtils,
+ Messages, Graphics, Controls, Forms,
StdCtrls, SHFolder, cxShellBrowserDialog,
cxLookAndFeels, uStringsUtils;
@@ -368,4 +372,67 @@ begin
Result := AFileName;
end;
+function FindFile(const filespec: TFileName; attributes: integer): TStringList;
+var
+ spec: string;
+ list: TStringList;
+
+procedure RFindFile(const folder: TFileName);
+var
+ SearchRec: TSearchRec;
+begin
+ // Locate all matching files in the current
+ // folder and add their names to the list
+ if FindFirst(folder + spec, attributes, SearchRec) = 0 then begin
+ try
+ repeat
+ if (SearchRec.Attr and faDirectory = 0) or
+ (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
+ list.Add(folder + SearchRec.Name);
+ until FindNext(SearchRec) <> 0;
+ except
+ SysUtils.FindClose(SearchRec);
+ raise;
+ end;
+ SysUtils.FindClose(SearchRec);
+ end;
+ // Now search the subfolders
+ if FindFirst(folder + '*', attributes
+ Or faDirectory, SearchRec) = 0 then
+ begin
+ try
+ repeat
+ if ((SearchRec.Attr and faDirectory) <> 0) and
+ (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
+ RFindFile(folder + SearchRec.Name + '\');
+ until FindNext(SearchRec) <> 0;
+ except
+ SysUtils.FindClose(SearchRec);
+ raise;
+ end;
+ SysUtils.FindClose(SearchRec);
+ end;
+end; // procedure RFindFile inside of FindFile
+
+begin // function FindFile
+ list := TStringList.Create;
+ try
+ spec := ExtractFileName(filespec);
+ RFindFile(ExtractFilePath(filespec));
+ Result := list;
+ except
+ list.Free;
+ raise;
+ end;
+end;
+
+function DarDirectorioTemporal : String;
+var
+ Cadena: String;
+begin
+ Cadena := ExtractFileName(DarFicheroTemporal);
+ Cadena := StringReplace(Cadena, ExtractFileExt(Cadena), '', []);
+ Result := DarRutaTemporal + Cadena + '\';
+end;
+
end.
diff --git a/Source/GUIBase/GUIBase.dpk b/Source/GUIBase/GUIBase.dpk
index 5375471e..88eec741 100644
--- a/Source/GUIBase/GUIBase.dpk
+++ b/Source/GUIBase/GUIBase.dpk
@@ -97,6 +97,7 @@ contains
uViewFiltroBase in 'uViewFiltroBase.pas' {frViewFiltroBase: TFrame},
uViewGrid in 'uViewGrid.pas' {frViewGrid: TFrame},
uViewRichEditor in 'uViewRichEditor.pas' {frViewRichEditor: TCustomView},
- uDialogElegirEMail in 'uDialogElegirEMail.pas' {fDialogElegirEMail};
+ uDialogElegirEMail in 'uDialogElegirEMail.pas' {fDialogElegirEMail},
+ uViewDocumentos in 'uViewDocumentos.pas' {frViewDocumentos: TCustomView};
end.
diff --git a/Source/GUIBase/GUIBase.dproj b/Source/GUIBase/GUIBase.dproj
index e64ca1e9..9ddbcd4b 100644
--- a/Source/GUIBase/GUIBase.dproj
+++ b/Source/GUIBase/GUIBase.dproj
@@ -58,48 +58,52 @@
MainSource
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -153,6 +157,10 @@
TFrame
+
+
+ TCustomView
+
TFrame
@@ -193,10 +201,6 @@
TFrame
-
-
-
-
diff --git a/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc
new file mode 100644
index 00000000..79342b73
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc
@@ -0,0 +1,16 @@
+/* VER185
+ Generated by the CodeGear Delphi Pascal Compiler
+ because -GD or --drc was supplied to the compiler.
+
+ This file contains compiler-generated resources that
+ were bound to the executable.
+ If this file is empty, then no compiler-generated
+ resources were bound to the produced executable.
+*/
+
+STRINGTABLE
+BEGIN
+END
+
+/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Controller\GestorDocumentos_Controller.res */
+/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf146.tmp */
diff --git a/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.rc b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.rc
new file mode 100644
index 00000000..153736af
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.rc
@@ -0,0 +1,22 @@
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+FILEFLAGSMASK 0x3FL
+FILEFLAGS 0x00L
+FILEOS 0x40004L
+FILETYPE 0x1L
+FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "0C0A04E4"
+ BEGIN
+ VALUE "FileVersion", "1.0.0.0\0"
+ VALUE "ProductVersion", "1.0.0.0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0C0A, 1252
+ END
+END
diff --git a/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas b/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas
new file mode 100644
index 00000000..7d9f6de7
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas
@@ -0,0 +1,103 @@
+unit uGestorDocumentosController;
+
+interface
+
+uses
+ Classes, uROTypes, uControllerBase, uDataModuleGestorDocumentos;
+
+type
+ IGestorDocumentosController = interface(IControllerBase)
+ ['{75EC4D1B-A7A2-4C81-B2DA-8688240D6EC2}']
+ 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;
+ procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
+ end;
+
+ TGestorDocumentosController = class(TControllerBase, IGestorDocumentosController)
+ protected
+ FDataModule : IDataModuleGestorDocumentos;
+
+ //Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de
+ //este controller
+ procedure AsignarDataModule; virtual;
+
+ public
+ constructor Create; override;
+ destructor Destroy; override;
+
+ 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;
+ procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
+ end;
+
+implementation
+{ TGestorDocumentosController }
+
+uses SysUtils, Dialogs;
+
+procedure TGestorDocumentosController.AsignarDataModule;
+begin
+ FDataModule := TDataModuleGestorDocumentos.Create(Nil);
+end;
+
+constructor TGestorDocumentosController.Create;
+begin
+ inherited;
+ AsignarDataModule;
+end;
+
+function TGestorDocumentosController.DarListaDocumentos(
+ const ID: Integer): TStringList;
+begin
+ Result := FDataModule.DarListaDocumentos(ID);
+end;
+
+function TGestorDocumentosController.DescargarFichero(const ID: Integer;
+ const NombreFichero, DestinoFichero: String): Boolean;
+begin
+ Result := FDataModule.DescargarFichero(ID, NombreFichero, DestinoFichero);
+end;
+
+destructor TGestorDocumentosController.Destroy;
+begin
+ FDataModule := Nil;
+ inherited;
+end;
+
+procedure TGestorDocumentosController.SincronizarDocumentos(const ID: Integer;
+ FListaDocumentos: TStringList; Directorio: String);
+var
+ ListaDocumentosServidor: TStringList;
+ ANombreFichero: String;
+ AFichero: Binary;
+ i, j: Integer;
+begin
+ //Eliminamos todos los documentos del servidor que ya no existan en el cliente.
+ ListaDocumentosServidor := DarListaDocumentos(ID);
+ for i:= 0 to ListaDocumentosServidor.Count - 1 do
+ if not FListaDocumentos.Find(ListaDocumentosServidor.Strings[i], j) then
+ if not FDataModule.EliminarFichero(ID, ListaDocumentosServidor.Strings[i]) then
+ showmessage('Error al borrar fichero' + ListaDocumentosServidor.Strings[i]);
+
+ //Subimos todos los ficheros que halla al servidor (de momento no se miran fechas)
+ for i := 0 to FListaDocumentos.Count - 1 do
+ begin
+ ANombreFichero := Directorio + FListaDocumentos.Strings[i];
+ if FileExists(ANombreFichero) then
+ begin
+ AFichero := Binary.Create;
+ AFichero.LoadFromFile(ANombreFichero);
+ SubirFichero(ID, ExtractFileName(ANombreFichero), AFichero);
+ end;
+ end;
+end;
+
+function TGestorDocumentosController.SubirFichero(const ID: Integer;
+ const NombreFichero: String; const Fichero: Binary): Boolean;
+begin
+ Result := FDataModule.SubirFichero(ID, NombreFichero, Fichero);
+end;
+
+end.
diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dpk b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dpk
new file mode 100644
index 00000000..2e924952
Binary files /dev/null and b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dpk differ
diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dproj b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dproj
new file mode 100644
index 00000000..db4c7b38
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.dproj
@@ -0,0 +1,540 @@
+
+
+
+ {38eef566-1895-4bdd-8007-f92f5e32cce6}
+ GestorDocumentos_data.dpk
+ Debug
+ AnyCPU
+ DCC32
+ ..\..\..\..\Output\Debug\Cliente\GestorDocumentos_data.bpl
+
+
+ 7.0
+ False
+ False
+ 0
+ 3
+ .\
+ .\
+ .\
+ ..\..\..\..\Output\Debug\Cliente
+ ..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ RELEASE
+
+
+ 7.0
+ 3
+ .\
+ .\
+ .\
+ ..\..\..\..\Output\Debug\Cliente
+ ..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+ ..\..\..\Lib;..\..\Lib
+
+
+ Delphi.Personality
+ Package
+
+FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0GestorDocumentos_data.dpk
+
+
+
+
+ MainSource
+
+
+
+
+
+
+
+
diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc
new file mode 100644
index 00000000..b4be29cd
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc
@@ -0,0 +1,17 @@
+/* VER185
+ Generated by the CodeGear Delphi Pascal Compiler
+ because -GD or --drc was supplied to the compiler.
+
+ This file contains compiler-generated resources that
+ were bound to the executable.
+ If this file is empty, then no compiler-generated
+ resources were bound to the produced executable.
+*/
+
+STRINGTABLE
+BEGIN
+END
+
+/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\uDataModuleGestorDocumentos.dfm */
+/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\GestorDocumentos_data.res */
+/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf144.tmp */
diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.rc b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.rc
new file mode 100644
index 00000000..153736af
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.rc
@@ -0,0 +1,22 @@
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+FILEFLAGSMASK 0x3FL
+FILEFLAGS 0x00L
+FILEOS 0x40004L
+FILETYPE 0x1L
+FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "0C0A04E4"
+ BEGIN
+ VALUE "FileVersion", "1.0.0.0\0"
+ VALUE "ProductVersion", "1.0.0.0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0C0A, 1252
+ END
+END
diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.res b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.res
new file mode 100644
index 00000000..8b251f31
Binary files /dev/null and b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.res differ
diff --git a/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.dfm b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.dfm
new file mode 100644
index 00000000..63d42a2e
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.dfm
@@ -0,0 +1,16 @@
+inherited DataModuleGestorDocumentos: TDataModuleGestorDocumentos
+ OnCreate = DAClientDataModuleCreate
+ Height = 182
+ Width = 218
+ object Bin2DataStreamer: TDABin2DataStreamer
+ Left = 56
+ Top = 84
+ end
+ object RORemoteService: TRORemoteService
+ Message = dmConexion.ROMessage
+ Channel = dmConexion.ROChannel
+ ServiceName = 'srvGestorDocumentos'
+ Left = 56
+ Top = 24
+ end
+end
diff --git a/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas
new file mode 100644
index 00000000..015170d4
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas
@@ -0,0 +1,104 @@
+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;
+ 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;
+
+ 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.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.
diff --git a/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.dfm b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.dfm
new file mode 100644
index 00000000..b491e840
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.dfm
@@ -0,0 +1,6 @@
+object srvGestorDocumentos: TsrvGestorDocumentos
+ OldCreateOrder = True
+ ExportedDataTables = <>
+ Height = 113
+ Width = 254
+end
diff --git a/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas
new file mode 100644
index 00000000..11e94808
--- /dev/null
+++ b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas
@@ -0,0 +1,178 @@
+unit srvGestorDocumentos_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. }
+{----------------------------------------------------------------------------}
+
+{$I Remobjects.inc}
+
+interface
+
+uses
+ {vcl:} Classes, SysUtils,
+ {RemObjects:} uROXMLIntf, uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
+ {Required:} uRORemoteDataModule,
+ {Ancestor Implementation:} DataAbstractService_Impl,
+ {Used RODLs:} DataAbstract4_Intf,
+ {Generated:} FactuGES_Intf;
+
+type
+ { TsrvGestorDocumentos }
+ TsrvGestorDocumentos = class(TDataAbstractService, IsrvGestorDocumentos)
+ private
+ function DarRutaDocumentos: string;
+
+ protected
+ { IsrvGestorDocumentos methods }
+ function DarListaFicheros(const Almacen: TRdxAlmacenes; const ID: Integer): StringArray;
+ function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary;
+ function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
+ function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean;
+ end;
+
+implementation
+
+{$R *.dfm}
+uses
+ {Generated:} FactuGES_Invk, srvConfiguracion_Impl, uSistemaFunc, Dialogs;
+
+procedure Create_srvGestorDocumentos(out anInstance : IUnknown);
+begin
+ anInstance := TsrvGestorDocumentos.Create(nil);
+end;
+
+{
+
+Sample call
+
+You can try this function placing a ListBox and a button on a form and adding this code to the OnClick event of the button:
+
+procedure TForm1.Button1Click(Sender: TObject);
+var
+ list: TStringList;
+begin
+ list := FindFile('C:\Delphi\*.pas');
+ ListBox1.Items.Assign(list);
+ list.Free;
+end;
+}
+
+{ srvGestorDocumentos }
+function TsrvGestorDocumentos.DarListaFicheros(const Almacen: TRdxAlmacenes; const ID: Integer): StringArray;
+var
+ Ruta: String;
+ ListaFicheros: TStringList;
+ i: Integer;
+
+begin
+ Ruta := DarRutaDocumentos;
+ try
+ case Almacen of
+ TRdxAlmacenes_Presupuestos:
+ begin
+ Ruta := Ruta + '\presupuestos\' + IntToStr(ID) + '\*.*';
+ ListaFicheros := FindFile(Ruta);
+ Result := StringArray.Create();
+ for i := 0 to ListaFicheros.Count - 1 do
+ Result.Add(ExtractFileName(ListaFicheros.Strings[i]));
+ end;
+ end;
+
+ finally
+ if Assigned(ListaFicheros) then
+ FreeAndNil(ListaFicheros);
+ end;
+end;
+
+function TsrvGestorDocumentos.DarRutaDocumentos: string;
+var
+ AConfiguracionService : IsrvConfiguracion;
+ Intf : IInterface;
+ AClientID : TGUID;
+ Ruta: String;
+
+begin
+ CreateGUID(AClientID);
+ try
+ GetClassFactory('srvConfiguracion').CreateInstance(AClientID, Intf);
+ AConfiguracionService := Intf as IsrvConfiguracion;
+ Result := AConfiguracionService.darValor('RUTA');
+ finally
+ AConfiguracionService := Nil;
+ end;
+end;
+
+function TsrvGestorDocumentos.DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary;
+var
+ Ruta: String;
+
+begin
+ Result := Binary.Create;
+
+ try
+ Ruta := DarRutaDocumentos;
+ case Almacen of
+ TRdxAlmacenes_Presupuestos:
+ begin
+ Ruta := Ruta + '\presupuestos\' + IntToStr(ID) + '\' + NombreFichero;
+ Result.LoadFromFile(Ruta);
+ end;
+ end;
+ finally
+ //
+ end;
+end;
+
+function TsrvGestorDocumentos.EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer;
+const NombreFichero: String): Boolean;
+var
+ Ruta: String;
+
+begin
+ Result := False;
+
+ try
+ Ruta := DarRutaDocumentos;
+ case Almacen of
+ TRdxAlmacenes_Presupuestos:
+ begin
+ Ruta := Ruta + '\presupuestos\' + IntToStr(ID) + '\' + NombreFichero;
+ Result := DeleteFile(Ruta);
+ end;
+ end;
+ finally
+ //
+ end;
+end;
+
+function TsrvGestorDocumentos.SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String;
+ const Fichero: Binary): Boolean;
+var
+ Ruta: String;
+
+begin
+ Result := False;
+ try
+ Ruta := DarRutaDocumentos;
+ case Almacen of
+ TRdxAlmacenes_Presupuestos:
+ begin
+ Ruta := Ruta + '\presupuestos\' + IntToStr(ID) + '\' + NombreFichero;
+ Fichero.SaveToFile(Ruta);
+ Result := True;
+ end;
+ end;
+ finally
+ //
+ end;
+end;
+
+initialization
+ TROClassFactory.Create('srvGestorDocumentos', Create_srvGestorDocumentos, TsrvGestorDocumentos_Invoker);
+
+finalization
+
+end.
diff --git a/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dpk b/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dpk
index d7b4e52d..8d51711b 100644
Binary files a/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dpk and b/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dpk differ
diff --git a/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dproj b/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dproj
index 1d5c38ba..5b14182a 100644
--- a/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dproj
+++ b/Source/Modulos/Presupuestos de cliente/Controller/PresupuestosCliente_controller.dproj
@@ -42,18 +42,19 @@
Delphi.Personality
Package
-FalseTrueFalseTrueFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0PresupuestosCliente_controller.dpk
+FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0PresupuestosCliente_controller.dpk
MainSource
-
-
-
-
-
+
+
+
+
+
+
@@ -68,7 +69,7 @@