public List <string> getClassificaDocumento(out List <string> lIdDossiers, string id) { ResourceFileManager resourceFileManager; resourceFileManager = ResourceFileManager.Instance; resourceFileManager.SetResources(); lIdDossiers = new List <string>(); ResultInfo ri = ResultInfo.NULL; WsClassifica.ClassificaDocumentoSearcher Searcher = new WsClassifica.ClassificaDocumentoSearcher(); _Logger.WriteOnLog(_sLogId, "getGruppiDescrizione: " + id, 3); _Logger.WriteOnLog(_sLogId, "getGruppiDescrizione: " + _Logger.ToJson(lIdDossiers), 3); Searcher.DocumentId = new DocumentIdentifier(); Searcher.DocumentId.Id = Int32.Parse(id); Searcher.TitolarioItemId = new TitolarioItemIdentifier(); Searcher.TitolarioItemId.Id = Int32.Parse(resourceFileManager.getConfigData("IdTitolario")); _Logger.WriteOnLog(_sLogId, "getGruppiDescrizione: " + _Logger.ToJson(Searcher.TitolarioItemId.Id), 3); List <WsClassifica.ClassificaDocumentoEntity> ReturnValue = new List <WsClassifica.ClassificaDocumentoEntity>(); //oEsito.Codice = "1"; WsClassifica.iClassificaServiceContractClient oWsClassifica = new WsClassifica.iClassificaServiceContractClient(); //WsClassifica.ResultInfo oResultInfoClassifica = new WsClassifica.ResultInfo(); try { ri = oWsClassifica.ReadClassificaDocumento(out ReturnValue, Searcher); _Logger.WriteOnLog(_sLogId, "getGruppiDescrizione: " + _Logger.ToJson(ri), 3); } catch (Exception e) { oWsClassifica.Close(); throw new Exception("Errore durante la lettura della classifica.", e); } oWsClassifica.Close(); if (ri == WsClassifica.ResultInfo.OK) { foreach (var value in ReturnValue) { int Id = Convert.ToInt32(value.Id.Id); lIdDossiers.Add(Id.ToString()); } } else { //oEsito.Codice = "0"; throw new Exception("Errore durante la lettura della classifica."); } return(lIdDossiers); //return oEsito; }
public List <string> getMetadati(List <dynamic> allMetadati, string LogId) { List <string> listaMetadati = new List <string>(); LOLIB Logger; Logger = new LOLIB(); Logger.WriteOnLog(LogId, "allMetadati: " + Logger.ToJson(allMetadati), 3); foreach (var x in allMetadati) { if (Int32.Parse(x.value) && Int32.Parse(x.value) != 24) { listaMetadati.Add(x.value); Logger.WriteOnLog(LogId, "x.value: " + Logger.ToJson(x.value), 3); } } return(listaMetadati); }
public string CreateDocx(NameValueCollection collectionForReplace, string sPathTemplateDocx, LOLIB oLogger, string LogId, out string errTags) { string sPath = ""; try { errTags = ""; string cfSelected = string.Empty; using (DocX document = DocX.Load(sPathTemplateDocx)) { for (int i = 0; i < collectionForReplace.Count; i++) { oLogger.WriteOnLog(LogId, "REPLACE Nome campo: " + "«" + collectionForReplace.GetKey(i) + "»" + " -> " + collectionForReplace.GetValues(i)[0], 3); document.ReplaceText("«" + collectionForReplace.GetKey(i) + "»", collectionForReplace.GetValues(i)[0]); } // Verifico che tutti i TAG presenti all'interno del file docx siano stati valorizzati var lineBreaks = document.FindUniqueByPattern("«*\\b[^»]*»", System.Text.RegularExpressions.RegexOptions.None); // Qualora siano presenti restituisco i tag non ripristinati come segnalazione di una anomalia if (lineBreaks.Count > 0) { foreach (var tagErr in lineBreaks) { errTags += tagErr + " "; } throw new ArgumentException("Sono stati trovati i seguenti tag non sostituiti: " + errTags); //break; } else { sPath = sPathTemplateDocx.ToLower().Replace(".docx", "_Completed.docx"); document.SaveAs(sPath); } } } catch (Exception ex) { throw new ArgumentException(ex.Message); } finally { } return(sPath); }