/// <summary>
        ///  Parsing a Selections query
        /// </summary>
        /// <param name="querys">Selection</param>
        /// <param name="_freqWhere">return a string that representing a TimeWhere to pass a database parameter</param>
        /// <returns>string representing the selection formatted</returns>
        private string parseWhereSelection(IDataWhereStatmentSelection querys, out string _freqWhere)
        {
            try
            {
                _freqWhere = null;
                List <string>      SingleValues     = new List <string>();
                IConceptObjectImpl realConceptFound = Concepts.Find(c => (c.Id.Trim().ToUpper() == querys.ComponentId.Trim().ToUpper()) || CheckRenamedFrequency(c, querys.ComponentId));
                if (realConceptFound == null)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DimensionNotFound, new Exception(querys.ComponentId));
                }

                IConceptObjectImpl realConceptTime = Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Time);
                string             timedim         = string.Format(FormatWhereValue, ((IDimensionConcept)realConceptTime).GetColumTimeName());

                if (realConceptFound is IDimensionConcept && ((IDimensionConcept)realConceptFound).DimensionType == DimensionTypeEnum.Frequency)
                {
                    IDimensionConcept FreqConcept = (IDimensionConcept)realConceptFound;
                    if (!FreqConcept.IsFakeFrequency)
                    {
                        string dim = string.Format(FormatWhereValue, FreqConcept.RealNameFreq);
                        foreach (string val in querys.Values)
                        {
                            SingleValues.Add(string.Format("{0}='{1}'", dim, val));
                        }
                    }
                    else
                    {
                        _freqWhere = TimePeriodDBFormat.GetFreqValueWhereStatment(querys.Values, timedim);
                    }
                }
                else if (realConceptFound is IDimensionConcept)
                {
                    string dim = string.Format(FormatWhereValue, realConceptFound.ConceptObjectCode);
                    foreach (string val in querys.Values)
                    {
                        SingleValues.Add(string.Format("{0}='{1}'", dim, val));
                    }
                }
                else if (realConceptFound is IAttributeConcept)
                {//Gestione degli attributi
                    if (realConceptFound.Id == FlyConfiguration.Time_Format_Id)
                    {
                        _freqWhere = TimePeriodDBFormat.GetTimeFormatValueWhereStatment(querys.Values, timedim);
                    }
                }


                if (SingleValues.Count == 0)
                {
                    return(null);
                }
                return(string.Format("({0})", string.Join(" OR ", SingleValues)));
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, ex);
            }
        }
        /// <summary>
        /// Create a list of Concept object in Dataflow
        /// </summary>
        /// <param name="_dataflowCode">Dataflow Code</param>
        /// <returns>list of ConceptObjectImpl</returns>
        public List <IConceptObjectImpl> GetConceptList(string _dataflowCode)
        {
            try
            {
                List <IConceptObjectImpl> _concepts         = new List <IConceptObjectImpl>();
                IDimensionManager         _DimensionManager = new DimensionManager(this.parsingObject, this.versionTypeResp);

                List <SdmxObjectNameDescription> _names;
                List <IDimensionConcept>         _dimensions = _DimensionManager.GetDimensionConceptObjects(_dataflowCode, out _names);
                this.ConceptSchemeNames = _names;

                if (this.versionTypeResp == SdmxSchemaEnumType.VersionTwoPointOne)
                {//Modifico il nome del Concept Time
                    IDimensionConcept timedim = _dimensions.Find(x => x.DimensionType == DimensionTypeEnum.Time);
                    timedim.RealNameTime      = timedim.ConceptObjectCode;
                    timedim.ConceptObjectCode = "TIME_PERIOD";
                    timedim.Id = "TIME_PERIOD";
                }

                if (_dimensions != null && _dimensions.Count > 0)
                {
                    _concepts.AddRange(_dimensions);
                }

                IAttributeManager _AttributeManager = new AttributeManagerSP(this.parsingObject, this.versionTypeResp);
                if (!this.DbAccess.CheckExistStoreProcedure(DBOperationEnum.GetAttributes))
                {
                    _AttributeManager = new AttributeManager_FromFile(this.parsingObject, this.versionTypeResp);
                }

                IFLAGManager _FlagManager = new FLAGManager(this.parsingObject, this.versionTypeResp);

                IConceptObjectImpl _flag = _FlagManager.GetFlag();
                if (_flag != null)
                {
                    _concepts.Add(_flag);
                }

                List <IAttributeConcept> _attributes = _AttributeManager.GetAttribute(_dataflowCode);
                if (_attributes != null && _attributes.Count > 0)
                {
                    _concepts.AddRange(_attributes);
                }

                _concepts.Add(_AttributeManager.GetObsValue());

                return(_concepts);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetConceptsScheme, ex);
            }
        }
 /// <summary>
 /// Check if filed Frequency must be renamed (if is a fake fiels or real)
 /// </summary>
 /// <param name="c">Concept</param>
 /// <param name="colname">Real Colum name</param>
 /// <returns>true if must be rename false than else</returns>
 private bool CheckRenamedFrequency(IConceptObjectImpl c, string colname)
 {
     try
     {
         return(c is IDimensionConcept && !string.IsNullOrEmpty(((IDimensionConcept)c).RealNameFreq) && ((IDimensionConcept)c).RealNameFreq.Trim().ToUpper() == colname.Trim().ToUpper());
     }
     catch (SdmxException) { throw; }
     catch (Exception ex)
     {
         throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, ex);
     }
 }
Exemple #4
0
        /// <summary>
        /// retrieves the codelist Contrain from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistNoConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }
            foreach (var df in ReferencesObject.FoundedDataflows)
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(df.Id);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, df.Id), concepts);
                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    FlyNameArtefactSettings fnas   = new FlyNameArtefactSettings(this.parsingObject);
                    string             ConceptCode = fnas.GetConceptCodeFromCodelist();
                    IConceptObjectImpl Concept     = concepts.Find(c => c.ConceptObjectCode.Trim().ToLower() == ConceptCode.Trim().ToLower());
                    if (Concept == null)
                    {
                        continue;
                    }

                    BuildCodelist(null, Concept);
                    break;
                }
                else
                {
                    foreach (var Concept in concepts)
                    {
                        BuildCodelist(null, Concept);
                    }
                }
            }
            return(ReferencesObject.Codelists);
        }
Exemple #5
0
        /// <summary>
        /// Create a list of Code that compose a Codelist
        /// </summary>
        /// <param name="_dataFlowCode">Dataflow Code</param>
        /// <param name="_concept">Concept Object</param>
        /// <returns>List of ICodeMutableObject</returns>
        public List <ICodeMutableObject> GetCodelist(string _dataFlowCode, IConceptObjectImpl _concept)
        {
            try
            {
                DimensionCodelistsManager cm = new DimensionCodelistsManager(this.parsingObject, this.versionTypeResp);
                AttributeCodelistsManager at = new AttributeCodelistsManager(this.parsingObject, this.versionTypeResp);
                FlyDotStat_implementation.Manager.Metadata.FLAGCodelistManager fl = new FlyDotStat_implementation.Manager.Metadata.FLAGCodelistManager(this.parsingObject, this.versionTypeResp);
                SpecialCodelistsManager sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);

                switch (_concept.ConceptType)
                {
                case ConceptTypeEnum.Dimension:
                    if (string.IsNullOrEmpty(_dataFlowCode))
                    {
                        return(cm.GetDimensionCodelistNoContrain(_concept as IDimensionConcept));
                    }
                    else
                    {
                        return(cm.GetDimensionCodelistContrain(_dataFlowCode, _concept as IDimensionConcept));
                    }

                case ConceptTypeEnum.Attribute:
                    if (((IAttributeConcept)_concept).IsFlagAttribute)
                    {
                        return(fl.GetFlagCodelist(_dataFlowCode, _concept as IAttributeConcept));
                    }
                    else if (!((IAttributeConcept)_concept).IsValueAttribute)
                    {
                        if (string.IsNullOrEmpty(_dataFlowCode))
                        {
                            return(at.GetAttributeCodelistNoConstrain(_concept.CodelistCode));
                        }
                        else
                        {
                            return(at.GetAttributeCodelistConstrain(_dataFlowCode, _concept as IAttributeConcept));
                        }
                    }
                    break;

                case ConceptTypeEnum.Special:
                    return(sp.GetSpecialCodelist(_dataFlowCode, _concept as ISpecialConcept));
                }
                return(null);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetCodelist, ex);
            }
        }
Exemple #6
0
        /// <summary>
        /// Populate a list of Codelist property of SDMXObjectBuilder for insert this in DataStructure response
        /// Whitout Call all Dataflows and Concepts
        /// </summary>
        public void BuildCodelist(string DataFlowCode, IConceptObjectImpl Concept)
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (Concept.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)Concept).DimensionType == DimensionTypeEnum.Time)
            {
                return;
            }
            if (Concept.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)Concept).IsValueAttribute)
            {
                return;
            }
            if (string.IsNullOrEmpty(Concept.CodelistCode))
            {
                return;
            }
            CodelistBuilder _CodelistBuilder = new CodelistBuilder(this.parsingObject, this.versionTypeResp);

            _CodelistBuilder.Code  = string.Format(FlyConfiguration.CodelistFormat, Concept.CodelistCode.Substring(3));
            _CodelistBuilder.Names = Concept.ConceptObjectNames;

            if (!this.parsingObject.ReturnStub)
            {
                _CodelistBuilder.CodesObjects = GetCodelist(DataFlowCode, Concept);
            }
            if (this.ReferencesObject.Codelists == null)
            {
                this.ReferencesObject.Codelists = new List <ICodelistMutableObject>();
            }

            if (this.ReferencesObject.Codelists.Exists(cl => cl.Id == _CodelistBuilder.Code))
            {
                _CodelistBuilder.AddItemto(this.ReferencesObject.Codelists.Find(cl => cl.Id == _CodelistBuilder.Code));
            }
            else
            {
                if (Concept == null || Concept.ConceptType != ConceptTypeEnum.Special)
                {
                    this.ReferencesObject.Codelists.Add(_CodelistBuilder.BuildCodelist(FlyConfiguration.MainAgencyId, FlyConfiguration.Version));
                }
                else
                {
                    this.ReferencesObject.Codelists.Add(_CodelistBuilder.BuildCodelist(this.parsingObject.AgencyId, this.parsingObject._version));
                }
            }
        }
        /// <summary>
        /// Parse a time where condition
        /// </summary>
        /// <param name="DateFrom">Date From in Sdmx Format</param>
        /// <param name="DateTo">Date To in Sdmx Format</param>
        /// <returns>string representing the date where formatted</returns>
        private string ParseTimeValueWhereStatment(ISdmxDate DateFrom, ISdmxDate DateTo)
        {
            try
            {
                IConceptObjectImpl realConceptTime = Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Time);
                string             timedim         = string.Format(FormatWhereValue, ((IDimensionConcept)realConceptTime).GetColumTimeName());
                List <string>      SingleValues    = new List <string>();

                //dò per scontato che i timeFormat delle 2 date siano Uguali
                TimeFormatEnumType tf = TimeFormatEnumType.Null;
                if (DateFrom != null && DateFrom.Date.HasValue)
                {
                    tf = DateFrom.TimeFormatOfDate.EnumType;
                    string wherestr = TimePeriodDBFormat.GetTimeWhereStatment(timedim, TimePeriodDBFormat.TypeDateOperation.Major, tf, DateFrom);
                    if (!string.IsNullOrEmpty(wherestr))
                    {
                        SingleValues.Add(wherestr);
                    }
                }

                if (DateTo != null && DateTo.Date.HasValue)
                {
                    if (tf == TimeFormatEnumType.Null)
                    {
                        tf = DateTo.TimeFormatOfDate.EnumType;
                    }
                    string wherestr = TimePeriodDBFormat.GetTimeWhereStatment(timedim, FlyController.Model.TimePeriodDBFormat.TypeDateOperation.Minor, tf, DateTo);
                    if (!string.IsNullOrEmpty(wherestr))
                    {
                        SingleValues.Add(wherestr);
                    }
                }

                if (SingleValues.Count > 0)
                {
                    return(string.Format("({0})", string.Join(") AND (", SingleValues)));
                }

                return(null);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, ex);
            }
        }
Exemple #8
0
        /// <summary>
        /// Get parsed result of request
        /// </summary>
        /// <returns>Object for Write response in streaming <see cref="IFlyWriterBody"/></returns>
        public override IFlyWriterBody GetResult()
        {
            try
            {
                IDataMessageManager dmb = MappingConfiguration.DataFactory(this.VersionTypeResp);
                dmb.Concepts = this.RetrievalManagerObject.GetAllConceptsImpl();


                Builder = new DataMessageObjectBuilder()
                {
                    MessageType       = this.MessageType,
                    _versionTypeResp  = this.VersionTypeResp,
                    _retrievalManager = this.RetrievalManagerObject,
                };
                if (VersionTypeResp == SdmxSchemaEnumType.VersionTwoPointOne && this.WhereStatement != null)
                {
                    Builder.DimensionAtObservation = this.WhereStatement.DimensionAtObservation;
                    if (!string.IsNullOrEmpty(Builder.DimensionAtObservation))
                    {
                        IConceptObjectImpl DimAtObs = dmb.Concepts.Find(c => c.Id.Trim().ToUpper() == Builder.DimensionAtObservation);
                        if (DimAtObs != null && DimAtObs is IDimensionConcept &&
                            ((IDimensionConcept)DimAtObs).DimensionType != DimensionTypeEnum.Time && DimAtObs.Id != "AllDimensions")
                        {
                            throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.NotImplemented, new Exception("DimensionAtObservation can be only TIME_PERIOD or AllDimensions"));
                        }
                    }
                }
                if (this.WhereStatement.IsRest)
                {
                    this.WhereStatement.BuildRestQuery(this.RetrievalManagerObject);
                }


                WriteResponseDelegate callback = new WriteResponseDelegate(Builder.WriteDataMessage);
                return(dmb.GetTableMessage(DataFlowElementId, this.WhereStatement, callback, this.TimeStamp));
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataMessageEngineGetResults, ex);
            }
            finally
            {
                DestroyObjects();
            }
        }
Exemple #9
0
        /// <summary>
        /// retrieves the codelist Contrain  from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }

            IConceptObjectImpl Concept = null;
            SpecialTypeEnum    specType;

            if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId) &&
                Enum.TryParse <SpecialTypeEnum>(this.parsingObject.MaintainableId.Trim().ToUpper(), out specType) &&
                this.parsingObject.AgencyId == "MA")
            {
                if (!string.IsNullOrEmpty(this.parsingObject.ConstrainConcept))
                {
                    Concept = new SpecialConcept(this.parsingObject.ConstrainConcept, specType);
                }
                else
                {
                    Concept = new SpecialConcept(specType.ToString(), specType);
                }
                Concept.CodelistCode = this.parsingObject.MaintainableId;
            }
            else
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(this.parsingObject.ConstrainDataFlow);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, this.parsingObject.ConstrainDataFlow), concepts);
                Concept = concepts.Find(c => c.ConceptObjectCode.Trim().ToLower() == this.parsingObject.ConstrainConcept.Trim().ToLower());
                if (Concept == null)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CodelistInvalid, new Exception(string.Format("Concept {0} Not Found in Dataflow {1}", this.parsingObject.ConstrainConcept, this.parsingObject.ConstrainDataFlow)));
                }

                if (this.parsingObject.ContrainConceptREF != null && this.parsingObject.ContrainConceptREF.Keys.Count > 0)
                {
                    ISpecialConcept sc = new SpecialConcept(Concept.Id, SpecialTypeEnum.CL_CONTRAINED);
                    sc.CodelistCode = Concept.CodelistCode;
                    sc.SetNames(Concept.ConceptObjectNames);
                    sc.TimeDimensionRef   = concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Time);
                    sc.ContrainConceptREF = this.parsingObject.ContrainConceptREF;
                    Concept = sc;
                }
            }

            BuildCodelist(this.parsingObject.ConstrainDataFlow, Concept);
            return(ReferencesObject.Codelists);
        }
Exemple #10
0
        /// <summary>
        /// retrieves the codelist Contrain from database
        /// </summary>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodelistMutableObject> GetCodelistNoConstrain()
        {
            if (ReferencesObject == null)
            {
                ReferencesObject = new IReferencesObject();
            }


            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                IDataflowsManager gdf = new MetadataFactory().InstanceDataflowsManager((ISdmxParsingObject)this.parsingObject.Clone(), this.versionTypeResp);
                gdf.parsingObject.MaintainableId  = null;
                ReferencesObject.FoundedDataflows = gdf.GetDataFlows();
            }

            if (ReferencesObject.FoundedDataflows == null || ReferencesObject.FoundedDataflows.Count == 0)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.DataflowNotFound, new Exception(this.parsingObject.ConstrainDataFlow));
            }

            if (ReferencesObject.Concepts == null)
            {
                ReferencesObject.Concepts = new Dictionary <string, List <IConceptObjectImpl> >();
            }
            foreach (var df in ReferencesObject.FoundedDataflows)
            {
                List <IConceptObjectImpl> concepts = new ConceptSchemeManager(this.parsingObject, this.versionTypeResp).GetConceptList(df.Id);
                ReferencesObject.Concepts.Add(string.Format(FlyConfiguration.ConceptSchemeFormat, df.Id), concepts);
                if (!string.IsNullOrEmpty(this.parsingObject.MaintainableId))
                {
                    string PossibleDimTable = this.parsingObject.MaintainableId.Trim().ToUpper();
                    string PossibleAttTable = this.parsingObject.MaintainableId.Trim().ToUpper();
                    if (PossibleDimTable.StartsWith(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "")))
                    {
                        PossibleDimTable = string.Format("DIM{0}", PossibleDimTable.Substring(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                        PossibleAttTable = string.Format("ATT{0}", PossibleDimTable.Substring(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                    }
                    else if (PossibleDimTable.EndsWith(FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "")))
                    {
                        PossibleDimTable = string.Format("DIM{0}", PossibleDimTable.Substring(0, PossibleDimTable.Length - FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                        PossibleAttTable = string.Format("ATT{0}", PossibleDimTable.Substring(0, PossibleDimTable.Length - FlyConfiguration.CodelistFormat.ToUpper().Replace("{0}", "").Length));
                    }
                    IConceptObjectImpl Concept = concepts.Find(c => !string.IsNullOrEmpty(c.CodelistCode) && (c.CodelistCode.Trim().ToUpper() == PossibleDimTable || c.CodelistCode.Trim().ToUpper() == PossibleAttTable));
                    if (Concept == null)
                    {
                        continue;
                    }

                    BuildCodelist(null, Concept);
                    break;
                }
                else
                {
                    foreach (var Concept in concepts)
                    {
                        BuildCodelist(null, Concept);
                    }
                }
            }
            return(ReferencesObject.Codelists);
        }
        /// <summary>
        /// Get Database response and call delegate WriteBuilder
        /// </summary>
        /// <param name="rea">SqlDataReader response</param>
        /// <param name="builder"> Delegate for callback of Write response</param>
        /// <param name="writer"> Contains the object of transport used for transmitting data in streaming</param>
        public void GetDBResponse(SqlDataReader rea, WriteResponseDelegate builder, IFlyWriter writer)
        {
            try
            {
                DataTable schemaTable = rea.GetSchemaTable();


                IDataTableMessageObject DTMessage = new DataTableMessageObject();
                List <string>           columns   = new List <string>();
                foreach (DataRow item in schemaTable.Rows)
                {
                    string itemColumnName = item["ColumnName"].ToString();
                    columns.Add(itemColumnName);
                    SpacialColumsNamesEnum tipoSpeciale;

                    IConceptObjectImpl conc = Concepts.Find(c =>
                                                            (c.Id.Trim().ToUpper() == itemColumnName.Trim().ToUpper()) ||
                                                            (c.Id.Trim().ToUpper() == itemColumnName.Trim().ToUpper().Substring(1)) ||
                                                            CheckRenamedFrequency(c, itemColumnName) ||
                                                            CheckRenamedFrequency(c, itemColumnName.Substring(1)));

                    if (conc != null)
                    {
                        DTMessage.Colums.Add(itemColumnName, conc);
                    }
                    else if (Enum.TryParse <SpacialColumsNamesEnum>(itemColumnName.Trim().ToUpper(), true, out tipoSpeciale))
                    {
                        switch (tipoSpeciale)
                        {
                        case SpacialColumsNamesEnum._TIME_:
                        case SpacialColumsNamesEnum._TIME:
                            DTMessage.Colums.Add(itemColumnName, Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Time));
                            break;

                        case SpacialColumsNamesEnum.VALUE:
                        case SpacialColumsNamesEnum._VALUE_:
                            if (Concepts.Exists(c => c.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)c).IsValueAttribute))
                            {
                                DTMessage.Colums.Add(itemColumnName, Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)c).IsValueAttribute));
                            }
                            break;

                        case SpacialColumsNamesEnum.FLAGS:
                            if (Concepts.Exists(c => c.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)c).IsFlagAttribute))
                            {
                                DTMessage.Colums.Add(itemColumnName, Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Attribute && ((IAttributeConcept)c).IsFlagAttribute));
                            }
                            break;
                        }
                    }
                }

                //La colonna Frequency è obbligatoria (Se non c'è l'aggiungo)
                if (string.IsNullOrEmpty(DTMessage.FrequencyCol))
                {
                    var _freqconcept = Concepts.Find(c => c.ConceptType == ConceptTypeEnum.Dimension && ((IDimensionConcept)c).DimensionType == DimensionTypeEnum.Frequency && ((IDimensionConcept)c).IsFakeFrequency);
                    if (_freqconcept != null)
                    {
                        DTMessage.Colums.Add(_freqconcept.ConceptObjectCode, _freqconcept);
                    }
                }
                //Inseriamo anche la colonna TimeFormat a meno che non ci sia già nel db
                if (string.IsNullOrEmpty(DTMessage.TimeFormatCol))
                {
                    IConceptObjectImpl _timeFormatCol = Concepts.Find(co => co.ConceptType == ConceptTypeEnum.Attribute && co.Id == FlyConfiguration.Time_Format_Id);
                    if (_timeFormatCol != null)
                    {
                        DTMessage.Colums.Add(_timeFormatCol.ConceptObjectCode, _timeFormatCol);
                    }
                }

                DTMessage.DBDataReader     = rea;
                DTMessage.isFakeTimeFormat = !columns.Contains(DTMessage.TimeFormatCol);

                builder(DTMessage, writer);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.GetTableMessage, ex);
            }
        }