コード例 #1
0
        public SCAPI.ModelObject CreateAttributePassOne(AttributeT entity, string db)
        {
            SCAPI.ModelObject ret = null;
            if (string.IsNullOrWhiteSpace(db))
            {
                Logger.PrintLC("There was no DB associated to " + entity.NomeTabellaLegacy, 3);
                return(ret);
            }

            if (erRootObjCol != null)
            {
                OpenTransaction();

                erObjectCollection = scSession.ModelObjects.Collect(scSession.ModelObjects.Root, "Entity");

                VBCon con = new VBCon();
                erEntityObjectPE = null;

                if (string.IsNullOrWhiteSpace(entity.NomeTabellaLegacy))
                {
                    Logger.PrintLC("'Nome Tabella Legacy' at row " + entity.Row + " not found. Skipping the Attribute.", 3);
                    CommitAndSave(trID);
                    return(ret = null);
                }

                if (con.RetriveEntity(ref erEntityObjectPE, erObjectCollection, entity.NomeTabellaLegacy))
                {
                    Logger.PrintLC("Table entity " + entity.NomeTabellaLegacy + " retrived correctly", 3);
                }
                else
                {
                    Logger.PrintLC("Table entity " + entity.NomeTabellaLegacy + " not found. Skipping the Attribute.", 3);
                    CommitAndSave(trID);
                    return(ret = null);
                }

                //Area
                if (!string.IsNullOrWhiteSpace(entity.Area))
                {
                    if (con.AssignToObjModel(ref erEntityObjectPE, ConfigFile._ATT_NAME["Area"], entity.Area))
                    {
                        Logger.PrintLC("Added Area to " + erEntityObjectPE.Name, 3);
                    }
                    else
                    {
                        Logger.PrintLC("Error adding Area to " + erEntityObjectPE.Name, 3);
                    }
                }
                //Tipologia Tabella
                if (!string.IsNullOrWhiteSpace(entity.TipologiaTabella))
                {
                    if (con.AssignToObjModel(ref erEntityObjectPE, ConfigFile._ATT_NAME["Tipologia Tabella"], entity.TipologiaTabella))
                    {
                        Logger.PrintLC("Added Tipologia Tabella to " + erEntityObjectPE.Name, 3);
                    }
                    else
                    {
                        Logger.PrintLC("Error adding Tipologia Tabella to " + erEntityObjectPE.Name, 3);
                    }
                }
                //Storica
                if (!string.IsNullOrWhiteSpace(entity.Storica))
                {
                    if (con.AssignToObjModel(ref erEntityObjectPE, ConfigFile._ATT_NAME["Storica"], entity.Storica))
                    {
                        Logger.PrintLC("Added Storica to " + erEntityObjectPE.Name, 3);
                    }
                    else
                    {
                        Logger.PrintLC("Error adding Storica to " + erEntityObjectPE.Name, 3);
                    }
                }

                erAttributeObjCol = scSession.ModelObjects.Collect(erEntityObjectPE, "Attribute");

                if (!string.IsNullOrWhiteSpace(entity.NomeCampoLegacy))
                {
                    if (con.RetriveAttribute(ref erAttributeObjectPE, erAttributeObjCol, entity.NomeCampoLegacy))
                    {
                        Logger.PrintLC("Attribute entity " + entity.NomeCampoLegacy + " already present.", 3);
                    }
                    else
                    {
                        erAttributeObjectPE = erAttributeObjCol.Add("Attribute");
                        //Name
                        if (!string.IsNullOrWhiteSpace(entity.NomeCampoLegacy))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Nome Campo Legacy Name"], entity.NomeCampoLegacy))
                            {
                                Logger.PrintLC("Added Nome Campo Legacy to " + erAttributeObjectPE.Name + "'s name.", 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Nome Campo Legacy to " + erAttributeObjectPE.Name, 4);
                            }
                            //Physical Name
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Nome Campo Legacy"], entity.NomeCampoLegacy))
                            {
                                Logger.PrintLC("Added Nome Campo Legacy to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Nome Campo Legacy to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Datatype
                        if (!string.IsNullOrWhiteSpace(entity.DataType))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Datatype"], entity.DataType))
                            {
                                Logger.PrintLC("Added Datatype to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Datatype to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Chiave
                        if (entity.Chiave == 0 || entity.Chiave == 100)
                        {
                            if (con.AssignToObjModelInt(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Chiave"], (int)entity.Chiave))
                            {
                                Logger.PrintLC("Added Chiave to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Chiave to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Mandatory Flag
                        if (entity.MandatoryFlag == 1 || entity.MandatoryFlag == 0)
                        {
                            if (con.AssignToObjModelInt(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Mandatory Flag"], (int)entity.MandatoryFlag))
                            {
                                Logger.PrintLC("Added Mandatory Flag to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Mandatory Flag to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                    }
                }
                CommitAndSave(trID);
            }
            return(erEntityObjectPE);
        }
コード例 #2
0
        public SCAPI.ModelObject CreateAttributePassTwo(AttributeT entity, string db)
        {
            SCAPI.ModelObject ret = null;
            if (string.IsNullOrWhiteSpace(db))
            {
                Logger.PrintLC("There was no DB associated to " + entity.NomeTabellaLegacy, 3);
                return(ret);
            }
            if (erRootObjCol != null)
            {
                OpenTransaction();
                erObjectCollection = scSession.ModelObjects.Collect(scSession.ModelObjects.Root, "Entity");
                VBCon con = new VBCon();
                erEntityObjectPE = null;
                if (string.IsNullOrWhiteSpace(entity.NomeTabellaLegacy))
                {
                    Logger.PrintLC("'Nome Tabella Legacy' at row " + entity.Row + " not found. Skipping the Attribute.", 3);
                    CommitAndSave(trID);
                    return(ret = null);
                }
                if (con.RetriveEntity(ref erEntityObjectPE, erObjectCollection, entity.NomeTabellaLegacy))
                {
                    Logger.PrintLC("Table entity " + entity.NomeTabellaLegacy + " retrived correctly", 3);
                }
                else
                {
                    Logger.PrintLC("Table entity " + entity.NomeTabellaLegacy + " not found. Skipping the Attribute.", 3);
                    CommitAndSave(trID);
                    return(ret = null);
                }
                erAttributeObjCol = scSession.ModelObjects.Collect(erEntityObjectPE, "Attribute");

                if (!string.IsNullOrWhiteSpace(entity.NomeCampoLegacy))
                {
                    if (con.RetriveAttribute(ref erAttributeObjectPE, erAttributeObjCol, entity.NomeCampoLegacy))
                    {
                        //Definizione Campo
                        if (!string.IsNullOrWhiteSpace(entity.DefinizioneCampo))
                        {
                            Logger.PrintLC("Attribute entity " + entity.NomeCampoLegacy + " already present.", 3);
                            //Definizione Campo (Comment)
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Definizione Campo"], entity.DefinizioneCampo))
                            {
                                Logger.PrintLC("Added Definizione Campo (Comment) to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Definizione Campo (Comment) to " + erAttributeObjectPE.Name, 4);
                            }
                            //Definizione Campo (Definition)
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Definizione Campo Def"], entity.DefinizioneCampo))
                            {
                                Logger.PrintLC("Added Definizione Campo (Definition) to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Definizione Campo (Definition) to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Unique
                        if (!string.IsNullOrWhiteSpace(entity.Unique))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Unique"], entity.Unique))
                            {
                                Logger.PrintLC("Added Unique to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Unique to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Chiave logica
                        if (!string.IsNullOrWhiteSpace(entity.ChiaveLogica))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Chiave Logica"], entity.ChiaveLogica))
                            {
                                Logger.PrintLC("Added Chiave Logica to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Chiave Logica to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Dominio
                        if (!string.IsNullOrWhiteSpace(entity.Dominio))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Dominio"], entity.Dominio))
                            {
                                Logger.PrintLC("Added Dominio to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Dominio to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Provenienza Dominio
                        if (!string.IsNullOrWhiteSpace(entity.ProvenienzaDominio))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Provenienza Dominio"], entity.ProvenienzaDominio))
                            {
                                Logger.PrintLC("Added Provenienza Dominio to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Provenienza Dominio to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                        //Note
                        if (!string.IsNullOrWhiteSpace(entity.Note))
                        {
                            if (con.AssignToObjModel(ref erAttributeObjectPE, ConfigFile._ATT_NAME["Note"], entity.Note))
                            {
                                Logger.PrintLC("Added Note to " + erAttributeObjectPE.Name, 4);
                            }
                            else
                            {
                                Logger.PrintLC("Error adding Note to " + erAttributeObjectPE.Name, 4);
                            }
                        }
                    }
                    else
                    {
                        //ExcelOps.XLSXWriteErrorInCell()
                        Logger.PrintLC("Unexpected Error: searching for " + entity.NomeCampoLegacy + " finding none.", 4);
                    }
                }
                CommitAndSave(trID);
            }
            return(erEntityObjectPE);
        }
コード例 #3
0
        /// <summary>
        /// Reads and processes Attributes data from excel's 'ATTRIBUTI' sheet
        /// </summary>
        /// <param name="fileDaAprire"></param>
        /// <param name="sheet"></param>
        /// <returns></returns>
        public static List <AttributeT> ReadXFileAttribute(FileInfo fileDaAprire, string db, string sheet = ConfigFile.ATTRIBUTI)
        {
            string            file      = fileDaAprire.FullName;
            List <AttributeT> listaFile = new List <AttributeT>();

            if (!File.Exists(file))
            {
                Logger.PrintLC("Reading Attributes. File " + fileDaAprire.Name + " doesn't exist.", 2);
                return(listaFile = null);
            }
            FileOps.RemoveAttributes(file);

            if (fileDaAprire.Extension == ".xls")
            {
                if (!ConvertXLStoXLSX(file))
                {
                    return(listaFile = null);
                }
                file         = Path.ChangeExtension(file, ".xlsx");
                fileDaAprire = new FileInfo(file);
            }

            ExcelPackage    p  = null;
            ExcelWorkbook   WB = null;
            ExcelWorksheets ws = null;

            try
            {
                p  = new ExcelPackage(fileDaAprire);
                WB = p.Workbook;
                ws = WB.Worksheets; //.Add(wsName + wsNumber.ToString());
            }
            catch (Exception exp)
            {
                Logger.PrintLC("Reading Attributes. Could not open file " + fileDaAprire.Name + "in location " + fileDaAprire.DirectoryName, 2);
                return(listaFile = null);
            }

            bool FilesEnd = false;
            int  EmptyRow = 0;

            foreach (var worksheet in ws)
            {
                if (worksheet.Name == sheet)
                {
                    FilesEnd = false;
                    for (int RowPos = ConfigFile.HEADER_RIGA + 1;
                         FilesEnd != true;
                         RowPos++)
                    {
                        bool   incorrect     = false;
                        string nomeTabella   = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Nome Tabella Legacy"]].Text;
                        string nomeCampo     = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Nome  Campo Legacy"]].Text;
                        string dataType      = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Datatype"]].Text;
                        string chiave        = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Chiave"]].Text;
                        string unique        = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Unique"]].Text;
                        string chiaveLogica  = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Chiave Logica"]].Text;
                        string mandatoryFlag = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Mandatory Flag"]].Text;
                        string dominio       = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Dominio"]].Text;
                        string storica       = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Storica"]].Text;
                        string datoSensibile = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Dato Sensibile"]].Text;

                        worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET2].Value = "";

                        string error = "";
                        //Check Nome Tabella Legacy
                        if (string.IsNullOrWhiteSpace(nomeTabella))
                        {
                            incorrect = true;
                            error    += "NOME TABELLA LEGACY mancante.";
                        }
                        //Check Nome Campo Legacy
                        if (string.IsNullOrWhiteSpace(nomeCampo))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "NOME CAMPO LEGACY mancante.";
                        }
                        //Check DataType
                        if (string.IsNullOrWhiteSpace(dataType))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "DATATYPE mancante.";
                        }
                        else
                        {
                            if (!Funct.ParseDataType(dataType, db))
                            {
                                incorrect = true;
                                if (!string.IsNullOrWhiteSpace(error))
                                {
                                    error += " ";
                                }
                                error += "DATATYPE non conforme.";
                            }
                        }
                        //Check Chiave
                        if (!(string.Equals(chiave, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(chiave, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "CHIAVE non conforme.";
                        }
                        //Check Unique
                        if (!(string.Equals(unique, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(unique, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "UNIQUE non conforme.";
                        }
                        //Check Chiave Logica
                        if (!(string.Equals(chiaveLogica, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(chiaveLogica, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "CHIAVE LOGICA non conforme.";
                        }
                        //Check Mandatory Flag
                        if (!(string.Equals(mandatoryFlag, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(mandatoryFlag, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "MANDATORY FLAG non conforme.";
                        }
                        //Check Dominio
                        if (!(string.Equals(dominio, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(dominio, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "DOMINIO non conforme.";
                        }
                        //Check Storica
                        if (!(string.Equals(storica, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(storica, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "STORICA non conforme.";
                        }
                        //Check Dato Sensibile
                        if (!(string.Equals(datoSensibile, "S", StringComparison.OrdinalIgnoreCase) || string.Equals(datoSensibile, "N", StringComparison.OrdinalIgnoreCase)))
                        {
                            incorrect = true;
                            if (!string.IsNullOrWhiteSpace(error))
                            {
                                error += " ";
                            }
                            error += "DATO SENSIBILE non conforme.";
                        }

                        if (incorrect == false)
                        {
                            EmptyRow = 0;
                            AttributeT ValRiga = new AttributeT(row: RowPos, db: db, nomeTabellaLegacy: nomeTabella);
                            // Assegnazione valori checkati
                            ValRiga.NomeTabellaLegacy = nomeTabella;
                            ValRiga.NomeCampoLegacy   = nomeCampo;
                            ValRiga.DataType          = dataType;
                            if (string.Equals(chiave.ToUpper(), "S"))
                            {
                                ValRiga.Chiave = 0;
                            }
                            else
                            {
                                ValRiga.Chiave = 100;
                            }
                            ValRiga.Unique       = unique;
                            ValRiga.ChiaveLogica = chiaveLogica;
                            if (string.Equals(mandatoryFlag.ToUpper(), "S"))
                            {
                                ValRiga.MandatoryFlag = 1;
                            }
                            else
                            {
                                ValRiga.MandatoryFlag = 0;
                            }
                            ValRiga.Dominio       = dominio;
                            ValRiga.Storica       = storica;
                            ValRiga.DatoSensibile = datoSensibile;
                            //Assegnazione valori opzionali
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["SSA"]].Text))
                            {
                                ValRiga.SSA = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["SSA"]].Text;
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Area"]].Text))
                            {
                                ValRiga.Area = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Area"]].Text;
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Definizione Campo"]].Text))
                            {
                                ValRiga.DefinizioneCampo = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Definizione Campo"]].Text;
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Tipologia Tabella \n(dal DOC. LEGACY) \nEs: Dominio,Storica,\nDati"]].Text))
                            {
                                ValRiga.TipologiaTabella = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Tipologia Tabella \n(dal DOC. LEGACY) \nEs: Dominio,Storica,\nDati"]].Text;
                            }
                            int t;  //Funzionale all'assegnazione di 'Lunghezza' e 'Decimali'
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Lunghezza"]].Text))
                            {
                                if (int.TryParse(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Lunghezza"]].Text, out t))
                                {
                                    ValRiga.Lunghezza = t;
                                }
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Decimali"]].Text))
                            {
                                if (int.TryParse(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Decimali"]].Text, out t))
                                {
                                    ValRiga.Decimali = t;
                                }
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Provenienza dominio "]].Text))
                            {
                                ValRiga.ProvenienzaDominio = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Provenienza dominio "]].Text;
                            }
                            if (!string.IsNullOrWhiteSpace(worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Note"]].Text))
                            {
                                ValRiga.Note = worksheet.Cells[RowPos, ConfigFile._ATTRIBUTI["Note"]].Text;
                            }
                            listaFile.Add(ValRiga);
                            worksheet.Column(ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1).Width = 10;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Fill.PatternType = ExcelFillStyle.Solid;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(34, 255, 0));
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Font.Bold = true;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Value           = "OK";
                        }
                        else
                        {
                            worksheet.Column(ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1).Width = 10;
                            worksheet.Column(ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET2).Width = 50;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Fill.PatternType = ExcelFillStyle.Solid;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(255, 0, 0));
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Style.Font.Bold = true;
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET1].Value           = "KO";
                            worksheet.Cells[RowPos, ConfigFile.HEADER_COLONNA_MAX_ATTRIBUTI + ConfigFile.ATTRIBUTI_EXCEL_COL_OFFSET2].Value           = error;
                            EmptyRow += 1;
                            if (EmptyRow >= 10)
                            {
                                FilesEnd = true;
                            }
                        }

                        //******************************************
                        // Verifica lo stato delle successive 10 righe per determinare la fine della tabella.
                        int prossime = 0;
                        for (int i = 1; i < 11; i++)
                        {
                            if (string.IsNullOrWhiteSpace(worksheet.Cells[RowPos + i, ConfigFile._ATTRIBUTI["Nome Tabella Legacy"]].Text))
                            {
                                prossime++;
                            }
                        }
                        if (prossime == 10)
                        {
                            FilesEnd = true;
                        }
                        //******************************************
                    }
                    p.SaveAs(new FileInfo(Path.Combine(ConfigFile.FOLDERDESTINATION, fileDaAprire.Name)));
                    return(listaFile);
                }
            }
            return(listaFile = null);
        }