Exemplo n.º 1
0
        private void ReadRetValueFromPopup()
        {
            if (this.Request.Form["__EVENTARGUMENT"] != null && this.Request.Form["__EVENTARGUMENT"].Equals(SELECT_NEXT_MESSAGE_CLOSE_POPUP))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "reallowOp();", true);
                if (!string.IsNullOrEmpty(this.SelectNextMessage.ReturnValue))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setReturnValue", "SetRetValue('SelectNextMessage','');", true);
                    this.Spedisci(this.InfoSpedizioneSelectMessage);

                    if (Session["MessError"] != null)
                    {
                        messError = Session["MessError"].ToString();

                        string msgDesc  = "WarningDocumentCustom";
                        string errFormt = Server.UrlEncode(messError);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');} else {parent.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');}; ", true);

                        Session.Remove("MessError");
                        messError = string.Empty;
                    }

                    if (listaDestinatariInterni.Items > 0)
                    {
                        UpdateDestinatariInterni.Update();
                    }
                    if (listaDestinatariInteroperanti.Items > 0)
                    {
                        UpdateDestinatariInteroperanti.Update();
                    }
                    if (listaDestinatatiInteropSempl.Items > 0)
                    {
                        UpdateDestinatatiInteropSempl.Update();
                    }
                    if (listaDestinatariNonInteroperanti.Items > 0)
                    {
                        UpdateDestinatariNonInteroperanti.Update();
                    }

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
                    NttDataWA.DocsPaWR.SchedaDocumento documentTab = DocumentManager.getSelectedRecord();
                    //aggiorno l'elenco allegati in sessione(per ricevute PITRE)
                    if (documentTab != null && !string.IsNullOrEmpty(documentTab.docNumber))
                    {
                        DocumentManager.setSelectedRecord(DocumentManager.getDocumentDetails(this.Page, documentTab.docNumber, documentTab.docNumber));
                    }

                    if (!string.IsNullOrEmpty(this.DestinatariNonRaggiunti))
                    {
                        string msgDesc  = "WarningSendingRecipients";
                        string errFormt = this.DestinatariNonRaggiunti;
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');} else {parent.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');}; ", true);
                        HttpContext.Current.Session.Remove("DestinatariNonRaggiunti");
                    }

                    return;
                }
            }
        }
Exemplo n.º 2
0
        protected void SenderBtnSend_Click(object sender, EventArgs e)
        {
            try {
                HttpContext.Current.Session.Remove("DestinatariNonRaggiunti");
                if (cboTipoRicevutaPec.Visible == true)
                {
                    SenderManager.getSetRicevutaPec(cboRegistriRF.SelectedValue, null, cboTipoRicevutaPec.SelectedValue, false, ddl_caselle.SelectedValue);
                }
                try
                {
                    DocsPaWR.ConfigSpedizioneDocumento config         = SenderManager.GetConfigSpedizioneDocumento();
                    DocsPaWR.SpedizioneDocumento       infoSpedizione = this.GetSpedizioneDocumento();

                    // Aggiornamento dati destinatari selezionati per la spedizione
                    this.listaDestinatariInterni.SaveData(infoSpedizione);
                    this.listaDestinatariInteroperanti.SaveData(infoSpedizione);
                    this.listaDestinatatiInteropSempl.SaveData(infoSpedizione);

                    bool almostOne = (this.listaDestinatariInterni.Items > 0 && this.listaDestinatariInterni.AlmostOneChecked);

                    if (!almostOne)
                    {
                        almostOne = (this.listaDestinatariInteroperanti.Items > 0 && this.listaDestinatariInteroperanti.AlmostOneChecked) || (this.listaDestinatatiInteropSempl.Items > 0 && this.listaDestinatatiInteropSempl.AlmostOneChecked);
                    }


                    if (!almostOne)
                    {
                        this.ShowErrorMessage("WarningSenderRecipients");
                    }

                    /*else if (!this.IsDocumentoAcquisito && config.AvvisaSuSpedizioneDocumento)
                     * {
                     *  this.msgSpedisci.Confirm("E' stata richiesta la spedizione senza aver associato alcun documento elettronico.\\nSi vuole eseguire le operazioni di trasmissione e spedizione automatiche?");
                     * }*///Gestito con nuovo messaggio
                    else
                    {
                        bool destInteropRGSSelected = (from d in infoSpedizione.DestinatariEsterni where d.InteroperanteRGS && d.IncludiInSpedizione select d).FirstOrDefault() != null;

                        DocsPaWR.SchedaDocumento schedaDoc = DocumentManager.getSelectedRecord();
                        if (destInteropRGSSelected && schedaDoc.template != null && !string.IsNullOrEmpty(schedaDoc.template.ID_CONTESTO_PROCEDURALE))
                        {
                            List <DocsPaWR.Messaggio> messaggiSuccessivi = SenderManager.GetMessaggiSuccessiviFlussoProcedurale(schedaDoc);

                            //se sono presenti più di uno messaggio lascio scegliere all'utente.
                            if (messaggiSuccessivi != null && messaggiSuccessivi.Count > 1)
                            {
                                this.NextMessages = messaggiSuccessivi;
                                this.InfoSpedizioneSelectMessage = infoSpedizione;
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "SelectNextMessage", "ajaxModalPopupSelectNextMessage();", true);
                                return;
                            }
                            if (messaggiSuccessivi != null && messaggiSuccessivi.Count == 1)
                            {
                                infoSpedizione.tipoMessaggio = messaggiSuccessivi[0];
                            }
                        }
                        else
                        {
                            infoSpedizione.tipoMessaggio = null;
                        }
                        this.Spedisci(infoSpedizione);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                if (Session["MessError"] != null)
                {
                    messError = Session["MessError"].ToString();

                    string msgDesc  = "WarningDocumentCustom";
                    string errFormt = Server.UrlEncode(messError);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');} else {parent.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');}; ", true);

                    Session.Remove("MessError");
                    messError = string.Empty;
                }

                if (listaDestinatariInterni.Items > 0)
                {
                    UpdateDestinatariInterni.Update();
                }
                if (listaDestinatariInteroperanti.Items > 0)
                {
                    UpdateDestinatariInteroperanti.Update();
                }
                if (listaDestinatatiInteropSempl.Items > 0)
                {
                    UpdateDestinatatiInteropSempl.Update();
                }
                if (listaDestinatariNonInteroperanti.Items > 0)
                {
                    UpdateDestinatariNonInteroperanti.Update();
                }

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
                NttDataWA.DocsPaWR.SchedaDocumento documentTab = DocumentManager.getSelectedRecord();
                //aggiorno l'elenco allegati in sessione(per ricevute PITRE)
                if (documentTab != null && !string.IsNullOrEmpty(documentTab.docNumber))
                {
                    DocumentManager.setSelectedRecord(DocumentManager.getDocumentDetails(this.Page, documentTab.docNumber, documentTab.docNumber));
                }

                if (!string.IsNullOrEmpty(this.DestinatariNonRaggiunti))
                {
                    string msgDesc  = "WarningSendingRecipients";
                    string errFormt = this.DestinatariNonRaggiunti;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');} else {parent.ajaxDialogModal('" + utils.FormatJs(msgDesc) + "', 'warning', '', '" + utils.FormatJs(errFormt) + "');}; ", true);
                    HttpContext.Current.Session.Remove("DestinatariNonRaggiunti");
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return;
            }
        }