private void setTimestamp(ref DocsPaVO.documento.TimestampDoc timestampDoc, DataSet dataSet, int rowNumber) { try { if (dataSet.Tables[0].Columns.Contains("SYSTEM_ID")) { timestampDoc.SYSTEM_ID = dataSet.Tables[0].Rows[rowNumber]["SYSTEM_ID"].ToString(); } if (dataSet.Tables[0].Columns.Contains("DOC_NUMBER")) { timestampDoc.DOC_NUMBER = dataSet.Tables[0].Rows[rowNumber]["DOC_NUMBER"].ToString(); } if (dataSet.Tables[0].Columns.Contains("VERSION_ID")) { timestampDoc.VERSION_ID = dataSet.Tables[0].Rows[rowNumber]["VERSION_ID"].ToString(); } if (dataSet.Tables[0].Columns.Contains("ID_PEOPLE")) { timestampDoc.ID_PEOPLE = dataSet.Tables[0].Rows[rowNumber]["ID_PEOPLE"].ToString(); } if (dataSet.Tables[0].Columns.Contains("DTA_CREAZIONE")) { timestampDoc.DTA_CREAZIONE = dataSet.Tables[0].Rows[rowNumber]["DTA_CREAZIONE"].ToString(); } if (dataSet.Tables[0].Columns.Contains("DTA_SCADENZA")) { timestampDoc.DTA_SCADENZA = dataSet.Tables[0].Rows[rowNumber]["DTA_SCADENZA"].ToString(); } if (dataSet.Tables[0].Columns.Contains("NUM_SERIE")) { timestampDoc.NUM_SERIE = dataSet.Tables[0].Rows[rowNumber]["NUM_SERIE"].ToString(); } if (dataSet.Tables[0].Columns.Contains("S_N_CERTIFICATO")) { timestampDoc.S_N_CERTIFICATO = dataSet.Tables[0].Rows[rowNumber]["S_N_CERTIFICATO"].ToString(); } if (dataSet.Tables[0].Columns.Contains("ALG_HASH")) { timestampDoc.ALG_HASH = dataSet.Tables[0].Rows[rowNumber]["ALG_HASH"].ToString(); } if (dataSet.Tables[0].Columns.Contains("SOGGETTO")) { timestampDoc.SOGGETTO = dataSet.Tables[0].Rows[rowNumber]["SOGGETTO"].ToString(); } if (dataSet.Tables[0].Columns.Contains("PAESE")) { timestampDoc.PAESE = dataSet.Tables[0].Rows[rowNumber]["PAESE"].ToString(); } if (dataSet.Tables[0].Columns.Contains("TSR_FILE")) { timestampDoc.TSR_FILE = dataSet.Tables[0].Rows[rowNumber]["TSR_FILE"].ToString(); } } catch (Exception ex) { logger.Debug("SQL - setTimestamp - DocsPaDB/TimestampDoc.cs - Exception : " + ex.Message); } }
public ArrayList getTimestampsDoc(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.documento.FileRequest fileRequest) { DocsPaDB.DBProvider dbProvider = new DBProvider(); ArrayList timestampsDoc = new ArrayList(); try { if (fileRequest != null && !string.IsNullOrEmpty(fileRequest.versionId) && !string.IsNullOrEmpty(fileRequest.docNumber)) { DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("S_DPA_TIMESTAMP_DOC"); queryMng.setParam("versionId", fileRequest.versionId); queryMng.setParam("docNumber", fileRequest.docNumber); string commandText = queryMng.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - getTimestampsDoc - DocsPaDB/TimestampDoc.cs - QUERY : " + commandText); logger.Debug("SQL - getTimestampsDoc - DocsPaDB/TimestampDoc.cs - QUERY : " + commandText); DataSet dataSet = new DataSet(); dbProvider.ExecuteQuery(dataSet, commandText); if (dataSet.Tables[0].Rows.Count != 0) { for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { DocsPaVO.documento.TimestampDoc timestampDoc = new DocsPaVO.documento.TimestampDoc(); setTimestamp(ref timestampDoc, dataSet, i); timestampsDoc.Add(timestampDoc); } } } } catch (Exception ex) { logger.Debug("SQL - setTimestamp - DocsPaDB/TimestampDoc.cs - Exception : " + ex.Message); dbProvider.RollbackTransaction(); } return(timestampsDoc); }
/// <summary> /// Prelievo dei timestamp a partire dal docnumber. I timestamp sono riferiti solo all'ultima versione (funzione getmaxver) /// </summary> /// <param name="docnumber"></param> /// <returns></returns> public ArrayList getTimestampDocLastVersionLite(string docnumber) { DocsPaDB.DBProvider dbProvider = new DBProvider(); string dbType = System.Configuration.ConfigurationManager.AppSettings["DBType"]; ArrayList timestampsDoc = new ArrayList(); try { DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("S_DPA_TIMESTAMP_DOC_LASTVER_LITE"); queryMng.setParam("docNumber", docnumber); if (dbType.ToUpper() == "SQL") { queryMng.setParam("dbUser", DocsPaDbManagement.Functions.Functions.GetDbUserSession()); } string commandText = queryMng.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - getTimestampsDoc - DocsPaDB/TimestampDoc.cs - QUERY : " + commandText); logger.Debug("SQL - getTimestampsDoc - DocsPaDB/TimestampDoc.cs - QUERY : " + commandText); DataSet dataSet = new DataSet(); dbProvider.ExecuteQuery(dataSet, commandText); if (dataSet.Tables[0].Rows.Count != 0) { for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { DocsPaVO.documento.TimestampDoc timestampDoc = new DocsPaVO.documento.TimestampDoc(); setTimestamp(ref timestampDoc, dataSet, i); timestampsDoc.Add(timestampDoc); } } } catch (Exception ex) { logger.Debug("SQL - setTimestamp - DocsPaDB/TimestampDoc.cs - Exception : " + ex.Message); dbProvider.RollbackTransaction(); } return(timestampsDoc); }
/// <summary> /// Questo metodo crea i files Html con i dati contenuti negli items ordinandoli per tipo di ricerca /// </summary> /// <param name="items"></param> /// <param name="HtmlPath"></param> /// <param name="tipoRic"></param> /// <returns></returns> protected bool createHTML(ItemsConservazione[] items, string HtmlPath, string tipoRic) { RicercheHtml[] Ricerche = orderIndex(items, tipoRic); bool result = false; TextWriter twriter = null; //HtmlPath = Path.Combine(HtmlPath, "index.html"); string paragrafo = string.Empty; try { if (!File.Exists(HtmlPath)) { twriter = new StreamWriter(HtmlPath, false, Encoding.UTF8); twriter.WriteLine("<HTML>"); twriter.WriteLine("<HEAD>"); twriter.WriteLine("<TITLE> Ricerca per " + Ricerche[0].titoloRicerca + " </TITLE>"); twriter.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"../static/main.css\" />"); twriter.WriteLine("</HEAD>"); twriter.WriteLine("<BODY class=\"content\">"); twriter.WriteLine("<h3 align=center> Ricerca per " + Ricerche[0].titoloRicerca + " </h3>"); twriter.WriteLine("<br><br>"); twriter.WriteLine("<ol type='1'>"); //twriter.WriteLine("<HTML>"); //twriter.WriteLine("<font face='Verdana' size=2>"); //twriter.WriteLine("<HEAD>"); //twriter.WriteLine("<TITLE> Ricerca per " + Ricerche[0].titoloRicerca + " </TITLE>"); //twriter.WriteLine("</HEAD>"); //twriter.WriteLine("<BODY>"); //twriter.WriteLine("<h3 align=center> Ricerca per " + Ricerche[0].titoloRicerca + " </h3>"); //twriter.WriteLine("<br><br>"); //twriter.WriteLine("<ol type='1'>"); ArrayList arrayTipologia = new ArrayList(); for (int i = 0; i < Ricerche.Length; i++) { //i tag <ul> e <li> lo chiudo e lo riapro in questo punto dopo aver controllato se il paragrafo //è diverso da quello appena scritto!!! //SE è IL PRIMO ELEMENTO NON DEVO METTERE I TAG DI CHIUSURA ALL'INIZIO!!!!! switch (tipoRic) { case "tipologiaDocumento": if (paragrafo.ToUpper() != Ricerche[i].valoreRicerca.ToUpper()) { string path_relativo = "." + '\u002F'.ToString() + namePageHtml + Ricerche[i].valoreRicerca + ".html"; twriter.WriteLine("</ul>"); twriter.WriteLine("</li>"); //twriter.WriteLine("<li><b><a href='" + html_Path + "\\html\\" + namePageHtml + Ricerche[i].valoreRicerca + ".html'>" + Ricerche[i].valoreRicerca + "</a></b>"); twriter.WriteLine("<li><b><a target=\"_blank\" href='" + path_relativo + "'>" + Ricerche[i].valoreRicerca + "</a></b>"); twriter.WriteLine("<ul type='disc'>"); this.creaContatori((RicercheHtml)Ricerche[i], ref arrayTipologia, false); } else { this.creaContatori((RicercheHtml)Ricerche[i], ref arrayTipologia, true); } paragrafo = Ricerche[i].valoreRicerca; break; default: if (i > 0 && paragrafo != Ricerche[i].valoreRicerca) { twriter.WriteLine("</ul>"); twriter.WriteLine("</li>"); twriter.WriteLine("<li><b>" + Ricerche[i].valoreRicerca + "</b>"); twriter.WriteLine("<ul type='disc'>"); paragrafo = Ricerche[i].valoreRicerca; } else { if (i == 0) { twriter.WriteLine("<li><b>" + Ricerche[i].valoreRicerca + "</b>"); if ((Ricerche[i].itemsCons.ID_Project != string.Empty) && (tipoRic == "fascicolo")) { twriter.WriteLine("<br/><b>File metadati Fascicolo: </b><a target=\"_blank\" href='../Fascicoli/" + Ricerche[i].valoreRicerca + "/" + Ricerche[i].itemsCons.ID_Project.Replace('\u005C', '\u002F') + ".xml'> \\Fascicoli\\" + Ricerche[i].valoreRicerca + "\\" + Ricerche[i].itemsCons.ID_Project + ".xml</a>"); } twriter.WriteLine("<ul type='disc'>"); paragrafo = Ricerche[i].valoreRicerca; } } if (Ricerche[i].itemsCons.pathCD != string.Empty) { twriter.WriteLine("<li><a target=\"_blank\" href='.." + Ricerche[i].itemsCons.pathCD.Replace('\u005C', '\u002F') + "'>" + Ricerche[i].itemsCons.pathCD + "</a></li>"); twriter.WriteLine("<li type='circle'><b>File metadati: </b><a target=\"_blank\" href='.." + Ricerche[i].itemsCons.pathCD.Replace('\u005C', '\u002F') + ".xml'>" + Ricerche[i].itemsCons.pathCD + ".xml</a></li>"); } if (Ricerche[i].itemsCons.timestampDoc != null && Ricerche[i].itemsCons.timestampDoc.Count > 0) { for (int t = 0; t < Ricerche[i].itemsCons.timestampDoc.Count; t++) { DocsPaVO.documento.TimestampDoc times = (DocsPaVO.documento.TimestampDoc)Ricerche[i].itemsCons.timestampDoc[t]; string percorso = Ricerche[i].itemsCons.pathTimeStamp + '\u005C'.ToString() + "TS" + times.DOC_NUMBER + "-" + times.NUM_SERIE; twriter.WriteLine("<li type='circle'><b>Timestamp: </b><a target=\"_blank\" href='.." + percorso.Replace('\u005C', '\u002F') + ".tsr'>" + percorso + ".tsr</a></li>"); } } if (Ricerche[i].itemsCons.path_allegati != null) { for (int j = 0; j < Ricerche[i].itemsCons.path_allegati.Count; j++) { string[] app = Ricerche[i].itemsCons.path_allegati[j].ToString().Split('@'); twriter.WriteLine("<ul type='square'>"); twriter.WriteLine("<li><b>File allegato: </b><a target=\"_blank\" href='.." + app[0].Replace('\u005C', '\u002F') + "'>" + app[0].ToString() + "</a></li>"); for (int a = 1; a < app.Length; a++) { string allegato = app[0].Substring(0, app[0].Length - 4) + '\u005C'.ToString() + app[a]; twriter.WriteLine("<li type='circle'><b>Timestamp: </b><a target=\"_blank\" href='.." + allegato.Replace('\u005C', '\u002F') + "'>" + allegato + "</a></li>"); } twriter.WriteLine("</ul>"); } } break; } } if (tipoRic == "tipologiaDocumento") { for (int j = 0; j < arrayTipologia.Count; j++) { ArrayList contatori = ((ArrayList)arrayTipologia[j]); Contatore cont = (Contatore)contatori[0]; createHTML((ArrayList)arrayTipologia[j], html_Path + "\\html\\" + namePageHtml + cont.tipoDoc + ".html"); } } twriter.WriteLine("</ol>"); twriter.WriteLine("</BODY>"); twriter.WriteLine("</HTML>"); } result = true; } catch (Exception exHtml) { string err = "Errore nella creazione della pagina " + HtmlPath + " : " + exHtml.Message; logger.Debug(err); result = false; } finally { if (twriter != null) { twriter.Flush(); twriter.Close(); } } return(result); }