コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Regex r = new Regex(@"[a-zA-Z0-9]", RegexOptions.IgnoreCase);
                if (!r.IsMatch(trasfTextBox.Text.Trim()))
                {
                    MessageBox.Show("Wrong ID format. Please use a SDMX ID format [A-Z, a-z, 0-9, _, -, $, @])", "Wrong format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                string tmpString = CommonConstant.ToGlobalID(trasfTextBox.Text.Trim(), AgencyTextBox.Text.Trim(), VersionTextBox.Text.Trim());
                foreach (BaseArtefactInfo artInfo in _transfInfo)
                {
                    if (artInfo.vtlId == tmpString)
                    {
                        MessageBox.Show("The Trasformation scheme :\n" +
                                        trasfTextBox.Text.Trim() + " " + AgencyTextBox.Text.Trim() + " " + VersionTextBox.Text.Trim() + "\n" +
                                        " is already present. Please insert a different ID, Agency or change the version.", "Already present", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                }

                r = new Regex(@"^(\d{1}\.?){1,2}\d{1}$");
                if (!r.IsMatch(VersionTextBox.Text.Trim()))
                {
                    MessageBox.Show("Wrong version format. Please use a correct version format tre numbers separated by a dot", "Wrong format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (string.IsNullOrEmpty(AgencyTextBox.Text.Trim()))
                {
                    MessageBox.Show("The Angency value is empty. Please insert and agency ID", "Agency", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                TrasformationName = trasfTextBox.Text.Trim();
                AgencyID          = AgencyTextBox.Text.Trim();
                Version           = VersionTextBox.Text.Trim();

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        public static List <string> getDataStructureSQLStatement(string dsd_ID, string dsd_Agency, string dsd_Version, List <LocalizedValue> names, string sequentialVariable)
        {
            try
            {
                List <string> statements = new List <string>();
                string        GlobalID   = CommonConstant.ToGlobalID(dsd_ID, dsd_Agency, dsd_Version);
                statements.Add("select nvl(max(ARTEFACT_SEQ_ID),0)+1 into " + sequentialVariable + " from ARTEFACT;");
                statements.Add("insert into ARTEFACT values(" + sequentialVariable + ", '" + GlobalID + "', '" + dsd_ID + "', '" + dsd_Agency + "', '" + dsd_Version + "');");
                statements.Add("insert into DATA_STRUCTURE values (" + sequentialVariable + " );");


                if (names.Count > 0)
                {
                    string[] lang  = { names[0].lang.ToString(), names[1].lang.ToString() };
                    string[] descr = { names[0].value.ToString().Replace("'", "''"), names[1].value.ToString().Replace("'", "''") };
                    bool     first = true;
                    int      l     = 0;
                    statements.Add("select nvl(max(LS_SEQ_ID),0)+1 into appo_variable from LOCALISED_STRING;");

                    foreach (string str in lang)
                    {
                        if (first)
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable, '" + str + "', '" + descr[l] + "', 'Description', " + sequentialVariable + ", null);");
                            first = false;
                        }
                        else
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable, '" + str + "', '" + descr[l] + "', 'Description', " + sequentialVariable + ", null);");
                        }
                        l++;
                    }
                }
                return(statements);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        public static List <string> getValueDomainInsertSQLStatement(string ValueDomainID, string ValueDomainAgency, string ValueDomainVersion, List <LocalizedValue> names, ArtefactInfo.VTL.VTL_Model.VTL_DATATYPE data_type, List <BaseArtefactInfo> valuesList, string sequentialVariable, string value_domain_seq_id)
        {
            try
            {
                List <string> statements = new List <string>();
                string        GlobalID   = CommonConstant.ToGlobalID(ValueDomainID, ValueDomainAgency, ValueDomainVersion);

                statements.Add("insert into ARTEFACT (select nvl(max(ARTEFACT_SEQ_ID),0)+1, '" + GlobalID + "', '" + ValueDomainID + "', '" + ValueDomainAgency + "', '" + ValueDomainVersion + "' from ARTEFACT);");
                statements.Add("insert into VALUE_DOMAIN (select nvl(max(ARTEFACT_SEQ_ID),0), 1, '" + data_type.ToString() + "', null from ARTEFACT);");
                statements.Add("select nvl(max(VALUE_DOMAIN_SEQ_ID),0) into " + value_domain_seq_id + " from VALUE_DOMAIN;");

                if (names.Count > 0)
                {
                    string[] lang  = { names[0].lang.ToString(), names[1].lang.ToString() };
                    string[] descr = { names[0].value.ToString().Replace("'", "''"), names[1].value.ToString().Replace("'", "''") };
                    bool     first = true;
                    int      l     = 0;
                    statements.Add("select nvl(max(LS_SEQ_ID),0)+1 into appo_variable from LOCALISED_STRING;");

                    foreach (string str in lang)
                    {
                        if (first)
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable , '" + str + "', '" + descr[l] + "', 'Description', " + value_domain_seq_id + ", null);");
                            first = false;
                        }
                        else
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable , '" + str + "', '" + descr[l] + "', 'Description', " + value_domain_seq_id + ", null);");
                        }
                        l++;
                    }
                }

                foreach (BaseComponentInfo compInfo in valuesList[0].DataStructureDetails.Components)
                {
                    string   code  = compInfo.vtlId;
                    string[] lang  = { compInfo.name[0].lang.ToString(), compInfo.name[1].lang.ToString() };
                    string[] descr = { compInfo.name[0].value.ToString().Replace("'", "''"), compInfo.name[1].value.ToString().Replace("'", "''") };

                    statements.Add("select nvl(max(ITEM_SEQ_ID),0)+1 into " + sequentialVariable + " from ITEM;");
                    statements.Add("insert into ITEM values(" + sequentialVariable + ", '" + code + "');");
                    statements.Add("insert into VALUE values(" + sequentialVariable + "," + value_domain_seq_id + ");");

                    int  l     = 0;
                    bool first = true;
                    statements.Add("select nvl(max(LS_SEQ_ID),0)+1 into appo_variable from LOCALISED_STRING;");

                    foreach (string str in lang)
                    {
                        if (first)
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable  , '" + str + "', '" + descr[l] + "', 'Description', null , " + sequentialVariable + ");");
                            first = false;
                        }
                        else
                        {
                            statements.Add("insert into LOCALISED_STRING values(appo_variable , '" + str + "', '" + descr[l] + "', 'Description', null , " + sequentialVariable + ");");
                        }
                        l++;
                    }
                }

                return(statements);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #4
0
        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);
            }
        }