Beispiel #1
0
        protected DocsPaWR.EsitoImportPregressi SendRequest(byte[] fileToImport)
        {
            wws.Timeout = System.Threading.Timeout.Infinite;
            DocsPaWR.EsitoImportPregressi retValue = wws.importPregresso(InfoUtente, fileToImport, true);

            return(retValue);
        }
Beispiel #2
0
        protected DocsPaWR.EsitoImportPregressi SendRequest(byte[] fileToImport)
        {
            wws.Timeout = System.Threading.Timeout.Infinite;
            DocsPaWR.EsitoImportPregressi retValue = wws.importPregresso(UserManager.getInfoUtente(this), fileToImport, false);

            return(retValue);
        }
Beispiel #3
0
        private bool importa(DocsPaWR.InfoUtente infoUtente, DocsPaWR.EsitoImportPregressi esitoImport, string descrizione)
        {
            wws.Timeout = System.Threading.Timeout.Infinite;
            //Aggiunta parametro descrizione
            wws.asyncImportPregresso(infoUtente, esitoImport, descrizione);

            return(true);
        }
 public static void AsyncImportPregresso(DocsPaWR.InfoUtente infoUtente, DocsPaWR.EsitoImportPregressi esitoImport, string descrizione)
 {
     ws.Timeout = System.Threading.Timeout.Infinite;
     ws.asyncImportPregresso(infoUtente, esitoImport, descrizione);
 }
Beispiel #5
0
        protected void btn_Importa_Click(object sender, EventArgs e)
        {
            bool controllo = true;

            if (uploadFile != null && !string.IsNullOrEmpty(uploadFile.Value))
            {
                //Nel CallContext inserisco nome del file(con estensione) a partire dal path del file di import
                importFileName = Path.GetFileName(uploadFile.Value);

                //Per togliere l'estensione:

                /*
                 * string ext = Path.GetExtension(importFileName);
                 * importFileName.Replace(ext, "");
                 */

                //Inizio importazione
                HttpPostedFile p    = uploadFile.PostedFile;
                Stream         fs   = p.InputStream;
                byte[]         dati = new byte[fs.Length];
                fs.Read(dati, 0, (int)fs.Length);
                fs.Close();

                DocsPaWR.EsitoImportPregressi result = SendRequest(dati);
                //Se mi torna null il foglio excel non è valido
                if (result == null)
                {
                    utils.AlertPostLoad.GenericMessage(this, "Impossibile contatare il server. Riprovare più tardi.");
                    //utils.AlertPostLoad.GenericMessage(this, "Inserire un foglio excel valido");
                    //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "alert('Inserire un foglio excel valido');", true);
                }
                else
                {
                    if (result.itemPregressi != null && result.itemPregressi.Length > 0)
                    {
                        List <DocsPaWR.ItemReportPregressi> itemInErrorOrWarning = result.itemPregressi.Where(x => x.esito != "S").ToList();

                        FetchData(itemInErrorOrWarning);


                        if (result.esito)
                        {
                            this.btnContinua.Enabled = true;
                            EsitoImport = result;

                            this.lbl_alert.Text      = "Nessun problema da segnalare durante la prima analisi del file excel";
                            this.btnImporta.Enabled  = false;
                            this.uploadFile.Disabled = true;
                            this.btnContinua.Enabled = true;

                            //Bottone esporta disabilitato
                            this.btnEsporta.Enabled = false;
                        }
                        else
                        {
                            this.btnContinua.Enabled = false;
                            EsitoImport = new DocsPaWR.EsitoImportPregressi();

                            this.btnImporta.Enabled  = false;
                            this.uploadFile.Disabled = true;
                            if (itemInErrorOrWarning.Count > 0)
                            {
                                //Andrea - lista itemInErrorOrWarning messa nel CallContext per poterla passare come parametro dell'export excel
                                ReportInError = itemInErrorOrWarning;

                                if (itemInErrorOrWarning.Count == 1)
                                {
                                    this.lbl_alert.Text = "Attenzione, c\' è " + itemInErrorOrWarning.Count + " avviso durante la prima analisi del file excel";
                                }
                                else
                                {
                                    this.lbl_alert.Text = "Attenzione, ci sono " + itemInErrorOrWarning.Count + " avvisi durante la prima analisi del file excel";
                                }

                                //Andrea - Abilito il pulsante esporta solo se ho elementi in errore
                                this.btnEsporta.Enabled = true;
                            }
                            else
                            {
                                this.lbl_alert.Text     = "File excel non compatibile o corrotto.";
                                this.btnEsporta.Enabled = false;
                            }
                        }
                    }
                    else
                    {
                        this.btnContinua.Enabled = false;
                        EsitoImport              = new DocsPaWR.EsitoImportPregressi();
                        this.btnImporta.Enabled  = false;
                        this.uploadFile.Disabled = true;
                        this.lbl_alert.Text      = "Nessuna riga presente nel foglio excel.";
                        //this.lbl_alert.Text = "Impossibile contatare il server. Riprovare più tardi.";
                    }

                    this.pnlReport.Visible = true;
                    this.btnNuovo.Enabled  = true;
                    this.pnlAvviso.Visible = true;
                    this.pnlReport.Visible = true;
                    this.box_upload.Update();
                    this.upPnlReport.Update();
                }
            }
            else
            {
                utils.AlertPostLoad.GenericMessage(this, "Nessun file excel valido selezionato.");
            }
        }
Beispiel #6
0
 private bool importa(DocsPaWR.InfoUtente infoUtente, DocsPaWR.EsitoImportPregressi esitoImport, string descrizione)
 {
     ImportPreviousManager.AsyncImportPregresso(infoUtente, esitoImport, descrizione);
     return(true);
 }
Beispiel #7
0
        protected void BtnUploadHidden_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            if (this.fileUpload != null && !string.IsNullOrEmpty(this.fileUpload.Value) && this.fileUpload.PostedFile.FileName.ToLower().EndsWith("xls"))
            {
                // Nel CallContext inserisco nome del file(con estensione) a partire dal path del file di import
                this.importFileName = Path.GetFileName(this.fileUpload.Value);

                // Prelevamento del contenuto del file
                HttpPostedFile p       = this.fileUpload.PostedFile;
                Stream         fs      = p.InputStream;
                byte[]         content = new byte[fs.Length];
                fs.Read(content, 0, (int)fs.Length);
                fs.Close();

                DocsPaWR.EsitoImportPregressi result = this.SendRequest(content);
                //Se mi torna null il foglio excel non è valido
                if (result == null)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('WarningImportPreviousNoServer', 'warning', '');", true);
                }
                else
                {
                    if (result.itemPregressi != null && result.itemPregressi.Length > 0)
                    {
                        List <DocsPaWR.ItemReportPregressi> itemInErrorOrWarning = result.itemPregressi.Where(x => x.esito != "S").ToList();

                        this.FetchData(itemInErrorOrWarning);

                        if (result.esito)
                        {
                            this.BtnContinue.Enabled = true;
                            this.EsitoImport         = result;

                            this.lbl_alert.Text      = this.GetLabel("ImportPreviousNoProblem");
                            this.BtnImport.Enabled   = false;
                            this.fileUpload.Disabled = true;
                            this.BtnContinue.Enabled = true;

                            //Bottone esporta disabilitato
                            //this.BtnExport.Visible = true;
                            this.BtnExport.Enabled = false;
                        }
                        else
                        {
                            this.BtnContinue.Enabled = false;
                            this.EsitoImport         = new DocsPaWR.EsitoImportPregressi();

                            this.BtnImport.Enabled   = false;
                            this.fileUpload.Disabled = true;
                            if (itemInErrorOrWarning.Count > 0)
                            {
                                //Andrea - lista itemInErrorOrWarning messa nel CallContext per poterla passare come parametro dell'export excel
                                this.ReportInError = itemInErrorOrWarning;

                                if (itemInErrorOrWarning.Count == 1)
                                {
                                    this.lbl_alert.Text = this.GetLabel("ImportPreviousOneProblem");
                                }
                                else
                                {
                                    this.lbl_alert.Text = this.GetLabel("ImportPreviousMoreProblems").Replace("@@", itemInErrorOrWarning.Count.ToString());
                                }

                                //this.BtnExport.Visible = true;
                                this.BtnExport.Enabled = true;
                            }
                            else
                            {
                                this.lbl_alert.Text    = this.GetLabel("ImportPreviousXlsCorrupted");
                                this.BtnExport.Enabled = false;
                            }
                        }
                    }
                    else
                    {
                        this.BtnContinue.Enabled = false;
                        this.EsitoImport         = new DocsPaWR.EsitoImportPregressi();
                        this.BtnImport.Enabled   = false;
                        this.fileUpload.Disabled = true;
                        this.lbl_alert.Text      = this.GetLabel("ImportPreviousXlsEmpty");
                    }
                    this.pnlReport.Visible = true;
                    this.BtnNew.Enabled    = true;
                    this.pnlAvviso.Visible = true;
                    this.pnlReport.Visible = true;
                    this.box_upload.Update();
                    this.upPnlReport.Update();
                    this.UpPnlButtons.Update();
                }
            }
        }