diff --git a/ETS-WS/ETS-WS/WebShipUtils.cs b/ETS-WS/ETS-WS/WebShipUtils.cs index 2bba66e..e88a59c 100644 --- a/ETS-WS/ETS-WS/WebShipUtils.cs +++ b/ETS-WS/ETS-WS/WebShipUtils.cs @@ -193,6 +193,52 @@ namespace ETS_WS { } return answ; } + + /// + /// effettua operazione di archiviazione file + /// + /// oggetto metadati documento + /// path origine del file + /// path di destinazione del file + /// nome del file da archiviare + /// redattore + public static void archiviaFile(docMetaDataSet docsData, string pathOrig, string pathDest, string nomeFile, string redattore) + { + string autore = ""; // tolto! + string numComm = ""; + string annoComm = ""; + // ricavo num ed anno commessa... + try + { + numComm = docsData.commessa.Substring(0, docsData.commessa.IndexOf("-")); + annoComm = docsData.commessa.Substring(docsData.commessa.IndexOf("-") + 1); + } + catch + { } + // salvo su db le info del file... + int? newIdxFile = 0; + utils.obj.taDoc.insertQuery(nomeFile, pathDest, utils.obj.currUserAD, docsData.reqProto, docsData.dataRic, docsData.dataDoc, numComm, annoComm, docsData.fase, docsData.fonte, docsData.oggetto, docsData.InOut, autore, redattore, docsData.isRed, ref newIdxFile); + // salvo i tags! + if (newIdxFile > 0) + { + // se ho tags... + if (docsData.tags.Count > 0) + { + foreach (string tag in docsData.tags) + { + try + { + utils.obj.taTags2Doc.Insert((int)newIdxFile, Convert.ToInt32(tag)); + } + catch + { } + } + } + } + // sposto il file! + fileMover.obj.muoviFile(pathOrig, pathDest, nomeFile); + } + } /// diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs index e9d7e7a..33eb6f7 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs @@ -200,19 +200,16 @@ namespace ETS_WS.WebUserControls // recupero metadati da sessione... docMetaDataSet docsData = WebShipUtils.mng.currMetaData; //check del path - string path = docsData.path; + string pathDest = docsData.path; // verifico path presente - if (path != "") + if (pathDest != "") { // aggiunto al path cartella archivio... - path = string.Format("{0}{1}", utils.obj.confReadString("archiveDir"), docsData.path); + pathDest = string.Format("{0}{1}", utils.obj.confReadString("archiveDir"), docsData.path); // verifico path valido o creo... - fileMover.checkDir(path); + fileMover.checkDir(pathDest); string nomeFile = ""; - string autore = ""; // tolto! string redattore = utils.obj.currUserCognomeNome; // usa utente corrente - string numComm = ""; - string annoComm = ""; // sposto i files selezionati secondo i dati in sessione foreach (GridViewRow riga in grView.Rows) { @@ -220,36 +217,7 @@ namespace ETS_WS.WebUserControls { // devo salvare file con le info relative... nomeFile = ((HyperLink)riga.FindControl("hlNome")).Text; - // ricavo num ed anno commessa... - try - { - numComm = docsData.commessa.Substring(0, docsData.commessa.IndexOf("-")); - annoComm = docsData.commessa.Substring(docsData.commessa.IndexOf("-") + 1); - } - catch - { } - // salvo su db le info del file... - int? newIdxFile = 0; - utils.obj.taDoc.insertQuery(nomeFile, path, utils.obj.currUserAD, docsData.reqProto, docsData.dataRic, docsData.dataDoc, numComm, annoComm, docsData.fase, docsData.fonte, docsData.oggetto, docsData.InOut, autore, redattore, docsData.isRed, ref newIdxFile); - // salvo i tags! - if (newIdxFile > 0) - { - // se ho tags... - if (docsData.tags.Count > 0) - { - foreach (string tag in docsData.tags) - { - try - { - utils.obj.taTags2Doc.Insert((int)newIdxFile, Convert.ToInt32(tag)); - } - catch - { } - } - } - } - // sposto il file! - fileMover.obj.muoviFile(WebShipUtils.mng.UserTempPath, path, nomeFile); + WebShipUtils.archiviaFile(docsData, WebShipUtils.mng.UserTempPath, pathDest, nomeFile, redattore); } } } diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs index 7a01905..6132a65 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs @@ -69,7 +69,19 @@ namespace ETS_WS.WebUserControls /// protected void btnStaccaProto_Click(object sender, EventArgs e) { - + // effettua upload del documento "dummy" proto + string nomeFile = "Proto.txt"; + fileMover.obj.muoviFile("~/DocTemplates/", WebShipUtils.mng.UserTempPath, nomeFile, false); + // stacco un nuovo protocollo! + docMetaDataSet docsData = WebShipUtils.mng.currMetaData; + //check del path + string pathDest = docsData.path; + if (pathDest != "") + { + string redattore = utils.obj.currUserCognomeNome; // usa utente corrente + WebShipUtils.archiviaFile(docsData, WebShipUtils.mng.UserTempPath, pathDest, nomeFile, redattore); + } + Response.Redirect("~/GestioneDocumenti.aspx"); } } } \ No newline at end of file diff --git a/ETS-WS/ETS-WS/bin/ETS-WS.dll b/ETS-WS/ETS-WS/bin/ETS-WS.dll index a81bf5f..083125f 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS-WS.dll and b/ETS-WS/ETS-WS/bin/ETS-WS.dll differ