Ejemplo n.º 1
0
        private static ArrayList queryUtenti(DocsPaVO.utente.Corrispondente corr, string idAmm)
        {
            DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();

            qco.codiceRubrica     = corr.codiceRubrica;
            qco.getChildren       = true;
            qco.idAmministrazione = idAmm;
            qco.tipoUtente        = DocsPaVO.addressbook.TipoUtente.INTERNO;
            qco.fineValidita      = true;

            return(Utenti.addressBookManager.getListaCorrispondenti(qco));
        }
Ejemplo n.º 2
0
        private static DocsPaVO.trasmissione.Trasmissione ExecuteTransmission(DocsPaVO.documento.SchedaDocumento schedaDoc, string idGruppoDest, string idPeopleDest, DocsPaVO.utente.InfoUtente infoUtente)
        {
            DocsPaVO.trasmissione.Trasmissione trasm = new DocsPaVO.trasmissione.Trasmissione();

            DocsPaDB.Query_DocsPAWS.Utenti u = new DocsPaDB.Query_DocsPAWS.Utenti();

            trasm.ruolo  = u.GetRuoloByIdGruppo(infoUtente.idGruppo); //istanzaProcesso.RuoloProponente;
            trasm.utente = u.getUtenteById(infoUtente.idPeople);      //istanzaProcesso.UtenteProponente;
            DocsPaDB.Query_DocsPAWS.Documenti doc = new DocsPaDB.Query_DocsPAWS.Documenti();

            trasm.infoDocumento = schedaDoc.InfoDocumento;

            //INSERISCO LA RAGIONE DI TRASMISSIONE DI SISTEMA PER LIBRO FIRMA
            DocsPaVO.trasmissione.RagioneTrasmissione ragione = getRagioneTrasm(infoUtente.idAmministrazione, "D");

            //CREO LA TRASMISSIONE SINGOLA
            DocsPaVO.trasmissione.TrasmissioneSingola trasmSing = new DocsPaVO.trasmissione.TrasmissioneSingola();
            trasmSing.ragione   = ragione;
            trasmSing.tipoTrasm = "S";


            DocsPaDB.Query_DocsPAWS.Utenti utenti = new DocsPaDB.Query_DocsPAWS.Utenti();
            DocsPaVO.utente.Ruolo          ruolo  = utenti.GetRuoloByIdGruppo(idGruppoDest);
            trasmSing.corrispondenteInterno = ruolo;
            trasmSing.tipoDest = DocsPaVO.trasmissione.TipoDestinatario.RUOLO;

            System.Collections.ArrayList             listaUtenti = new System.Collections.ArrayList();
            DocsPaVO.addressbook.QueryCorrispondente qc          = new DocsPaVO.addressbook.QueryCorrispondente();
            qc.codiceRubrica = ruolo.codiceRubrica;
            System.Collections.ArrayList registri = ruolo.registri;
            qc.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
            //qc.idRegistri = registri;
            qc.idAmministrazione = ruolo.idAmministrazione;
            qc.getChildren       = true;
            qc.fineValidita      = true;
            listaUtenti          = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qc);
            System.Collections.ArrayList trasmissioniUt = new System.Collections.ArrayList();

            for (int k = 0; k < listaUtenti.Count; k++)
            {
                DocsPaVO.trasmissione.TrasmissioneUtente trUt = new DocsPaVO.trasmissione.TrasmissioneUtente();
                trUt.utente       = (DocsPaVO.utente.Utente)listaUtenti[k];
                trUt.daNotificare = (listaUtenti[k] as DocsPaVO.utente.Utente).idPeople.Equals(idPeopleDest);
                trasmissioniUt.Add(trUt);
            }

            trasmSing.trasmissioneUtente = trasmissioniUt;
            trasm.trasmissioniSingole    = new System.Collections.ArrayList()
            {
                trasmSing
            };
            return(BusinessLogic.Trasmissioni.ExecTrasmManager.saveExecuteTrasmMethod("", trasm));
        }
Ejemplo n.º 3
0
        private DocsPaVO.utente.Corrispondente ricercaCorr(DocsPaVO.FriendApplication.CorrLite corrispondente, DocsPaVO.utente.InfoUtente infoUtente)
        {
            try
            {
                DocsPaVO.utente.Corrispondente corr = null;
                //Verifica preesistenza della descrizione del corrispondente
                if (corrispondente.codice != null && corrispondente.codice != "")
                {
                    DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                    qco.codiceRubrica     = corrispondente.codice;
                    qco.getChildren       = false;
                    qco.idAmministrazione = infoUtente.idAmministrazione;
                    qco.tipoUtente        = DocsPaVO.addressbook.TipoUtente.GLOBALE;
                    ArrayList corrls = this.WS.AddressbookGetListaCorrispondenti(qco);
                    if (corrls != null && corrls.Count > 0)
                    {
                        corr = (DocsPaVO.utente.Corrispondente)corrls[0];
                    }
                }
                if (corr != null && corr.systemId != null && corr.systemId != "")
                {
                    //Trovato, cotrollo se la descrizione è quella inserita dall'utente
                    if (corrispondente.descrizione.ToUpper() == corr.descrizione.ToUpper())
                    {
                        //OK, è lo stesso, quindi si usa quello della rubrica di docspa, uso  corr
                    }
                    else
                    {
                        //Creo un OCC con la descrizione passata dall'utente
                        corr                    = new DocsPaVO.utente.Corrispondente();
                        corr.descrizione        = corrispondente.descrizione;
                        corr.tipoCorrispondente = "O";
                        corr.idAmministrazione  = infoUtente.idAmministrazione;
                    }
                }
                else
                {
                    //Non trovato, creo OCC
                    corr                    = new DocsPaVO.utente.Corrispondente();
                    corr.descrizione        = corrispondente.descrizione;
                    corr.tipoCorrispondente = "O";
                    corr.idAmministrazione  = infoUtente.idAmministrazione;
                }

                return(corr);
            }
            catch (Exception ex)
            {
                logger.Debug("Errore in DocsPaWSFriendApplication - metodo : ricercaCorr", ex);
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="infoUtente"></param>
        /// <param name="ruolo"></param>
        /// <param name="registro"></param>
        /// <param name="faxUserLogin"></param>
        /// <param name="faxUserCodRubrica"></param>
        /// <returns></returns>
        public static int processaCasellaFax(string serverName, DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.utente.Ruolo ruolo, DocsPaVO.utente.Registro registro, string faxUserLogin, string faxUserCodRubrica)
        {
            logger.Debug("processaCasellaFax");
            int rtn = 0;

            try
            {
                //si ricava il destinatario della trasmissione
                DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                System.Collections.ArrayList             reg = new System.Collections.ArrayList();
                reg.Add(registro.systemId);
                qco.codiceRubrica     = faxUserCodRubrica;
                qco.idAmministrazione = registro.idAmministrazione;
                qco.idRegistri        = reg;
                qco.getChildren       = false;
                System.Collections.ArrayList   corr         = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco);
                DocsPaVO.utente.Corrispondente destinatario = (DocsPaVO.utente.Corrispondente)corr[0];


                //ACCESSO AL FAX
                ZfLib.ZfAPI api = new ZfLib.ZfAPI();
                logger.Debug("Tentativo di login con " + faxUserLogin);
                ZfLib.UserSession session = api.Logon(faxUserLogin, false);
                logger.Debug("Login effettuata al server ZFAX con utenza " + faxUserLogin);
                ZfLib.ServerInfo sinfo = session.Server.GetServerInfo();
                bool             msgS  = session.Inbox.CheckNewMsgStatus();

                logger.Debug("Messaggi trovati bool: " + msgS);
                logger.Debug("Messaggi trovati: " + session.Inbox.GetMsgList().Count);
                string path = session.UserInDir;
                rtn = session.Inbox.GetMsgList().Count;
                for (int i = 0; i < session.Inbox.GetMsgList().Count; i++)
                {
                    logger.Debug("Esame messaggio " + i);
                    logger.Debug("Esame messaggio " + path);
                    logger.Debug("Esame messaggio " + destinatario.descrizione);
                    ZfLib.Message mess = session.Inbox.GetMsgList()[i];
                    processaMessaggio(serverName, path, mess, infoUtente, ruolo, registro, destinatario);
                    //cancellazione messaggio
                    logger.Debug("Esame messaggio inizia cancellazione " + i);
                    mess.DeleteMsg(false);
                    logger.Debug("Esame messaggio finita cancellazione " + i);
                }
                return(rtn);
            }
            catch (Exception e)
            {
                logger.Debug("Errore nella gestione dei fax (processaCasellaFax)", e);
                throw e;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="infoUtente"></param>
        /// <param name="corr"></param>
        /// <returns></returns>
        private static DocsPaVO.utente.Corrispondente[] queryUtenti(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.utente.Corrispondente corr)
        {
            //costruzione oggetto queryCorrispondente
            DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();

            qco.codiceRubrica     = corr.codiceRubrica;
            qco.getChildren       = true;
            qco.idAmministrazione = infoUtente.idAmministrazione;
            qco.fineValidita      = true;
            //corrispondenti interni
            qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;

            return((DocsPaVO.utente.Corrispondente[])
                   BusinessLogic.Utenti.addressBookManager.getListaCorrispondenti(qco).ToArray(typeof(DocsPaVO.utente.Corrispondente)));
        }
Ejemplo n.º 6
0
        /// <summary></summary>
        /// <param name="qco"></param>
        /// <returns></returns>
        public static string getMailAddress(DocsPaVO.addressbook.QueryCorrispondente qco, string idProfile)
        {
            logger.Debug("getMailAddress");
            string mailMitt = "";

            System.Collections.ArrayList mittArr = new System.Collections.ArrayList();
            if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.ESTERNO)
            {
                mittArr = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiEstMethod(qco);
            }
            else
            {
                mittArr = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco);
            }
            if (mittArr[0].GetType() == typeof(DocsPaVO.utente.UnitaOrganizzativa))
            {
                logger.Debug("UO");
                mailMitt = ((DocsPaVO.utente.UnitaOrganizzativa)mittArr[0]).email;
            }
            if (mittArr[0].GetType() == typeof(DocsPaVO.utente.Ruolo))
            {
                logger.Debug("Ruolo");
                mailMitt = ((DocsPaVO.utente.Ruolo)mittArr[0]).uo.email;
            }
            if (mittArr[0].GetType() == typeof(DocsPaVO.utente.Utente))
            {
                logger.Debug("Utente");
                mailMitt = ((DocsPaVO.utente.Ruolo)((DocsPaVO.utente.Utente)mittArr[0]).ruoli[0]).uo.email;
            }

            if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.ESTERNO)
            {
                //Invio la ricevuta di protocollazione all'indirizzo Email da cui ho ricevuto il documento.
                DocsPaDB.Query_DocsPAWS.Documenti doc = new DocsPaDB.Query_DocsPAWS.Documenti();
                string mailMittProfile = doc.GetEmailAddressDocument(idProfile);
                if (!string.IsNullOrEmpty(mailMittProfile))
                {
                    List <DocsPaVO.utente.MailCorrispondente> emails = BusinessLogic.Utenti.addressBookManager.GetMailCorrispondente((mittArr[0] as DocsPaVO.utente.Corrispondente).systemId);
                    if ((from e in emails where e.Email.Equals(mailMittProfile) select e).FirstOrDefault() != null)
                    {
                        mailMitt = mailMittProfile;
                    }
                }
            }

            logger.Debug(mailMitt);
            return(mailMitt);
        }
Ejemplo n.º 7
0
        private static ArrayList queryUtenti(string codiceRubrica, string idAmministrazione)
        {
            //costruzione oggetto queryCorrispondente
            DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();

            qco.codiceRubrica = codiceRubrica;
            qco.getChildren   = true;
            qco.fineValidita  = true;

            qco.idAmministrazione = idAmministrazione;

            //corrispondenti interni
            qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;

            return(Utenti.addressBookManager.getListaCorrispondenti(qco));
        }
Ejemplo n.º 8
0
        /// <summary></summary>
        /// <param name="idProfile"></param>
        /// <param name="reg"></param>
        /// <param name="numRegMitt"></param>
        /// <param name="qco"></param>
        /// <param name="separatore"></param>
        /// <param name="filePath"></param>
        private static void costruisciXml(string idProfile, DocsPaVO.utente.Registro reg, ref string numRegMitt, ref DocsPaVO.addressbook.QueryCorrispondente qco, string separatore, string filePath)
        {
            System.Data.DataSet      ds;
            DocsPaVO.utente.Registro registro = null;
            try
            {
                logger.Debug("costruisciXml");
                logger.Debug("" + separatore);

                #region Codice Commentato
                //query per recuperare le info sul mittente della segnatura

                /*
                 * string queryMittString="SELECT A.VAR_PROTO_IN, A.DTA_PROTO_IN, B.VAR_CODICE_AMM, B.CHA_TIPO_IE, B.VAR_COD_RUBRICA, B.ID_AMM FROM PROFILE A, DPA_CORR_GLOBALI B, DPA_DOC_ARRIVO_PAR C WHERE A.SYSTEM_ID="+idProfile;
                 * queryMittString=queryMittString+" AND B.SYSTEM_ID=C.ID_MITT_DEST AND C.ID_PROFILE=A.SYSTEM_ID";
                 * logger.Debug(queryMittString);
                 * db.fillTable(queryMittString,ds,"INFO_MITT");
                 */
                #endregion

                DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita();
                obj.getMittSegn(out ds, idProfile);

                System.Data.DataRow mittRow = ds.Tables["INFO_MITT"].Rows[0];

                char[] separator = { separatore.ToCharArray()[0] };

                //si trova il codice amministrazione del mittente
                string codiceAmmMittString = "";
                if (mittRow["CHA_TIPO_IE"].ToString().Equals("I"))
                {
                    //mittente interno
                    codiceAmmMittString = reg.codAmministrazione;
                }
                else
                {
                    //mittente esterno
                    codiceAmmMittString = mittRow["VAR_CODICE_AMM"].ToString();
                }
                string protoIn = mittRow["VAR_PROTO_IN"].ToString();
                logger.Debug(protoIn + " " + protoIn.Split(separator).Length);
                string codiceAOOMittString = "";
                string numeroRegMittString = "";
                if (!string.IsNullOrEmpty(protoIn))
                {
                    codiceAOOMittString = protoIn.Split(separator)[0];
                    if (protoIn.Contains(separatore))
                    {
                        numeroRegMittString = protoIn.Split(separator)[1];
                    }
                }
                numRegMitt = numeroRegMittString;

                //costruzione dell'oggetto per la richiesta mittente
                qco.codiceRubrica     = mittRow["VAR_COD_RUBRICA"].ToString();
                qco.idAmministrazione = mittRow["ID_AMM"].ToString();
                qco.systemId          = mittRow["SYSTEM_ID"].ToString();
                if (mittRow["CHA_TIPO_IE"].ToString().Equals("I"))
                {
                    qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
                }
                else
                {
                    qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.ESTERNO;
                }
                qco.getChildren = false;

                string dataRegMittString = "";
                if (mittRow["DTA_PROTO_IN"] != null && !mittRow["DTA_PROTO_IN"].ToString().Equals(""))
                {
                    dataRegMittString = System.Convert.ToDateTime(mittRow["DTA_PROTO_IN"]).ToString("yyyy-MM-dd");
                }

                #region Codice Commentato
                //query per recuperare le info per l'identificatore

                /*
                 * string queryProtoString="SELECT DTA_PROTO, NUM_PROTO FROM PROFILE WHERE SYSTEM_ID="+idProfile;
                 * logger.Debug(queryProtoString);
                 * db.fillTable(queryProtoString,ds,"INFO_PROTO");
                 */
                #endregion

                obj.getIdent(out ds, idProfile);

                System.Data.DataRow protoRow = ds.Tables["INFO_PROTO"].Rows[0];
                string numeroRegString       = protoRow["NUM_PROTO"].ToString();
                string dataRegString         = "";
                if (protoRow["DTA_PROTO"] != null && !protoRow["DTA_PROTO"].ToString().Equals(""))
                {
                    dataRegString = System.Convert.ToDateTime(protoRow["DTA_PROTO"]).ToString("yyyy-MM-dd");
                }
                //costruzione del file xml
                logger.Debug("Costruzione file xml");
                XmlDocument xdoc = new XmlDocument();
                //impostazione
                xdoc.XmlResolver = null;
                XmlDeclaration dec = xdoc.CreateXmlDeclaration("1.0", "UTF-8", null);
                xdoc.AppendChild(dec);

                //NON VALIDIAMO PIù CON LA DTD MA CON L'XSD
                //XmlDocumentType dtd = xdoc.CreateDocumentType("ConfermaRicezione", null, "Segnatura.dtd", null);
                //xdoc.AppendChild(dtd);
                //logger.Debug("dtd impostato");

                //creazione della root
                XmlElement root = xdoc.CreateElement("ConfermaRicezione");
                root.SetAttribute("xmlns", "http://www.digitPa.gov.it/protocollo/");
                xdoc.AppendChild(root);

                //creazione dell'identificatore
                XmlElement identificatore = xdoc.CreateElement("Identificatore");
                root.AppendChild(identificatore);

                XmlElement codiceAmm = xdoc.CreateElement("CodiceAmministrazione");
                codiceAmm.InnerText = reg.codAmministrazione;
                identificatore.AppendChild(codiceAmm);

                XmlElement codiceAOO = xdoc.CreateElement("CodiceAOO");

                //se è un RF, io devo comunque inviare la ricevuta dall'AOO.
                if (reg.chaRF != null && reg.chaRF == "1")
                {
                    if (!string.IsNullOrEmpty(reg.idAOOCollegata))
                    {
                        registro = BusinessLogic.Utenti.RegistriManager.getRegistro(reg.idAOOCollegata);
                    }
                    else
                    {
                        throw new Exception("Errore in costruiscixml conferma, l'RF " + reg.descrizione + " non ha una AOO collegata.");
                    }
                }
                if (registro != null)
                {
                    reg = registro;
                }


                codiceAOO.InnerText = reg.codRegistro;
                identificatore.AppendChild(codiceAOO);

                XmlElement codiceRegistro = xdoc.CreateElement("CodiceRegistro");
                codiceRegistro.InnerText = reg.codRegistro;
                identificatore.AppendChild(codiceRegistro);

                XmlElement numeroReg = xdoc.CreateElement("NumeroRegistrazione");
                numeroReg.InnerText = numeroRegString;
                identificatore.AppendChild(numeroReg);

                XmlElement dataReg = xdoc.CreateElement("DataRegistrazione");
                dataReg.InnerText = dataRegString;
                identificatore.AppendChild(dataReg);


                //creazione dell'identificatore mittente;
                XmlElement messRicevuto       = xdoc.CreateElement("MessaggioRicevuto");
                XmlElement identificatoreMitt = xdoc.CreateElement("Identificatore");

                XmlElement codiceAmmMitt = xdoc.CreateElement("CodiceAmministrazione");
                codiceAmmMitt.InnerText = codiceAmmMittString;
                identificatoreMitt.AppendChild(codiceAmmMitt);

                XmlElement codiceAOOMitt = xdoc.CreateElement("CodiceAOO");
                codiceAOOMitt.InnerText = codiceAOOMittString;
                identificatoreMitt.AppendChild(codiceAOOMitt);

                XmlElement codiceRegistroMitt = xdoc.CreateElement("CodiceRegistro");
                codiceRegistroMitt.InnerText = string.Empty;
                identificatoreMitt.AppendChild(codiceRegistroMitt);

                XmlElement numeroRegMitt = xdoc.CreateElement("NumeroRegistrazione");
                numeroRegMitt.InnerText = numeroRegMittString;
                identificatoreMitt.AppendChild(numeroRegMitt);

                XmlElement dataRegMitt = xdoc.CreateElement("DataRegistrazione");
                dataRegMitt.InnerText = dataRegMittString;
                identificatoreMitt.AppendChild(dataRegMitt);

                messRicevuto.AppendChild(identificatoreMitt);
                root.AppendChild(messRicevuto);

                //salvataggio file
                System.IO.FileStream fs = new System.IO.FileStream(filePath + "\\conferma.xml", System.IO.FileMode.Create);
                xdoc.Save(fs);
                fs.Close();
            }
            catch (Exception e)
            {
                logger.Error("Errore nella gestione dell'interoperabilità. (costruisciXml)", e);
                throw e;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idProfile"></param>
        /// <param name="reg"></param>
        private static bool sendNotificaAnnulla(string idProfile, DocsPaVO.utente.Registro reg)
        {
            System.Data.DataSet ds;
            bool esito = true;  //presume successo

            try
            {
                //BusinessLogic.Interoperabilità.InteroperabilitaControlloRicevute.processaRicevutaConferma();

                DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita();
                obj.getCampiReg(out ds, reg);

                System.Data.DataRow regRow = ds.Tables["REGISTRO"].Rows[0];
                reg.codAmministrazione = regRow["VAR_CODICE_AMM"].ToString();

                //inserimento dei files in una cartella temporanea
                string basePathFiles = ConfigurationManager.AppSettings["LOG_PATH"];
                basePathFiles = basePathFiles.Replace("%DATA", DateTime.Now.ToString("yyyyMMdd"));
                basePathFiles = basePathFiles + "\\Invio_notifica_annullamento_files";
                string pathFiles = basePathFiles + "\\" + regRow["VAR_CODICE"].ToString();
                DocsPaUtils.Functions.Functions.CheckEsistenzaDirectory(pathFiles);
                // logger.Debug(""+regRow["CHA_STR_SEGNATURA"].ToString().ToCharArray().Length);

                //costruzione del file xml
                string numRegMitt = "";
                DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();

                //costruisciXml(idProfile, reg,ref numRegMitt,ref qco, regRow["CHA_STR_SEGNATURA"].ToString(),pathFiles);
                string separatore = DocsPaDB.Utils.Personalization.getInstance(reg.idAmministrazione).getSepSegnatura();
                costruisciXml(idProfile, reg, ref numRegMitt, ref qco, separatore, pathFiles);

                //invio mail
                string mailMitt = Interoperabilità.InteroperabilitaUtils.getMailAddress(qco, idProfile);

                logger.Debug("Invio mail all'indirizzo " + mailMitt);
                string porta = null;
                if (regRow["NUM_PORTA_SMTP"] != null)
                {
                    porta = regRow["NUM_PORTA_SMTP"].ToString();
                }
                string smtp_user = (regRow["VAR_USER_SMTP"] != null && regRow["VAR_USER_SMTP"] != System.DBNull.Value) ? regRow["VAR_USER_SMTP"].ToString() : null;
                string smtp_pwd;
                if (regRow["VAR_PWD_SMTP"] != null && regRow["VAR_PWD_SMTP"] != System.DBNull.Value && regRow["VAR_USER_SMTP"] != null && regRow["VAR_USER_SMTP"] != System.DBNull.Value)
                {
                    smtp_pwd = Crypter.Decode(regRow["VAR_PWD_SMTP"].ToString(), regRow["VAR_USER_SMTP"].ToString());
                }
                else
                {
                    smtp_pwd = string.Empty;
                }

                //aggiunta la trim() per gestire la presenza di spazi bianchi nei campi VAR_USER_SMTP e VAR_PWD_SMTP
                if (smtp_user != null)
                {
                    smtp_user = smtp_user.Trim();
                }
                if (smtp_pwd != null)
                {
                    smtp_pwd = smtp_pwd.Trim();
                }

                // copia il file di segnatura
                //System.IO.File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + @"xml\segnatura.dtd",pathFiles +  "\\segnatura.dtd",true);
                creaMail(regRow["VAR_SERVER_SMTP"].ToString(), smtp_user, smtp_pwd, regRow["VAR_EMAIL_REGISTRO"].ToString(), mailMitt, numRegMitt, pathFiles, porta, regRow["CHA_SMTP_SSL"].ToString(), regRow["CHA_POP_SSL"].ToString(), regRow["CHA_SMTP_STA"].ToString());
                System.IO.File.Delete(pathFiles + "\\Annullamento.xml");
                DocsPaUtils.Functions.Functions.CancellaDirectory(pathFiles);
                DocsPaUtils.Functions.Functions.CancellaDirectory(basePathFiles);
            }
            catch (Exception e)
            {
                esito = false;
                logger.Error("Errore nella gestione dell'interoperabilità. (sendNotificaAnnullamento)", e);
                throw e;
            }
            return(esito);
        }
Ejemplo n.º 10
0
        public GetDettaglioElementoResponse GetDettaglioElemento(GetDettaglioElementoRequest request)
        {
            GetDettaglioElementoResponse response = new GetDettaglioElementoResponse();

            try
            {
                using (DocsPaWS.DocsPaWebService ws = new DocsPaWebService())
                {
                    DocsPaVO.addressbook.QueryCorrispondente query = new DocsPaVO.addressbook.QueryCorrispondente
                    {
                        idAmministrazione = request.InfoUtente.idAmministrazione,
                        systemId          = request.Id,
                        tipoUtente        = DocsPaVO.addressbook.TipoUtente.GLOBALE
                    };

                    var corrispondente = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(request.Id);

                    if (corrispondente == null)
                    {
                        throw new ApplicationException("Errore nel reperimento dei dati dell'elemento richiesto");
                    }

                    response.Elemento = new DettaglioElementoRubrica
                    {
                        Id          = corrispondente.systemId,
                        Codice      = corrispondente.codiceRubrica,
                        Descrizione = corrispondente.descrizione,
                        Email       = corrispondente.email
                    };

                    DocsPaVO.addressbook.DettagliCorrispondente dataSet = ws.AddressbookGetDettagliCorrispondente(query) as DocsPaVO.addressbook.DettagliCorrispondente;

                    if (dataSet == null)
                    {
                        throw new ApplicationException("Errore nel reperimento dei dati di dettaglio dell'elemento richiesto");
                    }

                    if (dataSet.Tables[0].Rows.Count > 0)
                    {
                        var row = dataSet.Corrispondente.Rows[0];

                        response.Elemento.Id            = request.Id;
                        response.Elemento.Indirizzo     = row["indirizzo"].ToString();
                        response.Elemento.Citta         = row["citta"].ToString();
                        response.Elemento.CAP           = row["cap"].ToString();
                        response.Elemento.Provincia     = row["provincia"].ToString();
                        response.Elemento.Nazione       = row["nazione"].ToString();
                        response.Elemento.Telefono      = row["telefono"].ToString();
                        response.Elemento.Telefono2     = row["telefono2"].ToString();
                        response.Elemento.Fax           = row["fax"].ToString();
                        response.Elemento.CodiceFiscale = row["codicefiscale"].ToString();
                        response.Elemento.Note          = row["note"].ToString();
                        response.Elemento.Localita      = row["localita"].ToString();
                        response.Elemento.LuogoNascita  = row["luogonascita"].ToString();
                        response.Elemento.DataNascita   = row["datanascita"].ToString();
                        response.Elemento.Titolo        = row["titolo"].ToString();
                    }
                    else
                    {
                        throw new ApplicationException("Nessun elemento trovato in rubrica per l'identificativo richiesto");
                    }
                }

                response.Success = true;
            }
            catch (Exception ex)
            {
                response         = new GetDettaglioElementoResponse();
                response.Success = false;

                if (request.TrowOnError)
                {
                    throw DocsPaUtils.Exceptions.SoapExceptionFactory.Create(ex);
                }
                else
                {
                    response.Exception = ex.Message;
                }
            }

            return(response);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// </summary>
        /// <param name="db"></param>
        /// <param name="idProject"></param>
        /// <param name="debug"></param>
        /// <returns></returns>
        internal static ArrayList getVisibilita(/*DocsPaWS.Utils.Database db,*/ string idProject, bool cercaRimossi, string rootFolder)
        {
            System.Collections.ArrayList listaDiritti = new System.Collections.ArrayList();

            //query distinte per i ruoli e per gli utenti
            //1-->inserimento ruoli
            DataSet dataSet;//= new  DataSet();

            DocsPaDB.Query_DocsPAWS.Fascicoli fascicoli = new DocsPaDB.Query_DocsPAWS.Fascicoli();
            fascicoli.GetVisibilita(out dataSet, idProject);
            fascicoli.Dispose();
            foreach (DataRow ruoloRow in dataSet.Tables["DIRITTI_RUOLI"].Rows)
            {
                DocsPaVO.fascicolazione.DirittoOggetto dirittoOggetto = new DocsPaVO.fascicolazione.DirittoOggetto();
                DocsPaVO.utente.Ruolo ruolo = new DocsPaVO.utente.Ruolo();
                DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                qco.codiceRubrica = ruoloRow["VAR_COD_RUBRICA"].ToString();
                qco.getChildren   = false;

                if (ruoloRow["ID_REGISTRO"] != null && !ruoloRow["ID_REGISTRO"].ToString().Equals(""))
                {
                    System.Collections.ArrayList reg = new System.Collections.ArrayList();
                    reg.Add(ruoloRow["ID_REGISTRO"].ToString());
                    qco.idRegistri = reg;
                }

                if (ruoloRow["ID_AMM"] != null && !ruoloRow["ID_AMM"].ToString().Equals(""))
                {
                    qco.idAmministrazione = ruoloRow["ID_AMM"].ToString();
                }

                qco.tipoUtente               = DocsPaVO.addressbook.TipoUtente.INTERNO;
                ruolo                        = (DocsPaVO.utente.Ruolo)BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco)[0];
                dirittoOggetto.idObj         = idProject;
                dirittoOggetto.soggetto      = ruolo;
                dirittoOggetto.tipoDiritto   = getDirittoFasc(ruoloRow["CHA_TIPO_DIRITTO"].ToString());
                dirittoOggetto.accessRights  = Convert.ToInt32(ruoloRow["ACCESSRIGHTS"]);
                dirittoOggetto.deleted       = false;
                dirittoOggetto.personorgroup = ruoloRow["PERSONORGROUP"].ToString();
                dirittoOggetto.rootFolder    = rootFolder;

                listaDiritti.Add(dirittoOggetto);
            }

            //2-->Inserimento utenti
            DocsPaDB.Query_DocsPAWS.Fascicoli fascicoliUtenti = new DocsPaDB.Query_DocsPAWS.Fascicoli();
            DataSet dataSet1;

            fascicoliUtenti.GetVisibilita1(out dataSet1, idProject);
            fascicoliUtenti.Dispose();
            DocsPaVO.addressbook.QueryCorrispondente qco1          = new DocsPaVO.addressbook.QueryCorrispondente();
            System.Collections.ArrayList             utentiInt     = new ArrayList();
            DocsPaVO.utente.Corrispondente           soggettoPropr = null;
            string delegante = "";

            if (dataSet1.Tables["DIRITTI_UTENTI"].Rows.Count > 1)
            {
                foreach (DataRow utenteRow in dataSet1.Tables["DIRITTI_UTENTI"].Rows)
                {
                    DocsPaVO.fascicolazione.TipoDiritto tipoDiritto = getDirittoFasc(utenteRow["CHA_TIPO_DIRITTO"].ToString());
                    if (tipoDiritto.Equals(DocsPaVO.fascicolazione.TipoDiritto.TIPO_PROPRIETARIO))
                    {
                        qco1.codiceRubrica = utenteRow["VAR_COD_RUBRICA"].ToString();
                        qco1.getChildren   = false;
                        if (utenteRow["ID_REGISTRO"] != null && !utenteRow["ID_REGISTRO"].ToString().Equals(""))
                        {
                            System.Collections.ArrayList reg = new System.Collections.ArrayList();
                            reg.Add(utenteRow["ID_REGISTRO"].ToString());
                            qco1.idRegistri = reg;
                        }
                        if (utenteRow["ID_AMM"] != null && !utenteRow["ID_AMM"].ToString().Equals(""))
                        {
                            qco1.idAmministrazione = utenteRow["ID_AMM"].ToString();
                        }
                        qco1.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;

                        //gadamo 16.12.2008
                        qco1.fineValidita = false; // voglio recuperare anche i disabilitati ( non mette "DTA_FINE IS NULL" nella query nel metodo Utenti.ListaCorrispondentiInt(qco) )


                        utentiInt = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco1);
                        //DocsPaVO.utente.Utente utProprietario = new DocsPaVO.utente.Utente();
                        //utentiInt = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco1);
                        if (utentiInt != null && utentiInt.Count > 0)
                        {
                            soggettoPropr = (DocsPaVO.utente.Utente)utentiInt[0];
                            //soggettoPropr = utProprietario;
                        }
                    }
                }
            }
            else
            {
                DataRow row = (DataRow)(dataSet1.Tables["DIRITTI_UTENTI"].Rows[0]);
                delegante = row["VAR_COGNOME"].ToString() + " " + row["VAR_NOME"].ToString();
            }


            foreach (DataRow utenteRow in dataSet1.Tables["DIRITTI_UTENTI"].Rows)
            {
                DocsPaVO.fascicolazione.DirittoOggetto dirittoOggetto = new DocsPaVO.fascicolazione.DirittoOggetto();
                DocsPaVO.utente.Utente utente = new DocsPaVO.utente.Utente();
                DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                qco.codiceRubrica = utenteRow["VAR_COD_RUBRICA"].ToString();
                qco.getChildren   = false;

                if (utenteRow["ID_REGISTRO"] != null && !utenteRow["ID_REGISTRO"].ToString().Equals(""))
                {
                    System.Collections.ArrayList reg = new System.Collections.ArrayList();
                    reg.Add(utenteRow["ID_REGISTRO"].ToString());
                    qco.idRegistri = reg;
                }

                if (utenteRow["ID_AMM"] != null && !utenteRow["ID_AMM"].ToString().Equals(""))
                {
                    qco.idAmministrazione = utenteRow["ID_AMM"].ToString();
                }

                qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
                ArrayList utenti = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco);
                utente = (DocsPaVO.utente.Utente)BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco)[0];
                dirittoOggetto.idObj       = idProject;
                dirittoOggetto.tipoDiritto = getDirittoFasc(utenteRow["CHA_TIPO_DIRITTO"].ToString());
                //dirittoOggetto.soggetto=utente;
                if (dirittoOggetto.tipoDiritto.Equals(DocsPaVO.fascicolazione.TipoDiritto.TIPO_DELEGATO))
                {
                    dirittoOggetto.soggetto = utente;
                    if (soggettoPropr != null)
                    {
                        dirittoOggetto.soggetto.descrizione = utente.descrizione + " sostituto di " + soggettoPropr.descrizione;
                    }
                    else
                    {
                        dirittoOggetto.soggetto.descrizione = utente.descrizione + " sostituto di " + delegante;
                    }
                }
                else
                {
                    dirittoOggetto.soggetto = utente;
                }
                dirittoOggetto.accessRights  = Convert.ToInt32(utenteRow["ACCESSRIGHTS"]);
                dirittoOggetto.deleted       = false;
                dirittoOggetto.personorgroup = utenteRow["PERSONORGROUP"].ToString();
                dirittoOggetto.rootFolder    = rootFolder;
                listaDiritti.Add(dirittoOggetto);
                logger.Debug("Utente inserito");
            }
            ;

            //3-4 --> inserimento ruoli e utenti rimossi
            if (cercaRimossi)
            {
                //3-->gestione ruoli diritti rimossi
                DataSet dsRuoliRimossi;//= new  DataSet();
                DocsPaDB.Query_DocsPAWS.Fascicoli fascRuoliRimossi = new DocsPaDB.Query_DocsPAWS.Fascicoli();
                fascRuoliRimossi.GetVisibilita_rimossi(out dsRuoliRimossi, idProject);
                fascRuoliRimossi.Dispose();
                foreach (DataRow ruoloRow in dsRuoliRimossi.Tables["DIRITTI_RUOLI_RIMOSSI"].Rows)
                {
                    DocsPaVO.fascicolazione.DirittoOggetto dirittoOggetto = new DocsPaVO.fascicolazione.DirittoOggetto();
                    DocsPaVO.utente.Ruolo ruolo = new DocsPaVO.utente.Ruolo();

                    DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                    qco.codiceRubrica = ruoloRow["VAR_COD_RUBRICA"].ToString();
                    qco.getChildren   = false;
                    if (ruoloRow["ID_REGISTRO"] != null && !ruoloRow["ID_REGISTRO"].ToString().Equals(""))
                    {
                        System.Collections.ArrayList reg = new System.Collections.ArrayList();
                        reg.Add(ruoloRow["ID_REGISTRO"].ToString());
                        qco.idRegistri = reg;
                    }
                    if (ruoloRow["ID_AMM"] != null && !ruoloRow["ID_AMM"].ToString().Equals(""))
                    {
                        qco.idAmministrazione = ruoloRow["ID_AMM"].ToString();
                    }
                    qco.tipoUtente               = DocsPaVO.addressbook.TipoUtente.INTERNO;
                    ruolo                        = (DocsPaVO.utente.Ruolo)BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco)[0];
                    dirittoOggetto.idObj         = idProject;
                    dirittoOggetto.soggetto      = ruolo;
                    dirittoOggetto.tipoDiritto   = getDirittoFasc(ruoloRow["CHA_TIPO_DIRITTO"].ToString());
                    dirittoOggetto.accessRights  = Convert.ToInt32(ruoloRow["ACCESSRIGHTS"]);
                    dirittoOggetto.deleted       = true;
                    dirittoOggetto.note          = ruoloRow["NOTE"].ToString();
                    dirittoOggetto.personorgroup = ruoloRow["PERSONORGROUP"].ToString();
                    dirittoOggetto.rootFolder    = rootFolder;
                    listaDiritti.Add(dirittoOggetto);
                }

                //4-->gestione utenti diritti rimossi
                DocsPaDB.Query_DocsPAWS.Fascicoli fascUtentiRimossi = new DocsPaDB.Query_DocsPAWS.Fascicoli();
                DataSet dsUtentiRimossi;
                fascUtentiRimossi.GetVisibilita_UtentiRimossi(out dsUtentiRimossi, idProject);
                fascUtentiRimossi.Dispose();
                foreach (DataRow utenteRow in dsUtentiRimossi.Tables["DIRITTI_UTENTI_RIMOSSI"].Rows)
                {
                    DocsPaVO.fascicolazione.DirittoOggetto dirittoOggetto = new DocsPaVO.fascicolazione.DirittoOggetto();
                    DocsPaVO.utente.Utente utente = new DocsPaVO.utente.Utente();
                    DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                    qco.codiceRubrica = utenteRow["VAR_COD_RUBRICA"].ToString();
                    qco.getChildren   = false;
                    if (utenteRow["ID_REGISTRO"] != null && !utenteRow["ID_REGISTRO"].ToString().Equals(""))
                    {
                        System.Collections.ArrayList reg = new System.Collections.ArrayList();
                        reg.Add(utenteRow["ID_REGISTRO"].ToString());
                        qco.idRegistri = reg;
                    }

                    if (utenteRow["ID_AMM"] != null && !utenteRow["ID_AMM"].ToString().Equals(""))
                    {
                        qco.idAmministrazione = utenteRow["ID_AMM"].ToString();
                    }

                    qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
                    ArrayList utenti = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco);
                    utente = (DocsPaVO.utente.Utente)BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco)[0];
                    dirittoOggetto.idObj         = idProject;
                    dirittoOggetto.soggetto      = utente;
                    dirittoOggetto.tipoDiritto   = getDirittoFasc(utenteRow["CHA_TIPO_DIRITTO"].ToString());
                    dirittoOggetto.accessRights  = Convert.ToInt32(utenteRow["ACCESSRIGHTS"]);
                    dirittoOggetto.deleted       = true;
                    dirittoOggetto.note          = utenteRow["NOTE"].ToString();
                    dirittoOggetto.personorgroup = utenteRow["PERSONORGROUP"].ToString();
                    dirittoOggetto.rootFolder    = rootFolder;
                    listaDiritti.Add(dirittoOggetto);
                    logger.Debug("Utente inserito");
                }
            }

            //ritorna la lista dei diritti
            return(listaDiritti);
        }
Ejemplo n.º 12
0
        /// <summary></summary>
        /// <param name="idProfile"></param>
        /// <param name="reg"></param>
        /// <param name="numRegMitt"></param>
        /// <param name="qco"></param>
        /// <param name="separatore"></param>
        /// <param name="filePath"></param>
        private static void costruisciXml(string idProfile, DocsPaVO.utente.Registro reg, ref string numRegMitt, ref DocsPaVO.addressbook.QueryCorrispondente qco, string separatore, string filePath)
        {
            System.Data.DataSet ds;

            try
            {
                logger.Debug("costruisciXml");
                logger.Debug("" + separatore);

                DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita();
                obj.getMittSegn(out ds, idProfile);

                System.Data.DataRow mittRow = ds.Tables["INFO_MITT"].Rows[0];

                char[] separator = { separatore.ToCharArray()[0] };

                //si trova il codice amministrazione del mittente
                string codiceAmmMittString = "";
                if (mittRow["CHA_TIPO_IE"].ToString().Equals("I"))
                {
                    //mittente interno
                    codiceAmmMittString = reg.codAmministrazione;
                }
                else
                {
                    //mittente esterno
                    codiceAmmMittString = mittRow["VAR_CODICE_AMM"].ToString();
                }
                string protoIn = mittRow["VAR_PROTO_IN"].ToString();
                logger.Debug(protoIn + " " + protoIn.Split(separator).Length);
                string codiceAOOMittString = protoIn.Split(separator)[0];
                string numeroRegMittString = (protoIn.Split(separator).Length > 1 ? protoIn.Split(separator)[1] : string.Empty);
                numRegMitt = numeroRegMittString;

                //costruzione dell'oggetto per la richiesta mittente
                qco.codiceRubrica     = mittRow["VAR_COD_RUBRICA"].ToString();
                qco.idAmministrazione = mittRow["ID_AMM"].ToString();
                if (mittRow["CHA_TIPO_IE"].ToString().Equals("I"))
                {
                    qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
                }
                else
                {
                    qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.ESTERNO;
                }
                qco.getChildren = false;

                string dataRegMittString = (!string.IsNullOrEmpty(mittRow["DTA_PROTO_IN"].ToString()) ? System.Convert.ToDateTime(mittRow["DTA_PROTO_IN"]).ToString("yyyy-MM-dd") : string.Empty);

                obj.getIdent(out ds, idProfile);

                System.Data.DataRow protoRow = ds.Tables["INFO_PROTO"].Rows[0];
                string numeroRegString       = protoRow["NUM_PROTO"].ToString();
                string dataRegString         = "";
                if (protoRow["DTA_PROTO"] != null && !protoRow["DTA_PROTO"].ToString().Equals(""))
                {
                    dataRegString = System.Convert.ToDateTime(protoRow["DTA_PROTO"]).ToString("yyyy-MM-dd");
                }
                string dataAnnullamento = "";
                if (protoRow["DTA_ANNULLA"] != null && !protoRow["DTA_ANNULLA"].ToString().Equals(""))
                {
                    dataAnnullamento = System.Convert.ToDateTime(protoRow["DTA_ANNULLA"]).ToString("yyyy-MM-dd");
                }
                string motivoAnnullamento = protoRow["VAR_AUT_ANNULLA"].ToString();

                //costruzione del file xml
                logger.Debug("Costruzione file xml");
                XmlDocument xdoc = new XmlDocument();
                //impostazione
                xdoc.XmlResolver = null;
                XmlDeclaration dec = xdoc.CreateXmlDeclaration("1.0", "UTF-8", null);
                xdoc.AppendChild(dec);
                //XmlDocumentType dtd = xdoc.CreateDocumentType("AnnullamentoProtocollazione", null, "Segnatura.dtd", null);
                //xdoc.AppendChild(dtd);
                //logger.Debug("dtd impostato");
                //creazione della root
                XmlElement root = xdoc.CreateElement("AnnullamentoProtocollazione");
                root.SetAttribute("xmlns", "http://www.digitPa.gov.it/protocollo/");
                xdoc.AppendChild(root);

                //creazione dell'identificatore
                XmlElement identificatore = xdoc.CreateElement("Identificatore");
                root.AppendChild(identificatore);

                XmlElement codiceAmm = xdoc.CreateElement("CodiceAmministrazione");
                codiceAmm.InnerText = reg.codAmministrazione;
                identificatore.AppendChild(codiceAmm);

                XmlElement codiceAOO = xdoc.CreateElement("CodiceAOO");
                //se è un RF, io devo comunque inviare la ricevuta dall'AOO.
                DocsPaVO.utente.Registro registro = new DocsPaVO.utente.Registro();
                if (reg.chaRF != null && reg.chaRF == "1")
                {
                    if (!string.IsNullOrEmpty(reg.idAOOCollegata))
                    {
                        registro = BusinessLogic.Utenti.RegistriManager.getRegistro(reg.idAOOCollegata);
                    }
                    else
                    {
                        throw new Exception("Errore in costruiscixml conferma, l'RF " + reg.descrizione + " non ha una AOO collegata.");
                    }
                }
                if (registro != null)
                {
                    reg = registro;
                }
                codiceAOO.InnerText = reg.codRegistro;

                identificatore.AppendChild(codiceAOO);

                XmlElement codiceRegistro = xdoc.CreateElement("CodiceRegistro");
                codiceRegistro.InnerText = reg.codRegistro;
                identificatore.AppendChild(codiceRegistro);

                XmlElement numeroReg = xdoc.CreateElement("NumeroRegistrazione");
                numeroReg.InnerText = numeroRegString;
                identificatore.AppendChild(numeroReg);

                XmlElement dataReg = xdoc.CreateElement("DataRegistrazione");
                dataReg.InnerText = dataRegString;
                identificatore.AppendChild(dataReg);

                //creazione motivo annullamento
                XmlElement motivoAnnulla = xdoc.CreateElement("Motivo");
                motivoAnnulla.InnerText = motivoAnnullamento;
                root.AppendChild(motivoAnnulla);

                //creazione provvedimento annullamento
                XmlElement provvedimento = xdoc.CreateElement("Provvedimento");
                provvedimento.InnerText = "";
                root.AppendChild(provvedimento);

                /* NON E' RICHIESTO
                 *             //creazione dell'identificatore mittente;
                 *             XmlElement messRicevuto=xdoc.CreateElement("MessaggioRicevuto");
                 *             XmlElement identificatoreMitt=xdoc.CreateElement("Identificatore");
                 *
                 *             XmlElement codiceAmmMitt=xdoc.CreateElement("CodiceAmministrazione");
                 *             codiceAmmMitt.InnerText=codiceAmmMittString;
                 *             identificatoreMitt.AppendChild(codiceAmmMitt);
                 *
                 *
                 *             XmlElement codiceAOOMitt=xdoc.CreateElement("CodiceAOO");
                 *             codiceAOOMitt.InnerText=codiceAOOMittString;
                 *             identificatoreMitt.AppendChild(codiceAOOMitt);
                 *
                 *             XmlElement numeroRegMitt=xdoc.CreateElement("NumeroRegistrazione");
                 *             numeroRegMitt.InnerText=numeroRegMittString;
                 *             identificatoreMitt.AppendChild(numeroRegMitt);
                 *
                 *             XmlElement dataRegMitt=xdoc.CreateElement("DataRegistrazione");
                 *             dataRegMitt.InnerText=dataRegMittString;
                 *             identificatoreMitt.AppendChild(dataRegMitt);
                 *
                 *             messRicevuto.AppendChild(identificatoreMitt);
                 *             root.AppendChild(messRicevuto);
                 */
                //salvataggio file
                System.IO.FileStream fs = new System.IO.FileStream(filePath + "\\Annullamento.xml", System.IO.FileMode.Create);
                xdoc.Save(fs);
                fs.Close();
            }
            catch (Exception e)
            {
                logger.Error("Errore nella gestione dell'interoperabilità. (costruisciXml)", e);
                throw e;
            }
        }
Ejemplo n.º 13
0
        /// <summary></summary>
        /// <param name="schedaDoc"></param>
        /// <returns></returns>
        public static DocsPaVO.documento.FileDocumento getBustaReport(DocsPaVO.documento.SchedaDocumento schedaDoc)
        {
            DocsPaVO.documento.FileDocumento result = new DocsPaVO.documento.FileDocumento();
            //string path = ReportUtils.getPathName();
            //string path = DocsPaUtils.Functions.Functions.GetReportsPath();
            string path = AppDomain.CurrentDomain.BaseDirectory + "report";

            try
            {
                logger.Debug("Generazione report");
                string report = ReportUtils.stringFile(path + "\\busta\\headerBusta.txt");
                System.Collections.ArrayList dest = ((DocsPaVO.documento.ProtocolloUscita)schedaDoc.protocollo).destinatari;

                for (int i = 0; i < ((DocsPaVO.documento.ProtocolloUscita)schedaDoc.protocollo).destinatari.Count; i++)
                {
                    string body = ReportUtils.stringFile(path + "\\busta\\bodyBusta.txt");
                    logger.Debug("Sostituzione campi destinatario " + i);
                    body = body.Replace("XNOME_REG", schedaDoc.registro.descrizione);
                    logger.Debug("Ricerca dettagli destinatario " + i);
                    DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();
                    qco.systemId = ((DocsPaVO.utente.Corrispondente)dest[i]).systemId;
                    DocsPaVO.addressbook.DettagliCorrispondente dettDest = BusinessLogic.Utenti.addressBookManager.dettagliCorrispondenteMethod(qco);
                    body = body.Replace("XNOME_DEST", ((DocsPaVO.utente.Corrispondente)dest[i]).descrizione);
                    body = body.Replace("XINDIRIZZO_DEST", dettDest.Corrispondente[0].indirizzo);
                    string citta = "";
                    if (dettDest.Corrispondente[0].cap != null)
                    {
                        citta = citta + dettDest.Corrispondente[0].cap + "   ";
                    }
                    ;
                    if (dettDest.Corrispondente[0].citta != null)
                    {
                        citta = citta + dettDest.Corrispondente[0].citta + "   ";
                    }
                    ;
                    if (dettDest.Corrispondente[0].nazione != null)
                    {
                        citta = citta + "(" + dettDest.Corrispondente[0].nazione + ")";
                    }
                    ;
                    body = body.Replace("XCITTA_DEST", citta);
                    if (i != 0)
                    {
                        body = body.Replace("XNEW_PAGE", "{\\b0\\lang1040\\langfe1033\\langnp1040 \\page }");
                    }
                    else
                    {
                        body = body.Replace("XNEW_PAGE", "");
                    }
                    report = report + body;
                }

                string bottom = ReportUtils.stringFile(path + "\\busta\\bottomBusta.txt");
                report = report + bottom;
                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        = "report.rtf";
                logger.Debug("fileDocumento generato");
            }
            catch (Exception e)
            {
                logger.Debug("Errore nella gestione di Report (getBustaReport)", e);
                throw e;
            }
            return(result);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="path"></param>
        /// <param name="messaggio"></param>
        /// <param name="infoUtente"></param>
        /// <param name="ruolo"></param>
        /// <param name="registro"></param>
        /// <param name="destinatario"></param>
        private static void processaMessaggio(string serverName, string path, ZfLib.Message messaggio, DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.utente.Ruolo ruolo, DocsPaVO.utente.Registro registro, DocsPaVO.utente.Corrispondente destinatario)
        {
            logger.Debug("processaMessaggio");
            System.IO.FileStream fs = null;
            bool daAggiornareUffRef = false;
            bool dbOpen             = false;
            bool fsOpen             = false;

            try
            {
                //informazioni sul fax
                string dataRic = messaggio.GetMsgHistories()[0].Date.ToString();
                logger.Debug(" @ dataric = " + dataRic);

                //accesso al file del fax
                fs = getFileStream(path + messaggio.GetMsgInfo().Body);              //=new System.IO.FileStream(path+messaggio.GetMsgInfo().Body+".G3N",System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,System.IO.FileShare.ReadWrite);

                logger.Debug(fs.CanRead.ToString() + "@ OK @");
                fsOpen = true;

                //creazione scheda documento
                DocsPaVO.documento.SchedaDocumento sd = new DocsPaVO.documento.SchedaDocumento();
                sd.idPeople = infoUtente.idPeople;

                logger.Debug("sd.idPeople = " + sd.idPeople.ToString());

                sd.userId = infoUtente.userId;
                logger.Debug("sd.userId = " + sd.userId.ToString());
                DocsPaVO.documento.Oggetto ogg = new DocsPaVO.documento.Oggetto();
                ogg.descrizione = "Fax ricevuto in data " + dataRic;              //DA COMPLETARE
                sd.oggetto      = ogg;
                sd.predisponiProtocollazione = true;
                sd.registro  = registro;
                sd.tipoProto = "A";
                sd.typeId    = "MAIL";

                //aggiunta protocollo entrata
                DocsPaVO.documento.ProtocolloEntrata protEntr = new DocsPaVO.documento.ProtocolloEntrata();
                DocsPaVO.utente.Corrispondente       mittente = new DocsPaVO.utente.Corrispondente();
                mittente.descrizione = messaggio.GetMsgInfo().Comment;
                logger.Debug(" @ mittente.descrizione = " + mittente.descrizione);               //"QUI SI METTONO INFORMAZIONI";
                protEntr.mittente = mittente;

                sd.protocollo = protEntr;
                protEntr.dataProtocollazione = System.DateTime.Today.ToString();
                sd.appId = "ACROBAT";
                sd       = BusinessLogic.Documenti.DocSave.addDocGrigia(sd, infoUtente, ruolo);
                logger.Debug("Salvataggio doc...");
                sd = BusinessLogic.Documenti.DocSave.save(infoUtente, sd, false, out daAggiornareUffRef, ruolo);
                logger.Debug("Salvataggio eseguito");
                DocsPaVO.documento.FileDocumento fd = new DocsPaVO.documento.FileDocumento();
                byte[] buffer = new byte[fs.Length];
                fs.Read(buffer, 0, (int)fs.Length);
                fd.content = buffer;
                fd.length  = buffer.Length;
                fd.name    = "fax.tif";

                BusinessLogic.Documenti.FileManager.putFile((DocsPaVO.documento.FileRequest)sd.documenti[0], fd, infoUtente);
                logger.Debug("Documento inserito");
                fs.Close();
                fsOpen = false;

                //TRASMISSIONE
                DocsPaVO.trasmissione.Trasmissione trasm = new DocsPaVO.trasmissione.Trasmissione();
                trasm.ruolo = ruolo;
                //db.openConnection();
                dbOpen       = true;
                trasm.utente = BusinessLogic.Utenti.UserManager.getUtente(infoUtente.idPeople);
                DocsPaVO.documento.InfoDocumento infoDoc = new DocsPaVO.documento.InfoDocumento();
                infoDoc.idProfile   = sd.systemId;
                infoDoc.docNumber   = sd.docNumber;
                infoDoc.oggetto     = sd.oggetto.descrizione;
                infoDoc.tipoProto   = "A";
                trasm.infoDocumento = infoDoc;
                //costruzione singole trasmissioni
                DocsPaVO.trasmissione.RagioneTrasmissione ragione = getRagioneTrasm();
                System.Collections.ArrayList dest = new System.Collections.ArrayList();
                dest.Add(destinatario);
                System.Collections.ArrayList trasmissioniSing = new System.Collections.ArrayList();

                for (int i = 0; i < dest.Count; i++)
                {
                    DocsPaVO.trasmissione.TrasmissioneSingola trSing = new DocsPaVO.trasmissione.TrasmissioneSingola();
                    trSing.ragione = ragione;
                    logger.Debug(dest[i].GetType().ToString());
                    if (dest[i].GetType().Equals(typeof(DocsPaVO.utente.Ruolo)))
                    {
                        logger.Debug("ruolo");
                        trSing.corrispondenteInterno = (DocsPaVO.utente.Ruolo)dest[i];
                    }
                    else
                    {
                        logger.Debug("utente");
                        trSing.corrispondenteInterno = (DocsPaVO.utente.Utente)dest[i];
                    }
                    logger.Debug("ok");
                    trSing.tipoTrasm = "S";
                    if (dest[i].GetType().Equals(typeof(DocsPaVO.utente.Ruolo)))
                    {
                        logger.Debug("caso ruolo");
                        trSing.tipoDest = DocsPaVO.trasmissione.TipoDestinatario.RUOLO;
                        //ricerca degli utenti del ruolo
                        System.Collections.ArrayList             utenti = new System.Collections.ArrayList();
                        DocsPaVO.addressbook.QueryCorrispondente qc     = new DocsPaVO.addressbook.QueryCorrispondente();
                        qc.codiceRubrica = ((DocsPaVO.utente.Ruolo)dest[i]).codiceRubrica;
                        System.Collections.ArrayList registri = new System.Collections.ArrayList();
                        registri.Add(registro.systemId);
                        qc.idRegistri        = registri;
                        qc.idAmministrazione = registro.idAmministrazione;
                        qc.getChildren       = true;
                        utenti = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qc);
                        System.Collections.ArrayList trasmissioniUt = new System.Collections.ArrayList();
                        for (int k = 0; k < utenti.Count; k++)
                        {
                            DocsPaVO.trasmissione.TrasmissioneUtente trUt = new DocsPaVO.trasmissione.TrasmissioneUtente();
                            trUt.utente = (DocsPaVO.utente.Utente)utenti[k];
                            trasmissioniUt.Add(trUt);
                        }
                        trSing.trasmissioneUtente = trasmissioniUt;
                    }
                    else
                    {
                        logger.Debug("Caso utente");
                        trSing.tipoDest = DocsPaVO.trasmissione.TipoDestinatario.UTENTE;
                        System.Collections.ArrayList             trasmissioniUt = new System.Collections.ArrayList();
                        DocsPaVO.trasmissione.TrasmissioneUtente trUt           = new DocsPaVO.trasmissione.TrasmissioneUtente();
                        trUt.utente = (DocsPaVO.utente.Utente)dest[i];
                        trasmissioniUt.Add(trUt);
                        trSing.trasmissioneUtente = trasmissioniUt;
                    }
                    trasmissioniSing.Add(trSing);
                }

                trasm.trasmissioniSingole = trasmissioniSing;
                if (infoUtente.delegato != null)
                {
                    trasm.delegato = ((DocsPaVO.utente.InfoUtente)(infoUtente.delegato)).idPeople;
                }
                //BusinessLogic.Trasmissioni.TrasmManager.saveTrasmMethod(trasm);
                //BusinessLogic.Trasmissioni.ExecTrasmManager.executeTrasmMethod(serverName,trasm);
                BusinessLogic.Trasmissioni.ExecTrasmManager.saveExecuteTrasmMethod(serverName, trasm);
            }
            catch (Exception e)
            {
                logger.Debug(e.Message);
                if (fsOpen)
                {
                    fs.Close();
                }
                if (dbOpen)
                {
                    //db.closeConnection();
                }

                logger.Debug("Errore nella gestione dei fax (processaMessaggio)", e);
                throw e;
            }
        }
Ejemplo n.º 15
0
        /// <summary></summary>
        /// <param name="qco"></param>
        /// <returns></returns>
        private static string getMailAddress(DocsPaVO.addressbook.QueryCorrispondente qco, string interop, string idProfile)
        {
            logger.Debug("getMailAddress");
            string mailMitt        = "";
            string mailMittProfile = "";

            System.Collections.ArrayList mittArr = new System.Collections.ArrayList();
            if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.ESTERNO)
            {
                //Chiamato altro metodo perchè quello in uso mette in join con una tabella non popolata DPA_RUOE_UTENTI, e quindi in alcuni casi non funziona
                //mittArr = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiEstMethod(qco);
                DocsPaDB.Query_DocsPAWS.Utenti utenti = new DocsPaDB.Query_DocsPAWS.Utenti();
                mittArr = utenti.ListaCorrispondentiEst2(qco);
            }
            else
            {
                mittArr = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiIntMethod(qco);
            }
            if (mittArr.Count == 0)
            {
                mittArr = BusinessLogic.Utenti.addressBookManager.listaCorrispondentiOccMethod(qco);
                if (mittArr.Count > 0)
                {
                    return(mittArr[0].ToString());
                }
            }
            if (mittArr.Count > 0)
            {
                DocsPaDB.Query_DocsPAWS.Documenti doc = new DocsPaDB.Query_DocsPAWS.Documenti();
                foreach (DocsPaVO.utente.Corrispondente c in mittArr)
                {
                    if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.ESTERNO)
                    {
                        //Invio la ricevuta di protocollazione all'indirizzo Email da cui ho ricevuto il documento.
                        mailMittProfile = doc.GetEmailAddressDocument(idProfile);
                        if (!string.IsNullOrEmpty(mailMittProfile))
                        {
                            c.Emails = BusinessLogic.Utenti.addressBookManager.GetMailCorrispondente(c.systemId);
                            if ((from e in c.Emails where e.Email.Equals(mailMittProfile) select e).FirstOrDefault() != null)
                            {
                                c.email = mailMittProfile;
                            }
                        }
                    }
                    if (c.GetType() == typeof(DocsPaVO.utente.UnitaOrganizzativa))
                    {
                        logger.Debug("UO");
                        if (string.IsNullOrEmpty(interop) || interop.Equals("I"))
                        {
                            mailMitt = ((DocsPaVO.utente.UnitaOrganizzativa)mittArr[0]).email;
                        }
                        else if (interop.Equals("P") && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                        else if (!string.IsNullOrEmpty(c.codiceAmm) && (!string.IsNullOrEmpty(c.codiceAOO)) && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                    }
                    if (c.GetType() == typeof(DocsPaVO.utente.Ruolo))
                    {
                        logger.Debug("Ruolo");
                        if (string.IsNullOrEmpty(interop) || interop.Equals("I"))
                        {
                            mailMitt = ((DocsPaVO.utente.Ruolo)mittArr[0]).uo.email;
                        }
                        else if (interop.Equals("P") && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                        else if (!string.IsNullOrEmpty(c.codiceAmm) && (!string.IsNullOrEmpty(c.codiceAOO)) && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                    }
                    if (c.GetType() == typeof(DocsPaVO.utente.Utente))
                    {
                        logger.Debug("Utente");
                        if (string.IsNullOrEmpty(interop) || interop.Equals("I"))
                        {
                            mailMitt = ((DocsPaVO.utente.Ruolo)((DocsPaVO.utente.Utente)mittArr[0]).ruoli[0]).uo.email;
                        }
                        else if (interop.Equals("P") && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                        else if (!string.IsNullOrEmpty(c.codiceAmm) && (!string.IsNullOrEmpty(c.codiceAOO)) && (!string.IsNullOrEmpty(c.email)))
                        {
                            mailMitt = c.email;
                            break;
                        }
                    }
                }
            }
            logger.Debug(mailMitt);
            return(mailMitt);
        }
Ejemplo n.º 16
0
        /// <summary></summary>
        /// <param name="qco"></param>
        /// <returns></returns>
        public static DocsPaVO.documento.FileDocumento stampa(DocsPaVO.addressbook.QueryCorrispondente qco)
        {
            //string path = ReportUtils.getPathName() + "\\corrispondenti\\";
            string path = AppDomain.CurrentDomain.BaseDirectory + "report\\corrispondenti\\";

            //string path = DocsPaUtils.Functions.Functions.GetReportsPath() + "\\corrispondenti\\";
            DocsPaVO.documento.FileDocumento result = new DocsPaVO.documento.FileDocumento();

            try
            {
                ArrayList report = new ArrayList();
                string    tmpStr = "";

                #region Testata
                tmpStr = ReportUtils.stringFile(path + "Header.txt");

                // Registri
                string registro = "COMUNI A TUTTI";
                if (qco.idRegistri.Count > 0)
                {
                    //db.openConnection();
                    registro = BusinessLogic.Utenti.RegistriManager.getRegistro((string)qco.idRegistri[0]).descrizione;
                    //db.closeConnection();
                }
                tmpStr = tmpStr.Replace("XREGISTRO", registro);

                // Tipo corrispondente
                string tipo = "INTERNI/ESTERNI";
                if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.INTERNO)
                {
                    tipo = "INTERNI";
                }
                else if (qco.tipoUtente == DocsPaVO.addressbook.TipoUtente.ESTERNO)
                {
                    tipo = "ESTERNI";
                }

                tmpStr = tmpStr.Replace("XFILTRO", tipo);
                ReportUtils.addStringToReport(tmpStr, ref report);
                #endregion Testata

                #region Tabella
                //testata
                tmpStr = ReportUtils.stringFile(path + "TableHead.txt");
                ReportUtils.addStringToReport(tmpStr, ref report);

                //righe
                string rowString = ReportUtils.stringFile(path + "Row.txt");
                qco.getChildren = false;

                // UO
                qco.descrizioneUO = "";
                addRows(BusinessLogic.Utenti.addressBookManager.getListaCorrispondenti(qco), rowString, ref report);
                qco.descrizioneUO = null;

                // Ruoli
                qco.descrizioneRuolo = "";
                addRows(BusinessLogic.Utenti.addressBookManager.getListaCorrispondenti(qco), rowString, ref report);
                qco.descrizioneRuolo = null;

                // Utenti
                qco.cognomeUtente = "";
                ArrayList lista = BusinessLogic.Utenti.addressBookManager.getListaCorrispondenti(qco);
                if (qco.tipoUtente != DocsPaVO.addressbook.TipoUtente.INTERNO)
                {
                    ArrayList listaSciolti = BusinessLogic.Utenti.addressBookManager.listaCorrEstSciolti(qco);
                    for (int i = 0; i < listaSciolti.Count; i++)
                    {
                        lista.Add(listaSciolti[i]);
                    }
                }
                addRows(lista, rowString, ref report);

                #endregion Tabella

                #region Bottom
                tmpStr = ReportUtils.stringFile(path + "Bottom.txt");
                ReportUtils.addStringToReport(tmpStr, ref report);
                #endregion Bottom

                result.content     = (byte[])report.ToArray(typeof(byte));
                result.length      = result.content.Length;
                result.contentType = "application/msword";
                result.name        = "report.rtf";
            }
            catch (Exception e)
            {
                logger.Debug("Errore nella gestione di Report (stampa)", e);
                throw e;
            }
            return(result);
        }
Ejemplo n.º 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idProfile"></param>
        /// <param name="reg"></param>
        private static void sendRicRitorno(string idProfile, DocsPaVO.utente.Registro reg, DocsPaVO.documento.SchedaDocumento schedaDoc, out string messaggioErrore)
        {
            System.Data.DataSet ds;
            messaggioErrore = string.Empty;
            try
            {
                //BusinessLogic.Interoperabilità.InteroperabilitaControlloRicevute.processaRicevutaConferma();

                DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita();
                obj.getCampiReg(out ds, reg);

                System.Data.DataRow regRow = ds.Tables["REGISTRO"].Rows[0];
                reg.codAmministrazione = regRow["VAR_CODICE_AMM"].ToString();

                //inserimento dei files in una cartella temporanea
                string basePathFiles = ConfigurationManager.AppSettings["LOG_PATH"];
                basePathFiles = basePathFiles.Replace("%DATA", DateTime.Now.ToString("yyyyMMdd"));
                basePathFiles = basePathFiles + "\\Invio_ricevuta_files\\" + Guid.NewGuid().ToString();
                string pathFiles = basePathFiles + "\\" + regRow["VAR_CODICE"].ToString();
                DocsPaUtils.Functions.Functions.CheckEsistenzaDirectory(pathFiles);
                // logger.Debug(""+regRow["CHA_STR_SEGNATURA"].ToString().ToCharArray().Length);

                //costruzione del file xml
                string numRegMitt = "";
                DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente();

                //costruisciXml(idProfile, reg,ref numRegMitt,ref qco, regRow["CHA_STR_SEGNATURA"].ToString(),pathFiles);
                string separatore = DocsPaDB.Utils.Personalization.getInstance(reg.idAmministrazione).getSepSegnatura();
                string mailMitt   = string.Empty;
                if (schedaDoc.typeId.ToUpper().Trim() == "INTEROPERABILITA")
                {
                    costruisciXml(idProfile, reg, ref numRegMitt, ref qco, separatore, pathFiles);
                }
                else
                {
                    //costruzione dell'oggetto per la richiesta mittente
                    System.Data.DataSet ds1;
                    DocsPaDB.Query_DocsPAWS.Interoperabilita obj1 = new DocsPaDB.Query_DocsPAWS.Interoperabilita();
                    obj1.getMittSegn(out ds1, idProfile);

                    System.Data.DataRow mittRow = ds1.Tables["INFO_MITT"].Rows[0];

                    qco.codiceRubrica     = mittRow["VAR_COD_RUBRICA"].ToString();
                    qco.idAmministrazione = mittRow["ID_AMM"].ToString();
                    qco.systemId          = mittRow["SYSTEM_ID"].ToString();
                    if (mittRow["CHA_TIPO_IE"].ToString().Equals("I"))
                    {
                        qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO;
                    }
                    else
                    {
                        qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.ESTERNO;
                    }
                    qco.getChildren = false;
                }

                //invio mail
                mailMitt = getMailAddress(qco, schedaDoc.interop, idProfile);
                if (string.IsNullOrEmpty(mailMitt))
                {
                    messaggioErrore = "Il Mittente non ha associata una mail.";
                    logger.Error("Il Mittente non ha associata una mail.");
                    throw new ApplicationException("Il Mittente non ha associata una mail.");
                }
                logger.Debug("Invio mail all'indirizzo " + mailMitt);
                string porta = null;
                if (regRow["NUM_PORTA_SMTP"] != null)
                {
                    porta = regRow["NUM_PORTA_SMTP"].ToString();
                }
                string smtp_user = (regRow["VAR_USER_SMTP"] != null && regRow["VAR_USER_SMTP"] != System.DBNull.Value) ? regRow["VAR_USER_SMTP"].ToString() : null;
                string smtp_pwd  = (regRow["VAR_PWD_SMTP"] != null && regRow["VAR_PWD_SMTP"] != System.DBNull.Value) ? regRow["VAR_PWD_SMTP"].ToString() : null;

                //aggiunta la trim() per gestire la presenza di spazi bianchi nei campi VAR_USER_SMTP e VAR_PWD_SMTP
                if (smtp_user != null)
                {
                    smtp_user = smtp_user.Trim();
                }
                if (smtp_pwd != null)
                {
                    smtp_pwd = smtp_pwd.Trim();
                }

                // copia il file di segnatura
                //System.IO.File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + @"xml\segnatura.dtd",pathFiles +  "\\segnatura.dtd",true);

                string mailBody     = getMailBody(idProfile, reg, separatore, schedaDoc);
                string subject_appo = "Conferma ricezione ''" + schedaDoc.oggetto.descrizione + "'' del " + System.Convert.ToDateTime(schedaDoc.dataCreazione).ToString("dd-MM-yyyy");
                string subject      = subject_appo; //= subject_appo.Substring(0, 256);
                if (subject_appo.Length > 256)
                {
                    subject = subject_appo.Substring(0, 256);
                }

                //aggiunta del docnumber all'oggetto delal mail per la gestione delle ricevute pec
                if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["GESTIONE_RICEVUTE_PEC"]) &&
                    bool.Parse(ConfigurationManager.AppSettings["GESTIONE_RICEVUTE_PEC"]))
                {
                    subject += "#" + schedaDoc.docNumber.ToString() + "#";
                }
                //Crypter.Decode(smtp_pwd, smtp_user)
                creaMail(regRow["VAR_SERVER_SMTP"].ToString(), smtp_user, Crypter.Decode(smtp_pwd, smtp_user), regRow["VAR_EMAIL_REGISTRO"].ToString(), mailMitt, numRegMitt, pathFiles, porta, regRow["CHA_SMTP_SSL"].ToString(), regRow["CHA_POP_SSL"].ToString(), regRow["CHA_SMTP_STA"].ToString(), mailBody, subject);

                //old: System.IO.File.Delete(pathFiles+"\\confermaRicezione.xml");
                System.IO.File.Delete(pathFiles + "\\conferma.xml");
                //System.IO.File.Delete(pathFiles+"\\segnatura.dtd");
                DocsPaUtils.Functions.Functions.CancellaDirectory(pathFiles);
                DocsPaUtils.Functions.Functions.CancellaDirectory(basePathFiles);
            }
            catch (Exception e)
            {
                if (string.IsNullOrEmpty(messaggioErrore))
                {
                    messaggioErrore = "Errore durante l'invio della ricevuta";
                }
                logger.Error("Errore nella gestione dell'interoperabilità. (sendRicevutaRitorno)", e);
                throw e;
            }
        }