diff --git a/ETS-WS/ETS-WS/Web.config b/ETS-WS/ETS-WS/Web.config index 3f390ac..eca267d 100644 --- a/ETS-WS/ETS-WS/Web.config +++ b/ETS-WS/ETS-WS/Web.config @@ -28,7 +28,7 @@ - + diff --git a/ETS-WS/ETS-WS/WebShipUtils.cs b/ETS-WS/ETS-WS/WebShipUtils.cs index 0a5a645..769e6bd 100644 --- a/ETS-WS/ETS-WS/WebShipUtils.cs +++ b/ETS-WS/ETS-WS/WebShipUtils.cs @@ -526,7 +526,100 @@ namespace ETS_WS return answ; } } + /// + /// determina se la data sia coperta da almeno un record segnaposto isRed, altrimenti lo crea! + /// + /// + /// + public static void dateIsOk(DateTime data) + { + bool answ = false; + string commessa = string.Format("0000-{1}", data.Year); + string fase = "- ALTRE ..."; + string fonte = "ETS Engineering & Technical Services S.p.A."; + string InOut = "Out"; + string oggetto = "n.d."; + bool isRed = true; + try + { + answ = utils.obj.taDoc.getBySearch(data.Date, data.Date.AddDays(1), commessa, fase, fonte, InOut, oggetto, isRed).Rows.Count > 0; + } + catch + { } + // se non c'è doc hole quotidiano lo crea! + if (!answ) + { + string nomeFile = "ETS-Proto.docx"; + docMetaDataSet docsData = new docMetaDataSet(); + docsData.commessa = commessa; + docsData.fase = fase; + docsData.fonte = fonte; + docsData.InOut = InOut; + docsData.oggetto = oggetto; + docsData.isRed = isRed; + WebShipUtils.mng.generaDocDaTemplate(nomeFile, docsData); + } + } + + /// + /// genera un doc da template, tramite + /// - salvataggio + /// - spostamento "dummy file" + /// - enter in modalità editing + /// + /// file TEMPLATE + /// metadati + public int generaDocDaTemplate(string nomeTemplate, docMetaDataSet docsData) + { + int idxFile = 0; + fileMover.obj.muoviFile("~/DocTemplates/", UserTempPath, nomeTemplate, false); + //check del path + string pathDest = docsData.path; + if (pathDest != "") + { + // verifico se è comunicazione red = riservata + string comPath = ""; + if (!docsData.isRed) + { + comPath = utils.obj.confReadString("archiveDir"); + } + else + { + comPath = utils.obj.confReadString("archiveDirRed"); + } + // aggiunto al path cartella archivio corretta... + pathDest = string.Format("{0}{1}", comPath, docsData.path); + // fix redattore + string redattore = utils.obj.currUserNomeCognome; // usa utente corrente + idxFile = WebShipUtils.archiviaFile(docsData, UserTempPath, pathDest, nomeTemplate, redattore); + // recupero dati documento + docsData = docMetaFromIdxFile(idxFile); + // recupero full path del documento + string fullPath = HttpContext.Current.Server.MapPath(string.Format("{0}{1}", pathDest, WebShipUtils.nomeFileFullFromIdxFile(idxFile))); + string protocollo = WebShipUtils.protocolloFromIdxFile(idxFile); + // se il nome contiene "docx" faccio sostituzioni... + if (nomeTemplate.IndexOf("docx") >= 0) + { + // prendo il nuovo file generato e sostituisco parte del nome con il codice protocollo // link: msdn.microsoft.com/en-us/library/bb508261.aspx + officeXmlMan.replaceDocxText(fullPath, "{{Protocollo}}", protocollo); + officeXmlMan.replaceDocxText(fullPath, "{{DataDoc}}", docsData.dataDoc.ToShortDateString()); + officeXmlMan.replaceDocxText(fullPath, "{{Redattore}}", utils.obj.currUserCognomeNome); + } + else if (nomeTemplate.IndexOf("eml") >= 0) + { + // creo un NUOVO file alla destinazione sostituendo l'esistente con apposita classe + string mittente = utils.obj.currUserEmail; + string destinatario = WebShipUtils.emailDaCodForn(docsData.fonte); + string subject = string.Format("{0}, prot. num {1}", docsData.oggetto, protocollo); + string body = string.Format("Commessa: {1}{0}Fase: {2}{0}Oggetto: {3}{0}prot. num: {4}", Environment.NewLine, docsData.commessa, docsData.fase, docsData.oggetto, protocollo); + string newFileName = WebShipUtils.CreaEml(mittente, destinatario, subject, body, null, HttpContext.Current.Server.MapPath(pathDest)); + // sostituisco file appena creato con quello nuovo + fileMover.obj.muoviFile(pathDest, pathDest, newFileName, WebShipUtils.nomeFileFullFromIdxFile(idxFile), true); + } + } + return idxFile; + } } /// diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx index 72a903f..1afde50 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx +++ b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx @@ -42,38 +42,38 @@ - + - + - + - + - + - + - + - + @@ -84,11 +84,11 @@ - + - +
@@ -99,16 +99,16 @@ - + - + - + @@ -116,7 +116,7 @@ - + @@ -124,10 +124,10 @@ - + - + diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs index ce93f92..e8f47f4 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_archivioDocumenti.ascx.cs @@ -358,6 +358,15 @@ namespace ETS_WS.WebUserControls } return answ; } - + /// + /// formatta protocollo come numero/anno + /// + /// + /// + /// + public string nrProtoAnno(object numero, object anno) + { + return string.Format("{0}-{1}", numero, anno); + } } } \ No newline at end of file diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs index 2044232..d244a3a 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_myTempFile.ascx.cs @@ -231,6 +231,7 @@ namespace ETS_WS.WebUserControls } } } + WebShipUtils.dateIsOk(DateTime.Now); grView.DataBind(); return answ; } diff --git a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs index e29c57b..8f5ba07 100644 --- a/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs +++ b/ETS-WS/ETS-WS/WebUserControls/mod_pathAndDocs.ascx.cs @@ -35,11 +35,6 @@ namespace ETS_WS.WebUserControls btnSubmit.Visible = WebShipUtils.mng.metaPresent; // mostro gen protocolli SE ho richiesta di generare protocollo pnlGenDocs.Visible = (WebShipUtils.mng.metaPresent && WebShipUtils.mng.currMetaData.reqProto); - // ricavo dati x email ed aggiorno - string dest = "info@steamware.net"; - string subject = "test"; - string body = "test email"; - aggiornaDatiMailTo(dest, subject, body); } /// /// richiesta update @@ -66,6 +61,7 @@ namespace ETS_WS.WebUserControls eh_reqSalva(this, new EventArgs()); } } +#if false /// /// genera un doc da template, tramite /// - salvataggio @@ -124,7 +120,8 @@ namespace ETS_WS.WebUserControls } } return idxFile; - } + } +#endif /// /// richiede salvataggio del protocollo, tramite /// - salvataggio @@ -137,7 +134,8 @@ namespace ETS_WS.WebUserControls { // effettua upload del documento "dummy" proto string nomeFile = "ETS-Proto.docx"; - generaDocDaTemplate(nomeFile); + WebShipUtils.mng.generaDocDaTemplate(nomeFile, WebShipUtils.mng.currMetaData); + WebShipUtils.dateIsOk(DateTime.Now); Response.Redirect("~/GestioneDocumenti.aspx"); } /// @@ -149,7 +147,8 @@ namespace ETS_WS.WebUserControls { // effettua upload del documento "dummy" lettera string nomeFile = "ETS-Lettera.docx"; - generaDocDaTemplate(nomeFile); + WebShipUtils.mng.generaDocDaTemplate(nomeFile, WebShipUtils.mng.currMetaData); + WebShipUtils.dateIsOk(DateTime.Now); Response.Redirect("~/GestioneDocumenti.aspx"); } /// @@ -161,7 +160,8 @@ namespace ETS_WS.WebUserControls { // effettua upload del documento "dummy" fax string nomeFile = "ETS-Fax.docx"; - generaDocDaTemplate(nomeFile); + WebShipUtils.mng.generaDocDaTemplate(nomeFile, WebShipUtils.mng.currMetaData); + WebShipUtils.dateIsOk(DateTime.Now); Response.Redirect("~/GestioneDocumenti.aspx"); } /// @@ -173,40 +173,9 @@ namespace ETS_WS.WebUserControls { // effettua upload del documento "dummy" fax string nomeFile = "email.eml"; - generaDocDaTemplate(nomeFile); + WebShipUtils.mng.generaDocDaTemplate(nomeFile, WebShipUtils.mng.currMetaData); + WebShipUtils.dateIsOk(DateTime.Now); Response.Redirect("~/GestioneDocumenti.aspx"); -#if false - // effettua upload del documento "dummy" proto - string nomeFile = "ETS-Proto.docx"; - int idxFile = generaDocDaTemplate(nomeFile); - // ricavo dati x email - string dest = "info@steamware.net"; - string subject = "test"; - string body = "test email"; - aggiornaDatiMailTo(dest, subject, body); -#endif - } - /// - /// script che aggiorna la funzione "mailto" dato idxFile e dati connessi - /// - /// - /// - /// - private void aggiornaDatiMailTo(string dest, string subject, string body) - { - //String csName = "mailToCS"; - //Type csType = this.GetType(); - //ClientScriptManager cs = Page.ClientScript; - //if (!cs.IsClientScriptBlockRegistered(csType, csName)) - //{ - // string pre = ""; - // string fullScript = string.Format("{0} {1} {2}", pre, scrVal, post); - // cs.RegisterClientScriptBlock(csType, csName, fullScript); - //} } } } \ 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 7e17ff2..cc8effc 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-WS/ETS-WS/bin/ETS_Data.dll b/ETS-WS/ETS-WS/bin/ETS_Data.dll index 9d693a0..46cf848 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS_Data.dll and b/ETS-WS/ETS-WS/bin/ETS_Data.dll differ diff --git a/ETS-WS/ETS-WS/bin/css/BuildBlocks.css b/ETS-WS/ETS-WS/bin/css/BuildBlocks.css index c197edc..cba72c8 100644 --- a/ETS-WS/ETS-WS/bin/css/BuildBlocks.css +++ b/ETS-WS/ETS-WS/bin/css/BuildBlocks.css @@ -22,7 +22,11 @@ { clear: both; } - +.padSxDx +{ + padding-left: 2px; + padding-right: 2px; +} /* @end */ /* zona size % div */ diff --git a/ETS-WS/ETS-WS/css/BuildBlocks.css b/ETS-WS/ETS-WS/css/BuildBlocks.css index c197edc..cba72c8 100644 --- a/ETS-WS/ETS-WS/css/BuildBlocks.css +++ b/ETS-WS/ETS-WS/css/BuildBlocks.css @@ -22,7 +22,11 @@ { clear: both; } - +.padSxDx +{ + padding-left: 2px; + padding-right: 2px; +} /* @end */ /* zona size % div */ diff --git a/ETS_Data/DS_WebScip.Designer.cs b/ETS_Data/DS_WebScip.Designer.cs index 7252eb5..9e85488 100644 --- a/ETS_Data/DS_WebScip.Designer.cs +++ b/ETS_Data/DS_WebScip.Designer.cs @@ -5892,6 +5892,7 @@ FROM tbDocumenti"; this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Fonte", global::System.Data.SqlDbType.NVarChar, 100, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@InOut", global::System.Data.SqlDbType.NVarChar, 3, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@searchAll", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@isRed", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[3].Connection = this.Connection; this._commandCollection[3].CommandText = "dbo.stp_tbDocs_getBySearch_Count"; @@ -6033,7 +6034,7 @@ FROM tbDocumenti"; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] - public virtual DS_WebScip.tbDocumentiDataTable getBySearch(global::System.Nullable inizio, global::System.Nullable fine, string Commessa, string Fase, string Fonte, string InOut, string searchAll) { + public virtual DS_WebScip.tbDocumentiDataTable getBySearch(global::System.Nullable inizio, global::System.Nullable fine, string Commessa, string Fase, string Fonte, string InOut, string searchAll, global::System.Nullable isRed) { this.Adapter.SelectCommand = this.CommandCollection[2]; if ((inizio.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((System.DateTime)(inizio.Value)); @@ -6077,6 +6078,12 @@ FROM tbDocumenti"; else { this.Adapter.SelectCommand.Parameters[7].Value = ((string)(searchAll)); } + if ((isRed.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[8].Value = ((bool)(isRed.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[8].Value = global::System.DBNull.Value; + } DS_WebScip.tbDocumentiDataTable dataTable = new DS_WebScip.tbDocumentiDataTable(); this.Adapter.Fill(dataTable); return dataTable; diff --git a/ETS_Data/DS_WebScip.xsd b/ETS_Data/DS_WebScip.xsd index 941a6e3..3f8103f 100644 --- a/ETS_Data/DS_WebScip.xsd +++ b/ETS_Data/DS_WebScip.xsd @@ -372,6 +372,7 @@ SELECT idxFile, NomeFile, Nome, fullPath, userId, isRed, NrProtocollo, Numero, A + @@ -902,7 +903,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -974,7 +975,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -1142,7 +1143,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -1170,7 +1171,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -1184,7 +1185,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -1192,7 +1193,7 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - + @@ -1296,8 +1297,8 @@ SELECT userId, setName, Commessa, Fase, Fonte, Oggetto, DataRic, DataDoc, path, - - + + \ No newline at end of file