Пример #1
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 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);
            }
        }