private ISdmxObjects GetSdmxObjects() { ISdmxObjects sdmxObjects = null; WSModel dal = new WSModel(); switch (ucArtefactType) { case "CodeList": sdmxObjects = dal.GetCodeList(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "ConceptScheme": sdmxObjects = dal.GetConceptScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "CategoryScheme": sdmxObjects = dal.GetCategoryScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "DataFlow": sdmxObjects = dal.GetDataFlow(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), false, false); break; case "KeyFamily": sdmxObjects = dal.GetDataStructure(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "Categorization": // Aggiunto per il recupero di una Categorization ------ Fabrizio Alonzi sdmxObjects = dal.GetCategorisation(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), false, false); break; case "AgencyScheme": sdmxObjects = dal.GetAgencyScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "DataProviderScheme": sdmxObjects = dal.GetDataProviderScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "DataConsumerScheme": sdmxObjects = dal.GetDataConsumerScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "OrganizationUnitScheme": sdmxObjects = dal.GetOrganisationUnitScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "ContentConstraint": sdmxObjects = dal.GetContentConstraint(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "StructureSet": sdmxObjects = dal.GetStructureSet(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; case "Hcl": sdmxObjects = dal.GetHcl(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), true, false); break; default: return null; } return sdmxObjects; }
private ICategorySchemeMutableObject GetCategorySchemeFromSession() { try { if (Session[KEY_PAGE_SESSION] == null) { if (_artIdentity.ToString() != string.Empty) { WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetCategoryScheme(_artIdentity, false, false); ICategorySchemeObject cs = sdmxObject.CategorySchemes.FirstOrDefault(); Session[KEY_PAGE_SESSION] = cs.MutableInstance; } else { throw new Exception(); } } return (ICategorySchemeMutableObject)Session[KEY_PAGE_SESSION]; } catch (Exception ex) { return null; } }
private ISdmxObjects GetSdmxObjects() { ISdmxObjects sdmxObjects = null; WSModel dal = new WSModel(); switch (ucArtefactType.ToUpper()) { case "CODELIST": sdmxObjects = dal.GetCodeList(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked,false); break; case "CONCEPTSCHEME": sdmxObjects = dal.GetConceptScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "CATEGORYSCHEME": sdmxObjects = dal.GetCategoryScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DATAFLOW": sdmxObjects = dal.GetDataFlow(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "KEYFAMILY": if ( chkExportCodeListAndConcept.Checked ) { sdmxObjects = dal.GetDataStructureWithRef(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); } else { sdmxObjects = dal.GetDataStructure(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); } break; case "CATEGORIZATION": sdmxObjects = dal.GetCategorisation(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "AGENCYSCHEME": sdmxObjects = dal.GetAgencyScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DATAPROVIDERSCHEME": sdmxObjects = dal.GetDataProviderScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DATACONSUMERSCHEME": sdmxObjects = dal.GetDataConsumerScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "ORGANIZATIONUNITSCHEME": sdmxObjects = dal.GetOrganisationUnitScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "CONTENTCONSTRAINT": sdmxObjects = dal.GetContentConstraint(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "STRUCTURESET": sdmxObjects = dal.GetStructureSet(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "HCL": sdmxObjects = dal.GetHcl(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; default: return null; } return sdmxObjects; }
protected void structuresGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { structuresGrid.PageSize = 12; structuresGrid.PageIndex = e.NewPageIndex; WSModel wsModel = new WSModel(); ISdmxObjects sdmxInput; switch (ddlAvailableStructures.Text) { case "CODELIST": sdmxInput = wsModel.GetCodeList(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<ICodelistObject> codelist = sdmxInput.Codelists.ToList(); structuresGrid.DataSource = codelist; break; case "CONCEPT_SCHEME": sdmxInput = wsModel.GetConceptScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IConceptSchemeObject> conceptScheme = sdmxInput.ConceptSchemes.ToList(); structuresGrid.DataSource = conceptScheme; break; case "CATEGORY_SCHEME": sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<ICategorySchemeObject> categorySchemeFound = sdmxInput.CategorySchemes.ToList(); structuresGrid.DataSource = categorySchemeFound; break; case "AGENCY_SCHEME": sdmxInput = wsModel.GetAgencyScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IAgencyScheme> agencyScheme = sdmxInput.AgenciesSchemes.ToList(); structuresGrid.DataSource = agencyScheme; break; case "DATA_PROVIDER_SCHEME": sdmxInput = wsModel.GetDataProviderScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IDataProviderScheme> dataProviderScheme = sdmxInput.DataProviderSchemes.ToList(); structuresGrid.DataSource = dataProviderScheme; break; case "DATA_CONSUMER_SCHEME": sdmxInput = wsModel.GetDataConsumerScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IDataConsumerScheme> dataConsumerScheme = sdmxInput.DataConsumerSchemes.ToList(); structuresGrid.DataSource = dataConsumerScheme; break; case "ORGANIZATION_UNIT_SCHEME": sdmxInput = wsModel.GetOrganisationUnitScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IOrganisationUnitSchemeObject> organizationUnitScheme = sdmxInput.OrganisationUnitSchemes.ToList(); structuresGrid.DataSource = organizationUnitScheme; break; case "KEY_FAMILY": sdmxInput = wsModel.GetDataStructure(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IDataStructureObject> dataStructure = sdmxInput.DataStructures.ToList(); structuresGrid.DataSource = dataStructure; break; case "DATAFLOW": sdmxInput = wsModel.GetDataFlow(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IDataflowObject> dataFlow = sdmxInput.Dataflows.ToList(); structuresGrid.DataSource = dataFlow; break; case "STRUCTURE_SET": sdmxInput = wsModel.GetStructureSet(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IStructureSetObject> structureSet = sdmxInput.StructureSets.ToList(); structuresGrid.DataSource = structureSet; break; case "CONTENT_CONSTRAINT": sdmxInput = wsModel.GetContentConstraint(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IContentConstraintObject> contentConstraint = sdmxInput.ContentConstraintObjects.ToList(); structuresGrid.DataSource = contentConstraint; break; } structuresGrid.DataBind(); Utils.AppendScript("openP('gridDiv',650);"); Utils.AppendScript("location.href= '#structure';"); }
private ISdmxObjects GetSdmxObjects() { ISdmxObjects sdmxObjects = null; WSModel dal = new WSModel(); switch (ucArtefactType) { case "CodeList": sdmxObjects = dal.GetCodeList(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked,false); break; case "ConceptScheme": sdmxObjects = dal.GetConceptScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "CategoryScheme": sdmxObjects = dal.GetCategoryScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DataFlow": sdmxObjects = dal.GetDataFlow(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "KeyFamily": if ( chkExportCodeListAndConcept.Checked ) { sdmxObjects = dal.GetDataStructureWithRef(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); } else { sdmxObjects = dal.GetDataStructure(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); } break; case "Categorization": sdmxObjects = dal.GetCategorisation(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "AgencyScheme": sdmxObjects = dal.GetAgencyScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DataProviderScheme": sdmxObjects = dal.GetDataProviderScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "DataConsumerScheme": sdmxObjects = dal.GetDataConsumerScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "OrganizationUnitScheme": sdmxObjects = dal.GetOrganisationUnitScheme(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "ContentConstraint": sdmxObjects = dal.GetContentConstraint(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "StructureSet": sdmxObjects = dal.GetStructureSet(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; case "Hcl": sdmxObjects = dal.GetHcl(new ISTAT.Entity.ArtefactIdentity(ucID, ucAgency, ucVersion), chkStub.Checked, false); break; default: return null; } return sdmxObjects; }
protected void ddlCategorySchemeList_SelectedIndexChanged(object sender, EventArgs e) { string[] splittedElementsOfCategoryScheme = ddlCategorySchemeList.Text.Split('-'); WSModel wsModel = new WSModel(); ISdmxObjects sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(splittedElementsOfCategoryScheme[0], splittedElementsOfCategoryScheme[1], splittedElementsOfCategoryScheme[2]), false, false); ICategorySchemeObject categoryScheme = sdmxInput.CategorySchemes.First(); TreeView1.Nodes.Clear(); foreach (var category in categoryScheme.Items) { TreeNode node = new TreeNode(string.Format("[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName(category))); //node.Value = string.Format( "[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName( category ) ); node.Value = category.Id; node.Text = string.Format("[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName(category)); node.SelectAction = TreeNodeSelectAction.Select; CreateTreeWithRecursion(category, node); TreeView1.Nodes.Add(node); } TreeView1.CollapseAll(); Session["tmpCategorySchemeReference"] = null; txtSelectedCategory.Text = string.Empty; Utils.AppendScript("location.href='#structure';"); }
private void SetStructureDetailPanel() { if (!Page.IsPostBack) { try { string[] skipElements = { "CATEGORIZATION" }; Utils.PopulateCmbArtefacts(ddlAvailableStructures, skipElements); WSModel wsModel = new WSModel(); ISdmxObjects sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, true); foreach (ICategorySchemeObject cs in sdmxInput.CategorySchemes) { if (cs.IsFinal.IsTrue) { ddlCategorySchemeList.Items.Add(new ListItem(string.Format("{0}-{1}-{2}", cs.Id.ToUpper(), cs.AgencyId.ToUpper(), cs.Version), string.Format("{0}-{1}-{2}", cs.Id, cs.AgencyId, cs.Version))); } } string[] splittedElementsOfCategoryScheme = ddlCategorySchemeList.Text.Split('-'); sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(splittedElementsOfCategoryScheme[0], splittedElementsOfCategoryScheme[1], splittedElementsOfCategoryScheme[2]), false, false); //sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity( "cat_sch3", "ESTAT", "1.1"), false,false); ICategorySchemeObject categoryScheme = sdmxInput.CategorySchemes.First(); foreach (var category in categoryScheme.Items) { TreeNode node = new TreeNode(string.Format("[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName(category))); //node.Value = string.Format( "[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName( category ) ); node.Value = category.Id; node.Text = string.Format("[ {0} ] {1}", category.Id, _localizedUtils.GetNameableName(category)); node.SelectAction = TreeNodeSelectAction.Select; CreateTreeWithRecursion(category, node); TreeView1.Nodes.Add(node); } TreeView1.CollapseAll(); switch (ddlAvailableStructures.Text) { case "CODELIST": sdmxInput = wsModel.GetCodeList(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<ICodelistObject> codelist = sdmxInput.Codelists.ToList(); structuresGrid.DataSource = codelist; break; case "CONCEPT_SCHEME": sdmxInput = wsModel.GetConceptScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<IConceptSchemeObject> conceptScheme = sdmxInput.ConceptSchemes.ToList(); structuresGrid.DataSource = conceptScheme; break; case "CATEGORY_SCHEME": sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); List<ICategorySchemeObject> categorySchemeFound = sdmxInput.CategorySchemes.ToList(); structuresGrid.DataSource = categorySchemeFound; break; case "DATAFLOW": sdmxInput = wsModel.GetDataFlow(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "KEY_FAMILY": sdmxInput = wsModel.GetDataStructure(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); /* List<ICodelistObject> codelist = sdmxInput.Codelists.ToList(); foreach ( var currentCodelist in codelist ) { ddlAvailableItems.Items.Add( new ListItem( string.Format( "{0} - {1} - {2}", currentCodelist.Id, currentCodelist.AgencyId, currentCodelist.Version ), string.Format( "{0} - {1} - {2}", currentCodelist.Id, currentCodelist.AgencyId, currentCodelist.Version ) ) ); }*/ break; case "DATA_PROVIDER_SCHEME": sdmxInput = wsModel.GetDataProviderScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "DATA_CONSUMER_SCHEME": sdmxInput = wsModel.GetDataConsumerScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "ORGANIZATION_UNIT_SCHEME": sdmxInput = wsModel.GetOrganisationUnitScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "STRUCTURE_SET": sdmxInput = wsModel.GetStructureSet(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "CONTENT_CONSTRAINT": sdmxInput = wsModel.GetContentConstraint(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; case "AGENCY_SCHEME": sdmxInput = wsModel.GetAgencyScheme(new ArtefactIdentity(string.Empty, string.Empty, string.Empty), true, false); break; } structuresGrid.DataSourceID = null; structuresGrid.DataBind(); } catch (Exception ex) { Debug.WriteLine("error: " + ex.Message); } } // Verifico se la codelist è final /* if (cl.IsFinal.IsTrue || Request["ACTION"].ToString().Equals("VIEW")) { // Se final il pulsante di add e le colonne di modifica // dei codici non devono apparire btnSaveMemoryCodeList.Visible = false; btnAddNewCode.Visible = false; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 1].Visible = false; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 2].Visible = false; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 3].Visible = false; cmbLanguageForCsv.Visible = false; imgImportCsv.Visible = false; } else { btnSaveMemoryCodeList.Visible = true; btnAddNewCode.Visible = true; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 1].Visible = true; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 2].Visible = true; gvCodelistsItem.Columns[gvCodelistsItem.Columns.Count - 3].Visible = true; Utils.PopulateCmbLanguages(cmbLanguageForCsv); cmbLanguageForCsv.Visible = true; imgImportCsv.Visible = true; }*/ }
private void SetGeneralTab(ICategorisationObject cat) { txt_id.Text = cat.Id; txtAgenciesReadOnly.Text = cat.AgencyId; txt_version.Text = cat.Version; chk_isFinal.Checked = cat.IsFinal.IsTrue; FileDownload31.ucID = cat.Id; FileDownload31.ucAgency = cat.AgencyId; FileDownload31.ucVersion = cat.Version; FileDownload31.ucArtefactType = "Categorization"; txt_uri.Text = (cat.Uri != null) ? cat.Uri.AbsoluteUri : string.Empty; txt_urn.Text = (cat.Urn != null) ? cat.Urn.AbsoluteUri : string.Empty; txt_valid_from.Text = (cat.StartDate != null) ? string.Format("{0}/{1}/{2}", cat.StartDate.Date.Value.Day.ToString(), cat.StartDate.Date.Value.Month.ToString(), cat.StartDate.Date.Value.Year.ToString()) : string.Empty; txt_valid_to.Text = (cat.EndDate != null) ? string.Format("{0}/{1}/{2}", cat.EndDate.Date.Value.Day.ToString(), cat.EndDate.Date.Value.Month.ToString(), cat.EndDate.Date.Value.Year.ToString()) : string.Empty; txt_name_locale.Text = _localizedUtils.GetNameableName(cat); txt_description_locale.Text = _localizedUtils.GetNameableDescription(cat); // Svuoto le griglie //=========================================== if (AddTextName.TextObjectList != null && AddTextName.TextObjectList.Count != 0) { AddTextName.ClearTextObjectList(); } if (AddTextDescription.TextObjectList != null && AddTextDescription.TextObjectList.Count != 0) { AddTextDescription.ClearTextObjectList(); } if (AnnotationGeneralControl.AnnotationObjectList != null && AnnotationGeneralControl.AnnotationObjectList.Count != 0) { AnnotationGeneralControl.ClearAnnotationsSession(); } txt_id.Enabled = false; txt_version.Enabled = false; cmb_agencies.Enabled = false; if (Request["ACTION"] == "VIEW" || cat.IsFinal.IsTrue || Utils.ViewMode) { AddTextName.Visible = false; txt_all_names.Visible = true; txt_all_names.Text = _localizedUtils.GetNameableName(cat); AddTextDescription.Visible = false; txt_all_description.Visible = true; txt_all_description.Text = _localizedUtils.GetNameableDescription(cat); } else { AspConfirmationExit = "true"; AddTextName.Visible = true; AddTextDescription.Visible = true; txt_all_description.Visible = false; txt_all_names.Visible = false; AddTextName.InitTextObjectList = cat.Names; AddTextDescription.InitTextObjectList = cat.Descriptions; } if (_action != Action.VIEW) { DuplicateArtefact1.Visible = false; } AnnotationGeneralControl.AddText_ucOpenTabName = AnnotationGeneralControl.ClientID; AnnotationGeneralControl.AnnotationObjectList = cat.MutableInstance.Annotations; AnnotationGeneralControl.EditMode = !cat.IsFinal.IsTrue; AnnotationGeneralControl.OwnerAgency = txtAgenciesReadOnly.Text; if (cat.IsFinal.IsTrue) { txt_valid_from.Enabled = false; txt_valid_to.Enabled = false; txt_name_locale.Enabled = false; txt_description_locale.Enabled = false; txt_uri.Enabled = false; chk_isFinal.Enabled = false; } else { txt_valid_from.Enabled = true; txt_valid_to.Enabled = true; txt_name_locale.Enabled = true; txt_description_locale.Enabled = true; txt_uri.Enabled = true; chk_isFinal.Enabled = true; } if (_action == Action.INSERT) { cmb_agencies.Visible = true; txtAgenciesReadOnly.Visible = false; } else { cmb_agencies.Visible = false; txtAgenciesReadOnly.Visible = true; } SetStructureDetailPanel(); string categoryId = cat.CategoryReference.IdentifiableIds.First(); WSModel wsModel = new WSModel(); ISdmxObjects sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(cat.CategoryReference.MaintainableId, cat.CategoryReference.AgencyId, cat.CategoryReference.Version), false, false); ddlCategorySchemeList.Text = string.Format("{0}-{1}-{2}", cat.CategoryReference.MaintainableId, cat.CategoryReference.AgencyId, cat.CategoryReference.Version); ICategorySchemeObject currentCategoryScheme = sdmxInput.CategorySchemes.First(); txtSelectedCategory.Text = cat.CategoryReference.IdentifiableIds[0].ToString(); SdmxStructureEnumType type = cat.StructureReference.MaintainableStructureEnumType; switch (type) { case SdmxStructureEnumType.CodeList: ddlAvailableStructures.SelectedValue = "CODELIST"; break; case SdmxStructureEnumType.ConceptScheme: ddlAvailableStructures.SelectedValue = "CONCEPT_SCHEME"; break; case SdmxStructureEnumType.CategoryScheme: ddlAvailableStructures.SelectedValue = "CATEGORY_SCHEME"; break; case SdmxStructureEnumType.Dataflow: ddlAvailableStructures.SelectedValue = "DATAFLOW"; break; case SdmxStructureEnumType.Dsd: ddlAvailableStructures.SelectedValue = "KEY_FAMILY"; break; case SdmxStructureEnumType.AgencyScheme: ddlAvailableStructures.SelectedValue = "AGENCY_SCHEME"; break; case SdmxStructureEnumType.DataProviderScheme: ddlAvailableStructures.SelectedValue = "DATA_PROVIDER_SCHEME"; break; case SdmxStructureEnumType.DataConsumerScheme: ddlAvailableStructures.SelectedValue = "DATA_CONSUMER_SCHEME"; break; case SdmxStructureEnumType.OrganisationUnitScheme: ddlAvailableStructures.SelectedValue = "ORGANIZATION_UNIT_SCHEME"; break; case SdmxStructureEnumType.StructureSet: ddlAvailableStructures.SelectedValue = "STRUCTURE_SET"; break; case SdmxStructureEnumType.ContentConstraint: ddlAvailableStructures.SelectedValue = "CONTENT_CONSTRAINT"; break; } string structure = string.Format("{0}-{1}-{2}", cat.StructureReference.MaintainableId, cat.StructureReference.AgencyId, cat.StructureReference.Version); txtSelectedItem.Text = structure; Session["tmpCategoryReference"] = cat.CategoryReference.IdentifiableIds[0].ToString(); Session["tmpCategorySchemeReference"] = string.Format("{0}-{1}-{2}", currentCategoryScheme.Id, currentCategoryScheme.AgencyId, currentCategoryScheme.Version); Session["tmpKindOfStructure"] = ddlAvailableStructures.SelectedValue; Session["tmpReferenceOfTheObject"] = structure; txtSelectedCategory.Visible = true; lblSelectedCategory.Visible = true; txtSelectedItem.Visible = true; lblSelectedItem.Visible = true; //=========================================== }
protected void btnUploadFile_Click(object sender, EventArgs e) { if (uploadedFiles.HasFile) { User currentUser = Session[SESSION_KEYS.USER_DATA] as User; try { //ResetSdmxSession(); WSModel wsModel = new WSModel(); XmlDocument xDocStructure = new XmlDocument(); XmlDocument xDocMessage = new XmlDocument(); XmlDocument xRet; WSUtils utils = new WSUtils(); ISdmxObjects sdmxObjects; string FilePath = SaveFile(); // Carico il file in un XMLDOcument xDocStructure.Load(FilePath); // Carico l'XMLDocument in un SDMXObjects sdmxObjects = utils.GetSdmxObjectsFromXML(xDocStructure); List<ImportedItem> items = new List<ImportedItem>(); bool itemIsOk; foreach (ICodelistObject tmpCodeList in sdmxObjects.Codelists) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetCodeList(new ArtefactIdentity(tmpCodeList.Id, tmpCodeList.AgencyId, tmpCodeList.Version), true, false); if (checkedObject.Codelists.Count > 0) { ICodelistObject checkedCodelist = checkedObject.Codelists.First(); if (checkedCodelist.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpCodeList.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpCodeList), tmpCodeList.Id, tmpCodeList.AgencyId, tmpCodeList.Version, "CODELIST", itemIsOk)); } } foreach (IConceptSchemeObject tmpConceptScheme in sdmxObjects.ConceptSchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetConceptScheme(new ArtefactIdentity(tmpConceptScheme.Id, tmpConceptScheme.AgencyId, tmpConceptScheme.Version), true, false); if (checkedObject.ConceptSchemes.Count > 0) { IConceptSchemeObject checkedConcepScheme = checkedObject.ConceptSchemes.First(); if (checkedConcepScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpConceptScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpConceptScheme), tmpConceptScheme.Id, tmpConceptScheme.AgencyId, tmpConceptScheme.Version, "CONCEPT_SCHEME", itemIsOk)); } } foreach (ICategorySchemeObject tmpCategoryScheme in sdmxObjects.CategorySchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetCategoryScheme(new ArtefactIdentity(tmpCategoryScheme.Id, tmpCategoryScheme.AgencyId, tmpCategoryScheme.Version), true, false); if (checkedObject.CategorySchemes.Count > 0) { ICategorySchemeObject checkedCategoryScheme = checkedObject.CategorySchemes.First(); if (checkedCategoryScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpCategoryScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpCategoryScheme), tmpCategoryScheme.Id, tmpCategoryScheme.AgencyId, tmpCategoryScheme.Version, "CATEGORY_SCHEME", itemIsOk)); } } foreach (IDataStructureObject tmpDataStructure in sdmxObjects.DataStructures) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetDataStructure(new ArtefactIdentity(tmpDataStructure.Id, tmpDataStructure.AgencyId, tmpDataStructure.Version), true, false); if (checkedObject.DataStructures.Count > 0) { IDataStructureObject checkedDataStructure = checkedObject.DataStructures.First(); if (checkedDataStructure.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpDataStructure.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpDataStructure), tmpDataStructure.Id, tmpDataStructure.AgencyId, tmpDataStructure.Version, "DSD", itemIsOk)); } } foreach (IAgencyScheme tmpAgencyScheme in sdmxObjects.AgenciesSchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetAgencyScheme(new ArtefactIdentity(tmpAgencyScheme.Id, tmpAgencyScheme.AgencyId, tmpAgencyScheme.Version), true, false); if (checkedObject.AgenciesSchemes.Count > 0) { IAgencyScheme checkedAgencyScheme = checkedObject.AgenciesSchemes.First(); if (checkedAgencyScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpAgencyScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpAgencyScheme), tmpAgencyScheme.Id, tmpAgencyScheme.AgencyId, tmpAgencyScheme.Version, "AGENCY_SCHEME", itemIsOk)); } } foreach (IDataProviderScheme tmpDataProviderScheme in sdmxObjects.DataProviderSchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetDataProviderScheme(new ArtefactIdentity(tmpDataProviderScheme.Id, tmpDataProviderScheme.AgencyId, tmpDataProviderScheme.Version), true, false); if (checkedObject.DataProviderSchemes.Count > 0) { IDataProviderScheme checkedDataProviderScheme = checkedObject.DataProviderSchemes.First(); if (checkedDataProviderScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpDataProviderScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpDataProviderScheme), tmpDataProviderScheme.Id, tmpDataProviderScheme.AgencyId, tmpDataProviderScheme.Version, "DATA_PROVIDER_SCHEME", itemIsOk)); } } foreach (IDataConsumerScheme tmpDataConsumerScheme in sdmxObjects.DataConsumerSchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetDataConsumerScheme(new ArtefactIdentity(tmpDataConsumerScheme.Id, tmpDataConsumerScheme.AgencyId, tmpDataConsumerScheme.Version), true, false); if (checkedObject.DataConsumerSchemes.Count > 0) { IDataConsumerScheme checkedDataConsumerScheme = checkedObject.DataConsumerSchemes.First(); if (checkedDataConsumerScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpDataConsumerScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpDataConsumerScheme), tmpDataConsumerScheme.Id, tmpDataConsumerScheme.AgencyId, tmpDataConsumerScheme.Version, "DATA_CONSUMER_SCHEME", itemIsOk)); } } foreach (IOrganisationUnitSchemeObject tmpOrganizationUnitScheme in sdmxObjects.OrganisationUnitSchemes) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetOrganisationUnitScheme(new ArtefactIdentity(tmpOrganizationUnitScheme.Id, tmpOrganizationUnitScheme.AgencyId, tmpOrganizationUnitScheme.Version), true, false); if (checkedObject.OrganisationUnitSchemes.Count > 0) { IOrganisationUnitSchemeObject checkedOrganisationUnitScheme = checkedObject.OrganisationUnitSchemes.First(); if (checkedOrganisationUnitScheme.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpOrganizationUnitScheme.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpOrganizationUnitScheme), tmpOrganizationUnitScheme.Id, tmpOrganizationUnitScheme.AgencyId, tmpOrganizationUnitScheme.Version, "ORGANIZATION_UNIT_SCHEME", itemIsOk)); } } foreach (IContentConstraintObject tmpContentConstraint in sdmxObjects.ContentConstraintObjects) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetContentConstraint(new ArtefactIdentity(tmpContentConstraint.Id, tmpContentConstraint.AgencyId, tmpContentConstraint.Version), true, false); if (checkedObject.ContentConstraintObjects.Count > 0) { IContentConstraintObject checkedContentConstraint = checkedObject.ContentConstraintObjects.First(); if (checkedContentConstraint.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpContentConstraint.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpContentConstraint), tmpContentConstraint.Id, tmpContentConstraint.AgencyId, tmpContentConstraint.Version, "CONTENT_CONSTRAINT", itemIsOk)); } } foreach (IStructureSetObject tmpStructureSet in sdmxObjects.StructureSets) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetStructureSet(new ArtefactIdentity(tmpStructureSet.Id, tmpStructureSet.AgencyId, tmpStructureSet.Version), true, false); if (checkedObject.StructureSets.Count > 0) { IStructureSetObject checkedStructureSet = checkedObject.StructureSets.First(); if (checkedStructureSet.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpStructureSet.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpStructureSet), tmpStructureSet.Id, tmpStructureSet.AgencyId, tmpStructureSet.Version, "STRUCTURE_SET", itemIsOk)); } } foreach (IHierarchicalCodelistObject tmpHierarchicalCodelist in sdmxObjects.HierarchicalCodelists) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetHcl(new ArtefactIdentity(tmpHierarchicalCodelist.Id, tmpHierarchicalCodelist.AgencyId, tmpHierarchicalCodelist.Version), true, false); if (checkedObject.HierarchicalCodelists.Count > 0) { IHierarchicalCodelistObject checkedHierarchicalCodelist = checkedObject.HierarchicalCodelists.First(); if (checkedHierarchicalCodelist.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals( tmpHierarchicalCodelist.AgencyId.ToString() ) select agency).ToList<UserAgency>(); if ( foundAgency.Count > 0 ) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpHierarchicalCodelist), tmpHierarchicalCodelist.Id, tmpHierarchicalCodelist.AgencyId, tmpHierarchicalCodelist.Version, "HIERARCHICAL_CODELIST", itemIsOk)); } } foreach (ICategorisationObject tmpCatObj in sdmxObjects.Categorisations) { itemIsOk = true; try { ISdmxObjects checkedObject = wsModel.GetCategorisation(new ArtefactIdentity(tmpCatObj.Id, tmpCatObj.AgencyId, tmpCatObj.Version), true, false); if (checkedObject.Categorisations.Count > 0) { ICategorisationObject checkedCategorisation = checkedObject.Categorisations.First(); if (checkedCategorisation.IsFinal.IsTrue) { itemIsOk = false; } } } catch (Exception ex) { itemIsOk = true; } var foundAgency = (from agency in currentUser.agencies where agency.id.Equals(tmpCatObj.AgencyId.ToString()) select agency).ToList<UserAgency>(); if (foundAgency.Count > 0) { items.Add(new ImportedItem(localizedUtils.GetNameableName(tmpCatObj), tmpCatObj.Id, tmpCatObj.AgencyId, tmpCatObj.Version, "CATEGORISATION", itemIsOk)); } } Session[IMPORTED_ITEMS_STRING] = items; Session[IMPORTED_SDMX_OBJECT] = sdmxObjects; gridView.DataSource = items; gridView.DataBind(); if ( items.Count != 0 ) { btnConfirmImport.Visible = true; lblNoItemsAllowed.Visible = false; } else { Utils.AppendScript( "$('#chbSelectAll').hide();" ); lblSelectAll.Visible = false; lblNoItemsAllowed.Visible = true; btnConfirmImport.Visible = false; } Utils.AppendScript("openPopUp('importedItemsGridDiv', 600);"); } catch (Exception ex) { string msg; if (ex.InnerException != null) msg = ex.InnerException.Message; else msg = ex.Message; Utils.ShowDialog(msg); } } else { Utils.ShowDialog( Resources.Messages.err_no_file_uploaded ); } }
private ISdmxObjects GetSdmxObjects() { WSModel wsModel = new WSModel(); ISdmxObjects sdmxInput; ISdmxObjects sdmxFinal; IMutableObjects mutableObj = new MutableObjectsImpl(); LocalizedUtils localizedUtils = new LocalizedUtils(Utils.LocalizedCulture); sdmxFinal = new SdmxObjectsImpl(); try { sdmxInput = wsModel.GetCategoryScheme(new ArtefactIdentity(SearchBar1.ucID, SearchBar1.ucAgency, SearchBar1.ucVersion), true,true); if (SearchBar1.ucName.Trim() != string.Empty) { foreach (ICategorySchemeObject cs in sdmxInput.CategorySchemes) { if (localizedUtils.GetNameableName(cs).ToUpper().Contains(SearchBar1.ucName.Trim().ToUpper())) mutableObj.AddCategoryScheme(cs.MutableInstance); } sdmxFinal = mutableObj.ImmutableObjects; } else sdmxFinal = sdmxInput; } catch (Exception ex) { throw ex; } return sdmxFinal; }