private void frmSelectValueDomain_Load(object sender, EventArgs e)
        {
            try
            {
                CommonItem.WaitOn();
                BaseArtefactInfo[] vlList;

                SelectedValueDomain = null;

                VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                vlList = VTL_service.GetValueDomains();


                ValuDomainListBox.Items.Clear();

                if (vlList == null)
                {
                    MessageBox.Show("There are not ValueDomain available into the database. Please, import the metadata from the metadata repository. (Metadata import)", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                foreach (BaseArtefactInfo aInfo in vlList)
                {
                    ValuDomainListBox.Items.Add(aInfo);
                }

                CommonItem.WaitOff();
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
Пример #2
0
        private void FillValueDomainListBox()
        {
            try
            {
                CommonItem.WaitOn();
                BaseArtefactInfo[] dsList;

                VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                dsList = VTL_service.GetValueDomains();

                if (dsList == null)
                {
                    MessageBox.Show("There are not Value Domain available into the database. Please, import the metadata from the metadata repository. (Metadata import)", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                this.ValueDomainListComboBox.Items.Clear();
                this.ValueDomainListComboBox.Items.Add("Select a value domain parent...");

                foreach (BaseArtefactInfo aInfo in dsList)
                {
                    ValueDomainListComboBox.Items.Add(new ValueDomainContainer(aInfo));
                }
                CommonItem.WaitOff();
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        private void FillDataStructureForDataset()
        {
            try
            {
                CommonItem.WaitOn();
                BaseArtefactInfo[] dsList;

                VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                dsList = VTL_service.GetDataStructures();

                if (dsList == null)
                {
                    MessageBox.Show("There are not DataStructures available into the database. Please, import the metadata from the metadata repository. (Metadata import)", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                DSDdataGridViewControl.Rows.Clear();

                foreach (BaseArtefactInfo aInfo in dsList)
                {
                    int rw = DSDdataGridViewControl.Rows.Add();
                    DSDdataGridViewControl.Rows[rw].Cells[0].Value = aInfo.vtlId;
                    DSDdataGridViewControl.Rows[rw].Cells[1].Value = aInfo.name[0].value;
                }
                CommonItem.WaitOff();
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to import the selected artefacts?", "Import", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                foreach (string cb in checkedListBoxArtefact.CheckedItems)
                {
                    if (cb.IndexOf("[DSD]") > -1)
                    {
                    }
                    else
                    {
                        string   val     = cb.Replace("[Codelist]: ", "");
                        string[] id_rest = val.Split(':');
                        string   agency  = id_rest[0].Trim();
                        string   id      = id_rest[1].Substring(0, id_rest[1].IndexOf('(')).Trim();
                        string   version = id_rest[1].Substring(id_rest[1].IndexOf('(') + 1).Replace(")", "").Trim();

                        foreach (BaseArtefactInfo bs in _codelistList)
                        {
                            if (bs.sdmxId == id && bs.sdmxVersion == version && bs.sdmxAgency == agency)
                            {
                                CommonItem.WaitOn();

                                VTLInt_Service.ServiceClient VTLMan   = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                                BaseArtefactInfo[]           one_item = { bs };
                                VTLMan.InsertValueDomain(id, agency, version, bs.name.ToArray(), one_item, true, BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE.String);

                                CommonItem.WaitOff();
                            }
                        }
                    }
                }
                MessageBox.Show("Selected artefacts imported!");
            }
        }
 private void frmSaveTrasformation_Load(object sender, EventArgs e)
 {
     try
     {
         TrasformationName = null;
         VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
         _transfInfo = VTL_service.GetTransformationList();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #6
0
 private BaseArtefactInfo[] getTrasformationList()
 {
     try
     {
         BaseArtefactInfo[]           tsList;
         VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
         tsList = VTL_service.GetTransformationList();
         return(tsList);
     }
     catch (Exception ex)
     {
         CommonItem.ErrManger.ErrorManagement(ex, false, this);
         return(null);
     }
 }
Пример #7
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (TrasDataGridView.SelectedRows.Count > 0)
         {
             if (MessageBox.Show("Do you want to remove the transformation scheme: " + TrasDataGridView.SelectedRows[0].Cells[0].Value, "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                 VTL_service.RemoveTransformation((string)TrasDataGridView.SelectedRows[0].Cells[0].Value);
                 TrasDataGridView.Rows.RemoveAt(TrasDataGridView.SelectedRows[0].Index);
                 MessageBox.Show("Transformation removed");
             }
         }
     }
     catch (Exception ex)
     {
         CommonItem.ErrManger.ErrorManagement(ex, false, this);
     }
 }
Пример #8
0
        public void setEnumeratedDescribedView(bool Enumerated, BaseArtefactInfo artInfo)
        {
            try
            {
                DescribedPanel.Enabled  = false;
                EnumeratedPanel.Enabled = false;

                if (Enumerated)
                {
                    EnumeratedPanel.Enabled = true;
                    ValueDomainListComboBox.SelectedIndex = ValueDomainListComboBox.FindStringExact(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vd_id_ref);
                    VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                    BaseComponentInfo[] values = VTL_service.GetSubSetList(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vtlId);

                    foreach (BaseComponentInfo bs in values)
                    {
                        for (int i = 0; i < ValuesCheckedListBox.Items.Count; i++)
                        {
                            ValValueDomainObject vl = (ValValueDomainObject)ValuesCheckedListBox.Items[i];
                            if (vl.value_seq_id.ToString() == bs.seq_id)
                            {
                                ValuesCheckedListBox.SetItemCheckState(i, CheckState.Checked);
                            }
                        }
                    }
                }
                else
                {
                    DescribedPanel.Enabled = true;
                    ValueDomainListComboBox.SelectedIndex = ValueDomainListComboBox.FindStringExact(((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).vd_id_ref + DESCRIBED_SUFFIX);
                    DescribedCriterionTextBox.Text        = ((ArtefactInfo.model.ValueDomainSubsetInfo)(artInfo)).set_criterion_id;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        private void ValueDomainListComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                BaseComponentInfo[]          values;
                KeyValuePair <int, string>[] value_seq_id;
                DescribedCriterionTextBox.Clear();
                valDomParentDescrTextBox.Clear();
                ValuesCheckedListBox.Items.Clear();
                if (this.ValueDomainListComboBox.SelectedItem.GetType().ToString() != "System.String")
                {
                    ValueDomainContainer valCont = (ValueDomainContainer)this.ValueDomainListComboBox.SelectedItem;
                    _selectedParent = valCont.componentObject;

                    if (valCont.isEnumerated)
                    {
                        DescribedPanel.Enabled    = false;
                        DescribedPanel.BackColor  = Color.Gray;
                        EnumeratedPanel.Enabled   = true;
                        EnumeratedPanel.BackColor = Color.SteelBlue;

                        VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                        values       = VTL_service.GetValueDomainValues(valCont.vtlID);
                        value_seq_id = VTL_service.GetValueDomain_seq_id(valCont.vtlID);

                        if (values.Count() == 0)
                        {
                            MessageBox.Show("No values found!", "Values missing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        foreach (BaseComponentInfo val in values)
                        {
                            ValValueDomainObject tmpVal = new ValValueDomainObject();
                            tmpVal.name   = val.name[0].value;
                            tmpVal.Vtl_ID = val.vtlId;
                            var tmpVar = from seq_id in value_seq_id
                                         where seq_id.Value == val.vtlId
                                         select seq_id.Key;

                            tmpVal.value_seq_id = (int)tmpVar.First();
                            ValuesCheckedListBox.Items.Add(tmpVal);
                        }
                    }
                    else
                    {
                        DescribedPanel.Enabled        = true;
                        DescribedPanel.BackColor      = Color.SteelBlue;
                        EnumeratedPanel.Enabled       = false;
                        EnumeratedPanel.BackColor     = Color.Gray;
                        valDomParentDescrTextBox.Text = valCont.restrictionText;
                    }
                }
                else
                {
                    _selectedParent = null;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void LoadingStuff()
        {
            try
            {
                CommonItem.CurrentSettings = new MainApplicationSettings();
                CommonItem.ErrManger       = new classes.tool.ErrorAndLogManager();
                List <CommonConst.Loading_Status> settingResult = CommonItem.CurrentSettings.LoadSettings(true);

                if (settingResult[0] == CommonConst.Loading_Status.NOT_FOUND)
                {
                    _errorMessage.Add(" - Settings not found, please create them through the Settings module and restart the application! \n \n" + settingResult[0].ToString());
                    _error = true;
                    return;
                }

                //LoadSettings test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(1);
                if (settingResult[0] != CommonConst.Loading_Status.LOADED)
                {
                    string resultList = "";
                    foreach (CommonConst.Loading_Status sr in settingResult)
                    {
                        resultList += sr + "  ";
                    }
                    _errorMessage.Add("Some settings are missed or not correct. They can cause malfunctions. \r\n Please fix them through the Settings module and restart the application! [" + resultList + "]");
                    _error = true;
                }

                //Interaction Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(2);
                if (CommonItem.CurrentSettings.InteractionWebService != null)
                {
                    if (settingResult.Where(err => err == CommonConst.Loading_Status.INTERACTION_WS_LOADED).Count() > 0)
                    {
                        if (!RemoteFileExists.Check(CommonItem.CurrentSettings.InteractionWebService.WebService_clear_URL, true))
                        {
                            _errorMessage.Add(" - Connection to Interaction web service failed.");
                            _error = true;
                        }
                        else
                        {
                            //Interaction DB test
                            //-----------------------------------------------------------------------------
                            VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                            System.Threading.Thread.Sleep(_millisecondDelay);
                            backgroundLoader.ReportProgress(3);
                            if (!VTL_service.TestDatabaseConnection())
                            {
                                _errorMessage.Add(" - VTL Database connection from Interaction web service failed.");
                                _error = true;
                            }
                        }
                    }
                }
                //Validation Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(4);
                WebServiceConnector.RestWebConnector RestWS = new WebServiceConnector.RestWebConnector(CommonItem.CurrentSettings.ValidationWebService.WebService_public_URL + CommonItem.SYNTACTIC_VALIDATION_WEBMETHOD);
                Dictionary <string, string>          args   = new Dictionary <string, string>();

                try
                {
                    string result = RestWS.SendPostRequest("ds1:=length(1);");
                }
                catch (Exception ex)
                {
                    _errorMessage.Add(" - Connection to Validation web service failed. [" + ex.Message + "]");
                    _error = true;
                }

                //-----------------------------------------------------------------------------

                //Metadata Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(5);
                if (CommonItem.CurrentSettings.WebServices.Count > 0)
                {
                    ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo ws = CommonItem.CurrentSettings.WebServices[0];
                    if (!RemoteFileExists.Check(ws.WebService_clear_URL, true))
                    {
                        _errorMessage.Add(" - Connection to SDMX Metadata web service failed.");
                        _error = true;
                    }
                }
                //-----------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                _error = true;
                if (_errorMessage.Count() == 0)
                {
                    _errorMessage.Add(" - " + ex.Message);
                }
            }
        }
        private void cm_ItemImportClicked(object sender, System.EventArgs e)
        {
            try
            {
                TreeNode                     tmpNode = (TreeNode)((MenuItem)sender).Tag;
                ArtefactNodeInfo             artInfo = (ArtefactNodeInfo)tmpNode.Tag;
                VTLInt_Service.ServiceClient VTLMan  = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                MetadataLoader mtl = null;

                //VTLMan.LineCountEvent += LineCountEventManager;


                switch (artInfo.artType)
                {
                case ArtefactNodeInfo.ArtefactType.ValueDomains:
                    string vd_id      = artInfo.artefactInfo.sdmxId;
                    string vd_agency  = artInfo.artefactInfo.sdmxAgency;
                    string vd_version = artInfo.artefactInfo.sdmxVersion;

                    if (MessageBox.Show("Do you want import into the VTL database the codelist: \n " + vd_id + " " + vd_agency + " " + vd_version, "Import codelist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> dsList = mtl.LoadCodelistCodes21(vd_id, vd_agency, vd_version);

                        VTLMan.InsertValueDomain(vd_id, vd_agency, vd_version, artInfo.artefactInfo.name.ToArray(), dsList.ToArray(), true, BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE.String);

                        CommonItem.WaitOff();

                        MessageBox.Show("Value domain :" + vd_id + " " + vd_agency + " " + vd_version + " successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }

                    break;

                case ArtefactNodeInfo.ArtefactType.DataStructureComponents:
                    string[] globIdent = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(artInfo.artefactComponentInfo)).valuedomain_id);

                    string cmp_id      = globIdent[0];
                    string cmp_agency  = globIdent[1];
                    string cmp_version = globIdent[2];

                    CommonItem.WaitOn();

                    mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                    List <BaseArtefactInfo> cmpList = mtl.LoadCodelistCodes21(cmp_id, cmp_agency, cmp_version);

                    VTLMan.InsertValueDomain(cmp_id, cmp_agency, cmp_version, artInfo.artefactInfo.name.ToArray(), cmpList.ToArray(), true, BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE.String);

                    CommonItem.WaitOff();

                    MessageBox.Show("Value domain :" + cmp_id + " " + cmp_agency + " " + cmp_version + " successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tmpNode.ForeColor = Color.Gray;
                    break;

                case ArtefactNodeInfo.ArtefactType.DataStructures:
                    string dsd_id      = artInfo.artefactInfo.sdmxId;
                    string dsd_agency  = artInfo.artefactInfo.sdmxAgency;
                    string dsd_version = artInfo.artefactInfo.sdmxVersion;
                    List <BaseArtefactInfo>  valueDomainValueList;
                    List <BaseComponentInfo> componentsList = new List <BaseComponentInfo>();

                    if (MessageBox.Show("Do you want import into the VTL database the Datastructure: \n " + dsd_id + " " + dsd_agency + " " + dsd_version + "\n and all the referenced artefacts?", "Import datastructure", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();
                        label1.Text = DateTime.Now.ToString();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> componentList = mtl.LoadDataStructuresComponents21(dsd_id, dsd_agency, dsd_version);

                        foreach (BaseComponentInfo comp in componentList[0].DataStructureDetails.Components)
                        {
                            BaseComponentInfo tmpComponentInfo     = new BaseComponentInfo();
                            ValueDomainInfoInDataStructure tmpInfo = new ValueDomainInfoInDataStructure();
                            string[] globalId = null;

                            tmpComponentInfo.vtlId = comp.vtlId;
                            tmpComponentInfo.name  = comp.name;
                            tmpComponentInfo.datastructure_id_ref = comp.datastructure_id_ref;
                            tmpComponentInfo.seq_id = comp.seq_id;

                            switch (((ArtefactInfo.model.DataStructureComponentInfo)(comp)).role)
                            {
                            case "Dimension":
                                tmpComponentInfo.Role = "Identifier";
                                if (!String.IsNullOrEmpty(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id))
                                {
                                    globalId = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id);
                                }
                                break;

                            case "TimeDimension":
                                tmpComponentInfo.Role = "Identifier";
                                globalId = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.TIME_PERIOD_default_valueDomainID);
                                break;

                            case "PrimaryMeasure":
                                tmpComponentInfo.Role = "Measure";
                                globalId = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.OBS_default_valueDomainID);
                                break;
                            }

                            tmpInfo.vd_id      = globalId[0];
                            tmpInfo.vd_agency  = globalId[1];
                            tmpInfo.vd_version = globalId[2];

                            valueDomainValueList = mtl.LoadCodelistCodes21(globalId[0], globalId[1], globalId[2]);

                            if (valueDomainValueList != null)
                            {
                                tmpInfo.values = valueDomainValueList;
                            }

                            if (comp.name != null)
                            {
                                tmpInfo.names = comp.name;
                            }
                            else
                            {
                                tmpInfo.names = new List <LocalizedValue>();
                                tmpInfo.names.Add(new LocalizedValue("EN", comp.vtlId));
                            }

                            tmpComponentInfo.ValueDomainInfo = tmpInfo;

                            componentsList.Add(tmpComponentInfo);
                        }
                        try
                        {
                            VTLMan.InsertDataStructure(dsd_id, dsd_agency, dsd_version, artInfo.artefactInfo.name.ToArray(), componentsList.ToArray(), BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD);
                        }
                        catch (TimeoutException ext)
                        {
                            MessageBox.Show("Time out exception");
                            return;
                        }

                        label2.Text = DateTime.Now.ToString();
                        CommonItem.WaitOff();

                        MessageBox.Show("Data structures :" + dsd_id + " " + dsd_agency + " " + dsd_version + "  and all the linked components successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }
                    break;

                case ArtefactNodeInfo.ArtefactType.DataFlows:
                    string ref_dsd_id      = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_id;
                    string ref_dsd_agency  = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_agency;
                    string ref_dsd_version = ((DataSetInfo)artInfo.artefactInfo).sdmx_DataStructure_version;
                    string df_id           = ((DataSetInfo)artInfo.artefactInfo).sdmxId;
                    string df_agency       = ((DataSetInfo)artInfo.artefactInfo).sdmxAgency;
                    string df_version      = ((DataSetInfo)artInfo.artefactInfo).sdmxVersion;

                    List <BaseArtefactInfo>  ds_valueDomainValueList;
                    List <BaseComponentInfo> ds_componentsList = new List <BaseComponentInfo>();

                    if (MessageBox.Show("Do you want import into the VTL database the DataSet: \n " + df_id + " " + df_agency + " " + df_version + "\n and all the referenced artefacts?", "Import datastructure", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        CommonItem.WaitOn();
                        label1.Text = DateTime.Now.ToString();

                        mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(artInfo.webServiceID)));
                        List <BaseArtefactInfo> componentList = mtl.LoadDataStructuresComponents21(ref_dsd_id, ref_dsd_agency, ref_dsd_version);

                        BaseComponentInfo tmpInfo;
                        ValueDomainInfoInDataStructure tmpValueDomain;

                        foreach (BaseComponentInfo comp in componentList[0].DataStructureDetails.Components)
                        {
                            tmpInfo       = new BaseComponentInfo();
                            tmpInfo.vtlId = comp.vtlId;
                            tmpInfo.name  = comp.name;
                            string[] globalId = null;


                            switch (((ArtefactInfo.model.DataStructureComponentInfo)(comp)).role)
                            {
                            case "Dimension":
                                tmpInfo.Role = "Identifier";
                                if (!String.IsNullOrEmpty(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id))
                                {
                                    globalId = CommonConstant.splitGlobalID(((ArtefactInfo.model.DataStructureComponentInfo)(comp)).valuedomain_id);
                                }
                                break;

                            case "TimeDimension":
                                tmpInfo.Role = "Identifier";
                                globalId     = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.TIME_PERIOD_default_valueDomainID);
                                break;

                            case "PrimaryMeasure":
                                tmpInfo.Role = "Measure";
                                globalId     = CommonConstant.splitGlobalID(CommonItem.CurrentSettings.OBS_default_valueDomainID);
                                break;
                            }
                            tmpValueDomain = new ValueDomainInfoInDataStructure();

                            tmpValueDomain.vd_id      = globalId[0];
                            tmpValueDomain.vd_agency  = globalId[1];
                            tmpValueDomain.vd_version = globalId[2];

                            if (comp.name != null)
                            {
                                tmpValueDomain.names = comp.name;
                            }
                            else
                            {
                                tmpValueDomain.names = new List <LocalizedValue>();
                                tmpValueDomain.names.Add(new LocalizedValue("EN", comp.vtlId));
                            }

                            ds_valueDomainValueList = mtl.LoadCodelistCodes21(globalId[0], globalId[1], globalId[2]);

                            if (ds_valueDomainValueList != null)
                            {
                                tmpValueDomain.values = ds_valueDomainValueList;
                            }

                            tmpInfo.ValueDomainInfo = tmpValueDomain;
                            ds_componentsList.Add(tmpInfo);
                        }
                        try
                        {
                            VTLMan.InsertDataSet(ref_dsd_id, ref_dsd_agency, ref_dsd_version, df_id, df_agency, df_version, artInfo.artefactInfo.name.ToArray(), ds_componentsList.ToArray(), BaseArtefactInfo.CREATION_TYPE.SDMX_WS_UPLOAD);
                        }
                        catch (TimeoutException ds_ext)
                        {
                            MessageBox.Show("Time out exception");
                            return;
                        }

                        label2.Text = DateTime.Now.ToString();
                        CommonItem.WaitOff();

                        MessageBox.Show("Data set :" + df_id + " " + df_agency + " " + df_version + "  and all the linked components successufully imported", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tmpNode.ForeColor = Color.Gray;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
            finally
            {
                CommonItem.WaitOff();
            }
        }
        private void LoadDataStructures(string webserviceId, TreeNode parent)
        {
            try
            {
                CommonItem.WaitOn();

                List <BaseArtefactInfo> dsList;
                bool raiseError = false;

                MetadataLoader mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(webserviceId)));
                dsList = mtl.LoadDataStructures21();

                VTLInt_Service.ServiceClient VTL_service    = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                BaseArtefactInfo[]           alreadyPresent = VTL_service.GetDataStructures();

                foreach (BaseArtefactInfo aInfo in dsList)
                {
                    string text;
                    if (switchTreeView.isCode())
                    {
                        text = aInfo.vtlId;
                    }
                    else
                    if (aInfo.name.Count == 0)
                    {
                        raiseError = true;
                        text       = aInfo.vtlId;
                    }
                    else
                    {
                        text = aInfo.name[0].value.ToString();
                    }

                    TreeNode tmp = parent.Nodes.Add(aInfo.sdmxId, text);
                    tmp.ForeColor = Color.Black;

                    if (alreadyPresent != null)
                    {
                        var found = from i in alreadyPresent
                                    where i.vtlId == text
                                    select i;
                        if (found.Count() > 0)
                        {
                            tmp.ForeColor = Color.DarkGreen;
                        }
                    }

                    tmp.Tag = new ArtefactNodeInfo(webserviceId, aInfo, ArtefactNodeInfo.ArtefactType.DataStructures);
                }

                CommonItem.WaitOff();

                if (raiseError)
                {
                    MessageBox.Show("The description is not available for one or more items. The ID will be shown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
        private void LoadDataFlows(string webserviceId, TreeNode trNode)
        {
            try
            {
                CommonItem.WaitOn();
                List <BaseArtefactInfo> dfList;
                bool   raiseError = false;
                string vtlIdCode  = null;

                MetadataLoader mtl = new MetadataLoader(CommonItem.CurrentSettings.QueriesPath, new WebServiceLayer.classes.service.Net.WebServiceLayer(CommonItem.CurrentSettings, int.Parse(webserviceId)));
                dfList = mtl.LoadDataflows21();

                VTLInt_Service.ServiceClient VTL_service       = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);
                BaseArtefactInfo[]           alreadyPresent    = VTL_service.GetDataSets();
                BaseArtefactInfo[]           alreadyPresentDsD = VTL_service.GetDataStructures();

                foreach (BaseArtefactInfo aInfo in dfList)
                {
                    string text;
                    if (switchTreeView.isCode())
                    {
                        text = aInfo.sdmxId;
                    }
                    else
                    if (aInfo.name.Count == 0)
                    {
                        raiseError = true;
                        text       = aInfo.vtlId;
                    }
                    else
                    {
                        text = aInfo.name[0].value.ToString();
                    }

                    vtlIdCode = CommonConstant.ToGlobalID(aInfo.sdmxId, aInfo.sdmxAgency, aInfo.sdmxVersion);
                    TreeNode tmp = trNode.Nodes.Add(vtlIdCode);
                    tmp.ForeColor = Color.Gray;

                    string dsdInfo = CommonConstant.ToGlobalID(((ArtefactInfo.model.DataSetInfo)(aInfo)).sdmx_DataStructure_id, ((DataSetInfo)aInfo).sdmx_DataStructure_agency, ((DataSetInfo)aInfo).sdmx_DataStructure_version);
                    if (alreadyPresentDsD != null)
                    {
                        var found = from i in alreadyPresentDsD
                                    where (CommonConstant.ToGlobalID(i.sdmxId, i.sdmxAgency, i.sdmxVersion)) == dsdInfo
                                    select i;
                        if (found.Count() > 0)
                        {
                            tmp.ForeColor = Color.Black;
                        }
                    }

                    if (alreadyPresent != null)
                    {
                        var found = from i in alreadyPresent
                                    where (i.vtlId) == vtlIdCode
                                    select i;
                        if (found.Count() > 0)
                        {
                            tmp.ForeColor = Color.DarkGreen;
                        }
                    }

                    tmp.Tag         = new ArtefactNodeInfo(webserviceId, aInfo, ArtefactNodeInfo.ArtefactType.DataFlows);
                    tmp.ToolTipText = "Datastructure ref: " + ((ArtefactInfo.model.DataSetInfo)(aInfo)).sdmxAgency + ":" + ((ArtefactInfo.model.DataSetInfo)(aInfo)).datastructure_id + "(" + ((ArtefactInfo.model.DataSetInfo)(aInfo)).sdmx_DataStructure_version + ")";
                }
                CommonItem.WaitOff();

                if (raiseError)
                {
                    MessageBox.Show("The description is not available for one or more items.The ID will be shown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }