Exemplo n.º 1
0
        //OK
        public ArrayList getCorrispondentiByCodRF(string codiceRF)
        {
            ArrayList corr = new ArrayList();

            DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider();

            try
            {
                //semaforo.WaitOne();
                DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("GET_CORRISPONDENTE_BY_RF");
                queryMng.setParam("param1", codiceRF.ToUpper().Replace("'", "''"));
                string commandText = queryMng.getSQL();
                System.Diagnostics.Debug.WriteLine("SQL - getCorrispondentiByCodRF - RF.cs - QUERY : " + commandText);
                logger.Debug("SQL - getCorrispondentiByCodRF - RF.cs - QUERY : " + commandText);

                DataSet ds = new DataSet();
                dbProvider.ExecuteQuery(ds, commandText);

                DocsPaDB.Query_DocsPAWS.Utenti u = new DocsPaDB.Query_DocsPAWS.Utenti();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DocsPaVO.utente.Corrispondente c = u.GetCorrispondenteBySystemID(ds.Tables[0].Rows[i][0].ToString());
                    string ii = c.codiceRubrica;
                    // corr.Add(c);
                    if (c.tipoIE == "I")
                    {
                        corr.Add(u.GetCorrispondenteByCodRubrica(ds.Tables[0].Rows[i][1].ToString(), c.codiceRubrica, DocsPaVO.addressbook.TipoUtente.INTERNO));
                    }
                    if (c.tipoIE == "E")
                    {
                        corr.Add(u.GetCorrispondenteByCodRubrica(ds.Tables[0].Rows[i][1].ToString(), c.codiceRubrica, DocsPaVO.addressbook.TipoUtente.ESTERNO));
                    }
                }
            }
            catch
            {
                return(null);
            }
            finally
            {
                dbProvider.Dispose();
                //semaforo.ReleaseMutex();
            }

            return(corr);
        }
Exemplo n.º 2
0
        /// <summary></summary>
        /// <param name="schedaDoc"></param>
        /// <returns></returns>
        public static DocsPaVO.documento.FileDocumento getRicevutaProtocolloRtf(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.documento.SchedaDocumento schedaDoc)
        {
            DocsPaVO.documento.FileDocumento result = new DocsPaVO.documento.FileDocumento();
            string path = AppDomain.CurrentDomain.BaseDirectory + "report";

            try
            {
                logger.Debug("Generazione report");
                //string report = ReportUtils.stringFile(path + "\\ricevuta\\ricevuta.txt");
                string modelRootPath = System.Configuration.ConfigurationManager.AppSettings["MODELS_ROOT_PATH"];

                string report = ReportUtils.stringFile(string.Concat(modelRootPath, string.Format(@"\Modelli\{0}\Ricevute\{1}\Ricevuta.{2}", schedaDoc.registro.codAmministrazione, schedaDoc.registro.codRegistro, "rtf")));

                report = Regex.Replace(report, "#Amministrazione#", BusinessLogic.Amministrazione.AmministraManager.AmmGetInfoAmmCorrente(infoUtente.idAmministrazione).Descrizione, RegexOptions.IgnoreCase);
                report = Regex.Replace(report, "#Data ora protocollo#", BusinessLogic.Documenti.ProtoManager.getDataOraProtocollo(schedaDoc.docNumber), RegexOptions.IgnoreCase);
                report = Regex.Replace(report, "#Data protocollo#", schedaDoc.protocollo.dataProtocollazione, RegexOptions.IgnoreCase);
                report = Regex.Replace(report, "#Numero protocollo#", schedaDoc.protocollo.numero, RegexOptions.IgnoreCase);
                report = Regex.Replace(report, "#Segnatura#", schedaDoc.protocollo.segnatura, RegexOptions.IgnoreCase);
                report = Regex.Replace(report, "#Oggetto#", schedaDoc.oggetto.descrizione.Replace("\n", @" \par "), RegexOptions.IgnoreCase);

                if (schedaDoc.protocollatore != null)
                {
                    Corrispondente corr = new Corrispondente();
                    DocsPaDB.Query_DocsPAWS.Utenti obj = new DocsPaDB.Query_DocsPAWS.Utenti();
                    // PROTOCOLLATORE
                    if (schedaDoc.protocollatore.utente_idPeople != null && schedaDoc.protocollatore.utente_idPeople != string.Empty)
                    {
                        corr   = obj.GetCorrispondenteBySystemID(obj.GetIDUtCorr(schedaDoc.protocollatore.utente_idPeople));
                        report = Regex.Replace(report, "#Protocollatore#", corr.descrizione, RegexOptions.IgnoreCase);
                    }

                    // RUOLO PROTOCOLLATORE
                    if (schedaDoc.protocollatore.ruolo_idCorrGlobali != null && schedaDoc.protocollatore.ruolo_idCorrGlobali != string.Empty)
                    {
                        corr   = obj.GetCorrispondenteBySystemID(schedaDoc.protocollatore.ruolo_idCorrGlobali);
                        report = Regex.Replace(report, "#Ruolo protocollatore#", corr.descrizione, RegexOptions.IgnoreCase);
                    }

                    // UO PROTOCOLLATORE
                    if (schedaDoc.protocollatore.uo_idCorrGlobali != null && schedaDoc.protocollatore.uo_idCorrGlobali != string.Empty)
                    {
                        //descrizione
                        corr   = obj.GetCorrispondenteBySystemID(schedaDoc.protocollatore.uo_idCorrGlobali);
                        report = Regex.Replace(report, "#Uo protocollatore#", corr.descrizione, RegexOptions.IgnoreCase);
                    }
                }

                // NOTE
                // Reperimento dell'ultima nota visibile a tutti
                string testoNote = string.Empty;

                foreach (DocsPaVO.Note.InfoNota nota in BusinessLogic.Note.NoteManager.GetNote(infoUtente, new DocsPaVO.Note.AssociazioneNota(DocsPaVO.Note.AssociazioneNota.OggettiAssociazioniNotaEnum.Documento, schedaDoc.systemId), null))
                {
                    if (nota.TipoVisibilita == DocsPaVO.Note.TipiVisibilitaNotaEnum.Tutti)
                    {
                        testoNote = nota.Testo;
                        break;
                    }
                }

                report = Regex.Replace(report, "#Note#", testoNote, RegexOptions.IgnoreCase);


                //report custom pat momentaneo
                if (schedaDoc.creatoreDocumento != null && !string.IsNullOrEmpty(schedaDoc.creatoreDocumento.idCorrGlob_UO))
                {
                    Corrispondente corr = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemIDDisabled(schedaDoc.creatoreDocumento.idCorrGlob_UO);
                    report = Regex.Replace(report, "#Uo creatore#", corr.descrizione, RegexOptions.IgnoreCase);
                }
                else
                {
                    report = Regex.Replace(report, "#Uo creatore#", "", RegexOptions.IgnoreCase);
                }

                if (schedaDoc.protocollo.GetType() == typeof(DocsPaVO.documento.ProtocolloEntrata))
                {
                    report = Regex.Replace(report, "#Mittente#", ((DocsPaVO.documento.ProtocolloEntrata)schedaDoc.protocollo).mittente.descrizione, RegexOptions.IgnoreCase);
                }
                else if (schedaDoc.protocollo.GetType() == typeof(DocsPaVO.documento.ProtocolloUscita))
                {
                    report = Regex.Replace(report, "#Mittente#", ((DocsPaVO.documento.ProtocolloUscita)schedaDoc.protocollo).mittente.descrizione, RegexOptions.IgnoreCase);
                }
                else if (schedaDoc.protocollo.GetType() == typeof(DocsPaVO.documento.ProtocolloInterno))
                {
                    report = Regex.Replace(report, "#Mittente#", ((DocsPaVO.documento.ProtocolloInterno)schedaDoc.protocollo).mittente.descrizione, RegexOptions.IgnoreCase);
                }

                report = Regex.Replace(report, "#Numero Allegati#", schedaDoc.allegati.Count.ToString(), RegexOptions.IgnoreCase);

                logger.Debug("Generazione fileDocumento");
                logger.Debug("Creazione content");
                result.content = ReportUtils.toByteArray(report);
                logger.Debug("Content creato");
                result.length      = result.content.Length;
                result.contentType = "application/rtf";
                result.name        = "ricevuta.rtf";
                logger.Debug("fileDocumento generato");
            }
            catch (Exception e)
            {
                logger.Debug("Errore nella gestione di Report (getRicevutaProtocolloRtf)", e);
                throw e;
            }
            return(result);
        }