Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="checkResponse"></param>
        private void SetMailMessageCount(MailAccountCheckResponse checkResponse)
        {
            string message = string.Empty;

            if (checkResponse.MailProcessedList.Length == 0)
            {
                message = "Nessun messaggio trovato";
            }
            else
            {
                message = "Totale: " + checkResponse.MailProcessedList.Length.ToString();

                int countProcessed = checkResponse.MailProcessedList.Length;

                foreach (MailProcessed mail in checkResponse.MailProcessedList)
                {
                    //if (mail.ErrorMessage!=string.Empty)
                    if ((!string.IsNullOrEmpty(mail.ErrorMessage)) && (!mail.ErrorMessage.Contains("INTEROPERABILITA")))
                    {
                        //Andrea De Marco - Mev Gestione Eccezioni
                        //if (!mail.ErrorMessage.Contains("OK. Eccezione non bloccante."))
                        if (!mail.ErrorMessage.Contains("OK. Eccezione non bloccante nella segnatura informatica"))
                        {
                            countProcessed--;
                        }
                    }
                }
                message += " - Validi: " + countProcessed.ToString();
            }

            this.txtMailMessageCount = message;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void Fetch()
        {
            MailAccountCheckResponse checkResponse = this.GetCheckResponse();

            if (checkResponse != null)
            {
                this.FetchMailAccountCheckInfo(checkResponse);

                this.SetMailMessageCount(checkResponse);

                this.FetchGridMailMessages(checkResponse);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Refresh della pagina dopo aver applicato i filtri sul tipo di notifica da visualizzare nella griglia di riepilogo
        /// </summary>
        private void Refresh()
        {
            MailAccountCheckResponse checkResponse = MailCheckResponse;

            if (checkResponse != null)
            {
                this.FetchMailAccountCheckInfo();
                TipiMailRicevutaPEC = TipoMailRicevutaPec;
                DataSet ds = this.UpdateToDataSet(checkResponse);
                this.GrdMails.DataSource = ds;
                this.GrdMails.DataBind();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Refresh della pagina dopo aver applicato i filtri sul tipo di notifica da visualizzare nella griglia di riepilogo
        /// </summary>
        private void Refresh()
        {
            MailAccountCheckResponse checkResponse = this.GetCheckResponse();

            if (checkResponse != null)
            {
                this.FetchMailAccountCheckInfo(checkResponse);
                this.SetMailMessageCount(checkResponse);
                TipiMailRicevutaPEC = HttpContext.Current.Session["TipiMailRicevutaPEC"] as Dictionary <string, int>;
                DataSet ds = this.UpdateToDataSet(checkResponse);
                this.grdCheckResponse.DataSource = ds;
                this.grdCheckResponse.DataBind();
            }
        }
Ejemplo n.º 5
0
        public static InteropCreazioneDocResponse InteropCreazioneDoc(InteropCreazioneDocRequest request)
        {
            Registro reg   = RegistriManager.getRegistro(request.IdRegistro);
            Utente   ut    = UserManager.getUtente(request.InfoUtente.IdPeople);
            Ruolo    ruolo = UserManager.getRuolo(request.Ruolo.Id);
            InteropSchedaDocHandler  handler           = new InteropSchedaDocHandler(request);
            MailAccountCheckResponse mailCheckResponse = null;
            bool result = InteroperabilitaRicezione.interopRiceviMethodProtocollazione(request.ServerName, reg, ut, ruolo, handler, out mailCheckResponse);
            InteropCreazioneDocResponse response = new InteropCreazioneDocResponse();

            response.Code         = (result) ? InteropCreazioneDocResponseCode.OK : InteropCreazioneDocResponseCode.KO;
            response.ErrorMessage = mailCheckResponse.ErrorMessage;
            return(response);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="checkResponse"></param>
        private void FetchMailAccountCheckInfo(MailAccountCheckResponse checkResponse)
        {
            this.txtMailUserID.Text     = checkResponse.MailUserID;
            this.txtMailServer.Text     = checkResponse.MailServer;
            this.txtMailAddress.Text    = checkResponse.MailAddress;
            this.txtCodiceRegistro.Text = checkResponse.Registro;

            string errorMessage = "OK";

            if (checkResponse.ErrorMessage != string.Empty)
            {
                errorMessage = checkResponse.ErrorMessage;
            }
            this.panelCheckResponse.InnerText = errorMessage;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Deserializzazione del contenuto del file di log
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        protected virtual MailAccountCheckResponse DeserializeContent(string filePath)
        {
            MailAccountCheckResponse retValue = null;

            XmlSerializer serializer = new XmlSerializer(typeof(MailAccountCheckResponse));

            XmlTextReader reader = new XmlTextReader(filePath);

            if (serializer.CanDeserialize(reader))
            {
                retValue = (MailAccountCheckResponse)serializer.Deserialize(reader);
            }

            reader.Close();

            return(retValue);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Serializzazione del contenuto su file di log
        /// </summary>
        /// <param name="logPath"></param>
        /// <param name="checkResponse"></param>
        protected virtual void SerializeContent(string logPath, MailAccountCheckResponse checkResponse)
        {
            string fullName = Path.Combine(logPath, this.GetLogFileName());

            TextWriter    textWriter = new StreamWriter(fullName, false);
            XmlTextWriter writer     = new XmlTextWriter(textWriter);

            XmlSerializer serializer = new XmlSerializer(typeof(MailAccountCheckResponse));

            serializer.Serialize(writer, checkResponse);

            writer.Flush();
            textWriter.Flush();

            writer.Close();
            textWriter.Close();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Restituzione di tutti i log del controllo casella istituzionale
        /// effettuati in un registro e ordinati per data e ora decrescente
        /// </summary>
        /// <param name="registro"></param>
        /// <param name="logDateTime"></param>
        /// <returns></returns>
        public LogElementCheckMail[] GetLogElements(Registro registro, DateTime logDateTime)
        {
            ArrayList elements = new ArrayList();

            string logFolder = this.GetLogFolder(registro.codRegistro, registro.email, logDateTime);

            DirectoryInfo dirInfo = new DirectoryInfo(logFolder);

            FileInfo[] logFiles = dirInfo.GetFiles("*.xml");

            foreach (FileInfo logFile in logFiles)
            {
                MailAccountCheckResponse checkResponse = this.DeserializeContent(logFile.FullName);
                elements.Add(new LogElementCheckMail(registro, checkResponse, logFile.LastWriteTime));
            }

            elements.Sort(new LogElementCheckMailComparer());

            return((LogElementCheckMail[])elements.ToArray(typeof(LogElementCheckMail)));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Scrittura log
 /// </summary>
 /// <param name="registro"></param>
 /// <param name="checkResponse"></param>
 public void LogElement(Registro registro, MailAccountCheckResponse checkResponse)
 {
     this.LogElement(new LogElementCheckMail(registro, checkResponse));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Conversione in dataset dell'oggetto MailCheckResponse
        /// </summary>
        /// <param name="checkResponse"></param>
        /// <returns></returns>
        private DataSet ToDataSet(MailAccountCheckResponse checkResponse)
        {
            DataSet dataSet = new DataSet("checkResponseDataSet");

            DataTable mailProcessedTable = new DataTable("MailProcessedList");

            mailProcessedTable.Columns.Add("MailID", typeof(string));
            mailProcessedTable.Columns.Add("Type", typeof(string));
            mailProcessedTable.Columns.Add("From", typeof(string));
            mailProcessedTable.Columns.Add("Subject", typeof(string));
            mailProcessedTable.Columns.Add("Date", typeof(string));
            mailProcessedTable.Columns.Add("CountAttatchments", typeof(string));
            mailProcessedTable.Columns.Add("CheckResult", typeof(string));
            mailProcessedTable.Columns.Add("system_id", typeof(int));
            mailProcessedTable.Columns.Add("PecXRicevuta", typeof(string));

            dataSet.Tables.Add(mailProcessedTable);
            int    sysId = 0;
            string nd    = "N.D.";

            TipiMailRicevutaPEC = new Dictionary <string, int>();
            ProcessedTypeDict   = new Dictionary <string, int>();

            foreach (MailProcessed mailProcessed in checkResponse.MailProcessedList)
            {
                string PecXRicevuta = pecMessageResolver(mailProcessed);//mailProcessed.PecXRicevuta.ToString().Replace ("_"," ");

                if (TipiMailRicevutaPEC.ContainsKey(PecXRicevuta))
                {
                    TipiMailRicevutaPEC[PecXRicevuta]++;
                }
                else
                {
                    TipiMailRicevutaPEC.Add(PecXRicevuta, 1);
                }


                if (ProcessedTypeDict.ContainsKey(mailProcessed.ProcessedType.ToString()))
                {
                    ProcessedTypeDict[mailProcessed.ProcessedType.ToString()]++;
                }
                else
                {
                    ProcessedTypeDict.Add(mailProcessed.ProcessedType.ToString(), 1);
                }



                DataRow newRow = mailProcessedTable.NewRow();
                newRow["system_id"] = sysId++;
                if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                {
                    //newRow["Type"] = nd;
                    //Andrea De Marco - Mev Gestione Eccezioni - decommentare sopra per ripristino
                    //if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante."))
                    if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante nella segnatura informatica"))
                    {
                        newRow["Type"] = nd;
                    }
                    else
                    {
                        newRow["Type"] = pecMessageResolver(mailProcessed);
                    }
                    //End De Marco
                }
                else
                {
                    newRow["Type"] = pecMessageResolver(mailProcessed);
                }
                newRow["MailID"]  = mailProcessed.MailID;
                newRow["From"]    = mailProcessed.From;
                newRow["Subject"] = mailProcessed.Subject;
                newRow["Date"]    = mailProcessed.Date.ToString();
                if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                {
                    //newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                    //Andrea De Marco - Mev Gestione Eccezioni - decommentare sopra per ripristino
                    //if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante."))
                    if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante nella segnatura informatica"))
                    {
                        newRow["CountAttatchments"] = nd;
                    }
                    else
                    {
                        newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                    }
                    //End De Marco
                }
                else
                {
                    newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                }
                if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                {
                    newRow["PecXRicevuta"] = nd;
                }
                else
                {
                    newRow["PecXRicevuta"] = PecXRicevuta;
                }

                string errorMessage = "OK";
                if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                {
                    errorMessage = mailProcessed.ErrorMessage;
                }
                newRow["CheckResult"] = errorMessage;

                mailProcessedTable.Rows.Add(newRow);
            }
            String listaTipi = "Dettaglio Email\r\n";


            foreach (string s in ProcessedTypeDict.Keys)
            {
                listaTipi += String.Format("{0} ({1}) \r\n", s, ProcessedTypeDict[s].ToString());
            }

            listaTipi += "\r\n";


            foreach (string s in TipiMailRicevutaPEC.Keys)
            {
                //if (s != "Altre")
                listaTipi += String.Format("{0} ({1}) \r\n", s, TipiMailRicevutaPEC[s].ToString());
            }

            //txtMailMessageCount.ToolTip = listaTipi;
            popolaDatiTblMailList();
            reportDataSet          = dataSet.Copy();
            reportDataSetDocGrigio = dataSet.Copy();
            //salvo in sessione il dataset per grdCheckResponse
            if (!IsPostBack)
            {
                System.Web.HttpContext.Current.Session["grdCheckResponse.save"] = dataSet;
            }

            //verifico se abbiamo ricevuto una mail contenente  un errore
            foreach (MailProcessed mailProcessed in checkResponse.MailProcessedList)
            {
                if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")) ||
                    (pecMessageResolver(mailProcessed) == "Con Errori" || pecMessageResolver(mailProcessed) == "Eccezione")
                    )
                //if (!string.IsNullOrEmpty(mailProcessed.ErrorMessage))
                {
                    //Andrea De Marco - Gestione Eccezioni PEC
                    //if (mailProcessed.ErrorMessage.Equals("OK. Eccezione non bloccante."))
                    if (mailProcessed.ErrorMessage.Equals("OK. Eccezione non bloccante nella segnatura informatica"))
                    {
                        this.btnDocGrigio.Visible = true;
                        break;
                    }
                    else
                    {
                        //creo il grigio automaticamente
                        creaGrigioDaReport(true);
                        break;
                    }
                    //End Andrea De Marco
                    //Decommentare per ripristinare modifica De Marco
                    ////creo il grigio automaticamente
                    //creaGrigioDaReport(true);
                    //break;
                }
            }

            return(dataSet);
        }
Ejemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="checkResponse"></param>
 private void FetchGridMailMessages(MailAccountCheckResponse checkResponse)
 {
     this.grdCheckResponse.DataSource = this.ToDataSet(checkResponse);
     this.grdCheckResponse.DataBind();
 }
Ejemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="checkResponse"></param>
        /// <returns></returns>
        private DataSet UpdateToDataSet(MailAccountCheckResponse checkResponse)
        {
            string tipoNotifica = string.Empty;

            if (!string.IsNullOrEmpty(tipo.Value))
            {
                tipoNotifica = tipo.Value;
            }
            DataSet   dataSet            = new DataSet("checkResponseDataSet");
            DataTable mailProcessedTable = new DataTable("MailProcessedList");

            mailProcessedTable.Columns.Add("MailID", typeof(string));
            mailProcessedTable.Columns.Add("Type", typeof(string));
            mailProcessedTable.Columns.Add("From", typeof(string));
            mailProcessedTable.Columns.Add("Subject", typeof(string));
            mailProcessedTable.Columns.Add("Date", typeof(string));
            mailProcessedTable.Columns.Add("CountAttatchments", typeof(string));
            mailProcessedTable.Columns.Add("CheckResult", typeof(string));
            mailProcessedTable.Columns.Add("system_id", typeof(int));
            mailProcessedTable.Columns.Add("PecXRicevuta", typeof(string));

            dataSet.Tables.Add(mailProcessedTable);
            int    sysId = 0;
            string nd    = "N.D.";

            foreach (MailProcessed mailProcessed in checkResponse.MailProcessedList)
            {
                if (pecMessageResolver(mailProcessed).Equals(tipoNotifica) || string.IsNullOrEmpty(tipoNotifica) || tipoNotifica.Equals("all"))
                {
                    string PecXRicevuta = pecMessageResolver(mailProcessed);//mailProcessed.PecXRicevuta.ToString().Replace ("_"," ");

                    DataRow newRow = mailProcessedTable.NewRow();
                    newRow["system_id"] = sysId++;
                    if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                    {
                        //newRow["Type"] = nd;
                        //Andrea De Marco - Mev Gestione Eccezioni - decommentare sopra per ripristino
                        //if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante."))
                        if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante nella segnatura informatica"))
                        {
                            newRow["Type"] = nd;
                        }
                        else
                        {
                            newRow["Type"] = pecMessageResolver(mailProcessed);
                        }
                        //End De Marco
                    }
                    else
                    {
                        newRow["Type"] = pecMessageResolver(mailProcessed);
                    }
                    newRow["MailID"]  = mailProcessed.MailID;
                    newRow["From"]    = mailProcessed.From;
                    newRow["Subject"] = mailProcessed.Subject;
                    newRow["Date"]    = mailProcessed.Date.ToString();
                    if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                    {
                        //newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                        //Andrea De Marco - Mev Gestione Eccezioni - decommentare sopra per ripristino
                        //if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante."))
                        if (!mailProcessed.ErrorMessage.Contains("OK. Eccezione non bloccante nella segnatura informatica"))
                        {
                            newRow["CountAttatchments"] = nd;
                        }
                        else
                        {
                            newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                        }
                        //End De Marco
                    }
                    else
                    {
                        newRow["CountAttatchments"] = mailProcessed.CountAttatchments;
                    }
                    if ((!string.IsNullOrEmpty(mailProcessed.ErrorMessage)) && (!mailProcessed.ErrorMessage.Contains("INTEROPERABILITA")))
                    {
                        newRow["PecXRicevuta"] = nd;
                    }
                    else
                    {
                        newRow["PecXRicevuta"] = PecXRicevuta;
                    }

                    string errorMessage = "OK";
                    if (mailProcessed.ErrorMessage != string.Empty)
                    {
                        errorMessage = mailProcessed.ErrorMessage;
                    }
                    newRow["CheckResult"] = errorMessage;

                    mailProcessedTable.Rows.Add(newRow);
                }
            }
            String listaTipi = "Dettaglio Email\r\n";

            foreach (string s in TipiMailRicevutaPEC.Keys)
            {
                listaTipi += String.Format("{0} ({1}) \r\n", s, TipiMailRicevutaPEC[s].ToString());
            }
            listaTipi += "\r\n";
            foreach (string s in TipiMailRicevutaPEC.Keys)
            {
                //if (s != "Altre")
                listaTipi += String.Format("{0} ({1}) \r\n", s, TipiMailRicevutaPEC[s].ToString());
            }
            //txtMailMessageCount.ToolTip = listaTipi;
            popolaDatiTblMailList();
            reportDataSet          = dataSet.Copy();
            reportDataSetDocGrigio = (System.Web.HttpContext.Current.Session["grdCheckResponse.save"] as DataSet).Copy();
            return(dataSet);
        }