diff --git a/ETS-WS/ETS-WS/WebShipUtils.cs b/ETS-WS/ETS-WS/WebShipUtils.cs
index e88a59c..60d5649 100644
--- a/ETS-WS/ETS-WS/WebShipUtils.cs
+++ b/ETS-WS/ETS-WS/WebShipUtils.cs
@@ -182,7 +182,7 @@ namespace ETS_WS
///
///
///
- public string nomeFileFromIdxFile(int idxFile)
+ public static string nomeFileFromIdxFile(int idxFile)
{
string answ = "";
try
@@ -193,6 +193,22 @@ namespace ETS_WS
{ }
return answ;
}
+ ///
+ /// nome del file da idx DB
+ ///
+ ///
+ ///
+ public static string nomeFileFullFromIdxFile(int idxFile)
+ {
+ string answ = "";
+ try
+ {
+ answ = utils.obj.taDoc.getByIdxFile(idxFile)[0].Nome;
+ }
+ catch
+ { }
+ return answ;
+ }
///
/// effettua operazione di archiviazione file
@@ -235,10 +251,38 @@ namespace ETS_WS
}
}
}
- // sposto il file!
- fileMover.obj.muoviFile(pathOrig, pathDest, nomeFile);
+ // ricalcolo nome file
+ string newFileName = WebShipUtils.nomeFileFullFromIdxFile((int)newIdxFile);
+ // sposto file
+ fileMover.obj.muoviFile(pathOrig, pathDest, nomeFile, newFileName, true);
+ }
+ ///
+ /// aggiorna file archiviato (prendendo da temp utente!)
+ ///
+ ///
+ public void aggiornaFileArchiviato(string nomeFile)
+ {
+ lg.Info("Caricato file {0} per sostituzione", nomeFile);
+ int idxFile = WebShipUtils.mng.idxFileEdit;
+ // effettuo operazioni sostituzione file!
+ docMetaDataSet docsData = WebShipUtils.mng.docMetaFromIdxFile(idxFile);
+ string path = docsData.path;
+ if (path != "")
+ {
+ // calcolo path
+ path = string.Format("{0}{1}", utils.obj.confReadString("archiveDir"), docsData.path);
+ // elimino file vecchio
+ fileMover.obj.eliminaFile(path, WebShipUtils.nomeFileFullFromIdxFile(idxFile));
+ // aggiorno su DB
+ utils.obj.taDoc.updateFile(idxFile, utils.obj.currUserAD, nomeFile, path);
+ lg.Info("Aggiornato in db nome file {0} per sostituzione", nomeFile);
+ // ricalcolo nome file
+ string newFileName = WebShipUtils.nomeFileFullFromIdxFile(idxFile);
+ // sposto file
+ fileMover.obj.muoviFile(WebShipUtils.mng.UserTempPath, path, nomeFile, newFileName, true);
+ lg.Info("Spostato file {0} per sostituzione", nomeFile);
+ }
}
-
}
///
diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs
index 639a587..0c6ae5f 100644
--- a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs
+++ b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs
@@ -244,26 +244,11 @@ namespace ETS_WS.WebUserControls
grView.SelectedIndex = grView.EditIndex;
WebShipUtils.mng.idxFileEdit = Convert.ToInt32(grView.SelectedDataKey["idxFile"]);
string nomeFile = mod_singleFileUpload1.newFileName;
- lg.Info("Caricato file {0} per sostituzione", nomeFile);
- int idxFile = WebShipUtils.mng.idxFileEdit;
- // effettuo operazioni sostituzione file!
- docMetaDataSet docsData = WebShipUtils.mng.docMetaFromIdxFile(idxFile);
- string path = docsData.path;
- if (path != "")
- {
- // calcolo path
- path = string.Format("{0}{1}", utils.obj.confReadString("archiveDir"), docsData.path);
- // elimino file vecchio
- fileMover.obj.eliminaFile(path, WebShipUtils.mng.nomeFileFromIdxFile(idxFile));
- // sposto file
- fileMover.obj.muoviFile(WebShipUtils.mng.UserTempPath, path, nomeFile);
- lg.Info("Spostato file {0} per sostituzione", nomeFile);
- // aggiorno su DB
- utils.obj.taDoc.updateFile(WebShipUtils.mng.idxFileEdit, utils.obj.currUserAD, nomeFile, path);
- lg.Info("Aggiornato in db nome file {0} per sostituzione", nomeFile);
- // update gridview!
- grView.DataBind();
- }
+ WebShipUtils.mng.aggiornaFileArchiviato(nomeFile);
+ // update gridview!
+ grView.DataBind();
}
+
+
}
}
\ No newline at end of file
diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs
index e4bce02..279d3de 100644
--- a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs
+++ b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs
@@ -34,7 +34,7 @@ namespace ETS_WS.WebUserControls
// verifico attivazione button submin (ovvero ci sono tutti i valori...)
btnSubmit.Visible = WebShipUtils.mng.metaPresent;
// mostro gen protocolli SE ho richiesta di generare protocollo
- pnlGenDocs.Visible = WebShipUtils.mng.currMetaData.reqProto;
+ pnlGenDocs.Visible = (WebShipUtils.mng.metaPresent && WebShipUtils.mng.currMetaData.reqProto);
}
///
/// richiesta update
@@ -80,8 +80,15 @@ namespace ETS_WS.WebUserControls
string pathDest = docsData.path;
if (pathDest != "")
{
+ pathDest = string.Format("{0}{1}", utils.obj.confReadString("archiveDir"), docsData.path);
string redattore = utils.obj.currUserCognomeNome; // usa utente corrente
WebShipUtils.archiviaFile(docsData, WebShipUtils.mng.UserTempPath, pathDest, nomeFile, redattore);
+
+ // recupero full path del documento
+ string fullPath="";
+ string protocollo="1234";
+ // prendo il nuovo file generato e sostituisco parte del nome con il codice protocollo
+ //officeXmlMan.replaceDocxText(fullPath, "Protocollo", protocollo); // !!!FARE!!!
}
Response.Redirect("~/GestioneDocumenti.aspx");
}
diff --git a/ETS-WS/ETS-WS/bin/ETS-WS.dll b/ETS-WS/ETS-WS/bin/ETS-WS.dll
index e44f7d1..19c1018 100644
Binary files a/ETS-WS/ETS-WS/bin/ETS-WS.dll and b/ETS-WS/ETS-WS/bin/ETS-WS.dll differ
diff --git a/ETS_Data/ETS_Data.csproj b/ETS_Data/ETS_Data.csproj
index 248ea80..350fa4f 100644
--- a/ETS_Data/ETS_Data.csproj
+++ b/ETS_Data/ETS_Data.csproj
@@ -47,6 +47,7 @@
true
+
..\ETS-WS\packages\NLog.2.0.0.2000\lib\net40\NLog.dll
@@ -76,6 +77,7 @@
DS_WebScip.xsd
+
True