Exemple #1
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;
            }
        }