/// <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>
 /// retrieves the codelist Contrain of Dimension from database
 /// </summary>
 /// <param name="dimension">Instance of Dimension "DimensionConcept"</param>
 /// <returns>list of Mutable Code Object</returns>
 public List <ICodeMutableObject> GetDimensionCodelistNoContrain(IDimensionConcept dimension)
 {
     try
     {
         if (FlyConfiguration.CodelistWhitoutConstrain)
         {
             if (dimension.IsFakeFrequency)
             {
                 SpecialCodelistsManager sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);
                 return(sp.GetFrequencyCodelist());
             }
             IDataflowsManager         dfMan    = new MetadataFactory().InstanceDataflowsManager(this.parsingObject.CloneForReferences(), this.versionTypeResp);
             List <ICodeMutableObject> listCode = new List <ICodeMutableObject>();
             var _foundedDataflow = dfMan.GetDataFlows();
             List <SdmxObjectNameDescription> nomiDf = new List <SdmxObjectNameDescription>();
             foreach (var df in _foundedDataflow)
             {
                 string                   dfCode = df.Id;
                 DimensionManager         dim    = new DimensionManager(this.parsingObject, this.versionTypeResp);
                 List <IDimensionConcept> conc   = dim.GetDimensionConceptObjects(dfCode, out nomiDf);
                 if (conc.Exists(c => c.Id == dimension.Id))
                 {
                     foreach (ICodeMutableObject item in GetDimensionCodelistContrain(dfCode, conc.Find(c => c.Id == dimension.Id)))
                     {
                         if (!listCode.Exists(cl => cl.Id == item.Id))
                         {
                             listCode.Add(item);
                         }
                     }
                 }
             }
             return(listCode);
         }
         else
         {
             throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CodelistContrainRequired);
         }
     }
     catch (SdmxException) { throw; }
     catch (Exception ex)
     {
         throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateICodeMutableObject, ex);
     }
 }
        /// <summary>
        /// retrieves the codelist Contrain of Dimension from database
        /// </summary>
        /// <param name="DataflowCode">Dataflow Code</param>
        /// <param name="dimension">Instance of Dimension "DimensionConcept"</param>
        /// <returns>list of Mutable Code Object</returns>
        public List <ICodeMutableObject> GetDimensionCodelistContrain(string DataflowCode, IDimensionConcept dimension)
        {
            try
            {
                if (dimension.DimensionType == DimensionTypeEnum.Time)
                {
                    return(new List <ICodeMutableObject>());
                }
                if (dimension.DimensionType == DimensionTypeEnum.Frequency)
                {
                    if (dimension.IsFakeFrequency)
                    {
                        SpecialCodelistsManager sp = new SpecialCodelistsManager(this.parsingObject, this.versionTypeResp);
                        return(sp.GetFrequencyCodelist(DataflowCode));
                    }
                    else
                    {
                        return(InternalGetDimensionCodelistConstrain(DataflowCode, dimension.RealNameFreq));
                    }
                }

                return(InternalGetDimensionCodelistConstrain(DataflowCode, dimension.ConceptObjectCode));
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.CreateICodeMutableObject, ex);
            }
        }