private ICategorisationMutableObject GetCategorizationFromSession() { try { if (Session[KEY_PAGE_SESSION] == null) { if (_artIdentity.ToString() != string.Empty) { WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetCategorisation(_artIdentity, false, false); ICategorisationObject cat = sdmxObject.Categorisations.FirstOrDefault(); Session[KEY_PAGE_SESSION] = cat.MutableInstance; } else { throw new Exception(); } } return (ICategorisationMutableObject)Session[KEY_PAGE_SESSION]; } catch (Exception ex) { return null; } }
private bool SendQuerySubmit(ICodelistMutableObject cl) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); int indexOrder = 1; foreach (ICodeMutableObject code in cl.Items) { IEnumerable<IAnnotationMutableObject> annotations = (from a in code.Annotations where a.Type == "@ORDER@" select a).OfType<IAnnotationMutableObject>(); if (annotations.Count() > 0) { IAnnotationMutableObject annotation = annotations.First(); ITextTypeWrapperMutableObject iText = new TextTypeWrapperMutableCore(); iText.Value = (indexOrder++).ToString(); iText.Locale = "en"; annotation.Text.Clear(); annotation.Text.Add(iText); } else { code.AddAnnotation(GetAnnotationOrder(indexOrder++)); } lblCodeListDetail.Text = code.Names[0].Value ; } sdmxObjects.AddCodelist(cl.ImmutableInstance); WSModel modelCodeList = new WSModel(); XmlDocument result = modelCodeList.SubmitStructure(sdmxObjects); Utils.GetXMLResponseError(result); return true; } catch (Exception ex) { return false; } }
protected void btnDelete_Click(object sender, EventArgs e) { /* * 1. Faccio il retrieve dell'artefact da eliminare * 2. Ottengo un SDMXObjects * 3. Trasformo l'SDMXObjects in un oggetto xml * 4. Carico il template * 5. Cerco il tag "structures" nell'sdmxobjects che contiene l'artefatto da eliminare * 6. Inserisco il contenuto dello structure nel template * 7. Richiamo il metodo submitstructure per effettuare l'eliminazione * 8. Controllo il successo dell'eliminazione e rifaccio il DataBind() */ WSModel wsModel = new WSModel(); WSUtils wsUtils = new WSUtils(); ISdmxObjects sdmxObjects; XmlDocument xDocStructure; XmlDocument xDocTemplate; XmlDocument xDocResponse; try { //sdmxObjects = wsModel.GetCodeList(new ArtefactIdentity(ucID, ucAgency, ucVersion), true); sdmxObjects = GetSdmxObjects(); xDocStructure = wsUtils.GetXMLDocFromSdmxObjects(sdmxObjects, StructureOutputFormatEnumType.SdmxV21StructureDocument); //Carico il template xDocTemplate = new XmlDocument(); xDocTemplate.Load(Server.MapPath(@".\SdmxQueryTemplate\SubmitStructureDelete.xml")); // Il nodo root "Structure" del template XmlNode xTempStructNode = xDocTemplate.SelectSingleNode("//*[local-name()='Structures']"); // Aggiungo al template lo structure da eliminare xTempStructNode.InnerXml = xDocStructure.SelectSingleNode("//*[local-name()='Structures']").InnerXml; // Richiamo il SubmitStructure per effettuare la Delete xDocResponse = wsModel.SubmitStructure(xDocTemplate); string CheckError = Utils.GetXMLResponseError(xDocResponse); if (CheckError != String.Empty) { //Utils.ShowDialog(CheckError); Utils.ShowDialog( Resources.Messages.err_artefact_is_a_reference ); Utils.ForceBlackClosing(); return; } //Utils.ExecuteScript(Parent.Page, "location.reload();"); Utils.ReloadPage(); //ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "closePopup();", true); } catch (Exception ex) { Utils.AppendScript("closePopup();"); Utils.ShowDialog("An error occurred: " + ex.Message); } }
private bool SendQuerySubmit(IOrganisationUnitSchemeMutableObject ous) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); sdmxObjects.AddOrganisationUnitScheme(ous.ImmutableInstance); WSModel modelOrganizationUnitScheme = new WSModel(); XmlDocument result = modelOrganizationUnitScheme.SubmitStructure(sdmxObjects); Utils.GetXMLResponseError(result); return true; } catch (Exception ex) { return false; } }
public static void PopulateCmbAgencySchemes(DropDownList ddlAgencySchemes) { ddlAgencySchemes.Items.Clear(); WSModel dal = new WSModel(); //if (true) //{ // GetXmlAgencies(ddlAgencySchemes); // return; //} ISdmxObjects agencies = dal.GetAllAgencyScheme(false); if (agencies.AgenciesSchemes != null && agencies.AgenciesSchemes.Count > 0) { ISTATUtils.LocalizedUtils loc = new ISTATUtils.LocalizedUtils(Utils.LocalizedCulture); foreach (IAgencyScheme aScheme in agencies.AgenciesSchemes) { ListItem tmpItem = new ListItem(string.Format("{0}+{1}+{2}", aScheme.Id, aScheme.AgencyId, aScheme.Version)); ddlAgencySchemes.Items.Add(tmpItem); } } }
/// <summary> /// Salva la DSD nel registry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveDSD_Click(object sender, EventArgs e) { /* * 1. Aggiungo all'oggetto _dsdMutable: * Le info della General * La collection di Names * La Collecction delle Descriptions * La Primary Measure * Le Dimension sono presenti nell'oggetto _dsdMutable * I Gruppi sono presenti nell'oggetto _dsdMutable * Gli Attributes sono presenti nell'oggetto _dsdMutable * 2. Richiamo il metodo che prende in input un ISdmxObjects che richiama il SaveStructure * 3. Visualizzo un messaggio di conferma,resetto le Session e faccio un redirect alla lista delle DSD */ if (!ValidateDSDData()) return; try { _dsdMutable.Id = txtDSDID.Text; _dsdMutable.AgencyId = cmbAgencies.SelectedValue; _dsdMutable.Version = txtVersion.Text; _dsdMutable.Names.Clear(); foreach (ITextTypeWrapperMutableObject name in AddTextName.TextObjectList) { _dsdMutable.Names.Add(name); } _dsdMutable.Descriptions.Clear(); if (AddTextDescription.TextObjectList != null) { foreach (ITextTypeWrapperMutableObject descr in AddTextDescription.TextObjectList) { _dsdMutable.Descriptions.Add(descr); } } _dsdMutable.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); if (txtDSDURI.Text != String.Empty) _dsdMutable.Uri = new Uri(txtDSDURI.Text); if (txtValidFrom.Text != String.Empty) _dsdMutable.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (txtValidTo.Text != String.Empty) _dsdMutable.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); // PM string[] pmValues = txtConcept.Text.Substring(0, txtConcept.Text.IndexOf(" ")).Split(','); string pmConcept = txtConcept.Text.Substring(txtConcept.Text.LastIndexOf(" ") + 1); _dsdMutable.AddPrimaryMeasure(new StructureReferenceImpl(pmValues[1], pmValues[0], pmValues[2], SdmxStructureEnumType.Concept, pmConcept)); if (txtCodelist.Text != "") { string[] pmCLValues = txtCodelist.Text.Split(','); IRepresentationMutableObject rep = new RepresentationMutableCore(); rep.Representation = new StructureReferenceImpl(pmCLValues[1], pmCLValues[0], pmCLValues[2], SdmxStructureEnumType.CodeList, null); _dsdMutable.PrimaryMeasure.Representation = rep; } _dsdMutable.Annotations.Clear(); if (AnnotationGeneral.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneral.AnnotationObjectList) { _dsdMutable.AddAnnotation(annotation); } _dsdMutable.PrimaryMeasure.Annotations.Clear(); if (AnnotationPrimaryMeasure.AnnotationObjectList != null) foreach (var annotation in AnnotationPrimaryMeasure.AnnotationObjectList) { _dsdMutable.PrimaryMeasure.AddAnnotation(annotation); } SetDsdToSession(); WSModel wsModel = new WSModel(); XmlDocument xRet = wsModel.SubmitStructure(_sdmxObjects); string err = Utils.GetXMLResponseError(xRet); if (err != "") { Utils.ShowDialog(err); return; } Session[_snInsDSD] = null; Session[_snSdmxObjects] = null; //Utils.ShowDialog("Operation succesfully"); Utils.ResetBeforeUnload(); //Utils.ShowDialog(successMessage, 300); Utils.AppendScript("location.href='./KeyFamily.aspx';"); } catch (Exception ex) { Utils.ShowDialog(ex.Message); } }
/// <summary> /// Salva il DataFlow nel registry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveSS_Click(object sender, EventArgs e) { if (!ValidateSSData()) return; try { _ssMutable.Id = txtSSID.Text; _ssMutable.AgencyId = GetAgencyValue(); _ssMutable.Version = txtVersion.Text; _ssMutable.Names.Clear(); foreach (ITextTypeWrapperMutableObject name in AddTextName.TextObjectList) { _ssMutable.Names.Add(name); } _ssMutable.Descriptions.Clear(); if (AddTextDescription.TextObjectList != null) { foreach (ITextTypeWrapperMutableObject descr in AddTextDescription.TextObjectList) { _ssMutable.Descriptions.Add(descr); } } _ssMutable.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); if (txtURI.Text != String.Empty) _ssMutable.Uri = new Uri(txtURI.Text); if (txtValidFrom.Text != String.Empty) _ssMutable.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (txtValidTo.Text != String.Empty) _ssMutable.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); _ssMutable.Annotations.Clear(); if (AnnotationGeneral.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneral.AnnotationObjectList) { _ssMutable.AddAnnotation(annotation); } //string[] DSDValues = txtDSD.Text.Split(','); //IStructureReference dsdRef = new StructureReferenceImpl(DSDValues[1], //DSDValues[0], DSDValues[2], //SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd), //new string[] { _ntdString }); //_ssMutable.DataStructureRef = dsdRef; SetSSToSession(); WSModel wsModel = new WSModel(); XmlDocument xRet = wsModel.SubmitStructure(_sdmxObjects); string err = Utils.GetXMLResponseError(xRet); if (err != "") { Utils.ShowDialog(err); return; } Session[_snInsSS] = null; Session[_snSdmxObjects] = null; //Utils.ShowDialog("Operation succesfully"); Utils.ResetBeforeUnload(); Utils.AppendScript("location.href='./StructureSet.aspx';"); } catch (Exception ex) { Utils.ShowDialog(ex.Message); } }
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; }
private void PopulateAgenciesGrid() { WSModel wsModel = new WSModel(); LocalizedUtils localizedUtils = new LocalizedUtils(Utils.LocalizedCulture); string[] agencySchemeParts = cmbAgencies.SelectedItem.Text.Split('+'); string id = agencySchemeParts[0], agencyId = agencySchemeParts[1], version = agencySchemeParts[2]; IAgencyScheme agencyScheme = wsModel.GetAgencyScheme(new ArtefactIdentity(id, agencyId, version), false, true).AgenciesSchemes.FirstOrDefault(); List<AssociatedAgency> items = new List<AssociatedAgency>(); foreach (var agency in agencyScheme.Items) { items.Add(new AssociatedAgency(agency.Id, localizedUtils.GetNameableName(agency), localizedUtils.GetNameableDescription(agency), true)); } gridView.DataSource = items; gridView.DataBind(); List<string> agencies = null; if (Session[SESSION_KEYS.AGENCIES_TO_SET] == null) { agencies = new List<string>(); } else { agencies = Session[SESSION_KEYS.AGENCIES_TO_SET] as List<string>; } foreach (GridViewRow row in gridView.Rows) { if (((CheckBox)row.Cells[3].Controls[1]).Checked) { string currentAgency = ((Label)row.Cells[0].Controls[1]).Text; if (!agencies.Contains(currentAgency)) { agencies.Add(string.Format("{0}|{1}", currentAgency, cmbAgencies.SelectedItem.Text)); } } } Session[SESSION_KEYS.AGENCIES_TO_SET] = agencies; if (Page.IsPostBack) { Utils.AppendScript("openP('setAgencyDiv', 400 );"); } }
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';"); }
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 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; //=========================================== }
private bool SendQuerySubmit(ICategorisationMutableObject cat) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); /* int indexOrder = 1; foreach (ICodeMutableObject code in cl.Items) { IEnumerable<IAnnotationMutableObject> annotations = (from a in code.Annotations where a.Type == "@ORDER@" select a).OfType<IAnnotationMutableObject>(); IAnnotationMutableObject annotation = (annotations.Count() > 0) ? annotations.First() : GetAnnotationOrder(indexOrder++); code.AddAnnotation(annotation); lblCodeListDetail.Text = code.Names[0].Value ; }*/ sdmxObjects.AddCategorisation(cat.ImmutableInstance); WSModel modelCategorization = new WSModel(); XmlDocument result = modelCategorization.SubmitStructure(sdmxObjects); if (Utils.GetXMLResponseError(result) != "") { Utils.ShowDialog(Utils.GetXMLResponseError(result), 350, "Error"); return false; } return true; } catch (Exception ex) { throw ex; } }
/// <summary> /// Salva la HCL nel Registry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveHcl_Click(object sender, EventArgs e) { if (!ValidateHclData()) return; try { _hclMutable.Id = txtHclID.Text; _hclMutable.AgencyId = cmbAgencies.SelectedValue; _hclMutable.Version = txtVersion.Text; _hclMutable.Names.Clear(); foreach (ITextTypeWrapperMutableObject name in AddTextName.TextObjectList) { _hclMutable.Names.Add(name); } _hclMutable.Descriptions.Clear(); if (AddTextDescription.TextObjectList != null) { foreach (ITextTypeWrapperMutableObject descr in AddTextDescription.TextObjectList) { _hclMutable.Descriptions.Add(descr); } } _hclMutable.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); if (txtURI.Text != String.Empty) _hclMutable.Uri = new Uri(txtURI.Text); if (txtValidFrom.Text != String.Empty) _hclMutable.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (txtValidTo.Text != String.Empty) _hclMutable.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); _hclMutable.Annotations.Clear(); if (AnnotationGeneral.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneral.AnnotationObjectList) { _hclMutable.AddAnnotation(annotation); } SetHclToSession(); WSModel wsModel = new WSModel(); XmlDocument xRet = wsModel.SubmitStructure(_sdmxObjects); string err = Utils.GetXMLResponseError(xRet); if (err != "") { Utils.ShowDialog(err); return; } Session[_snInsCC] = null; Session[_snSdmxObjects] = null; Utils.ResetBeforeUnload(); Utils.AppendScript("location.href='./Hcl.aspx';"); } catch (Exception ex) { Utils.ShowDialog(ex.Message); } }
private bool SendQuerySubmit(ICategorySchemeMutableObject cs) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); for (int i = 0; i < cs.Annotations.Count; ) if (cs.Annotations[i].Type.Trim() == "CategoryScheme_node_order") cs.Annotations.RemoveAt(i); else i++; sdmxObjects.AddCategoryScheme(cs.ImmutableInstance); WSModel modelCategoryScheme = new WSModel(); XmlDocument result = modelCategoryScheme.SubmitStructure(sdmxObjects); if (Utils.GetXMLResponseError(result) != "") { Utils.ShowDialog(Utils.GetXMLResponseError(result), 350, "Error"); return false; } return true; } catch (Exception ex) { throw ex; } }
/// <summary> /// Salva il DataFlow nel registry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveDF_Click(object sender, EventArgs e) { /* * 1. Aggiungo all'oggetto _dfMutable: * Le info della General * La collection di Names * La Collecction delle Desctiptions * 2. Richiamo il metodo che prende in input un ISdmxObjects che richiama il SaveStructure * 3. Visualizzo un messaggio di conferma,resetto le Session e faccio un redirect alla lista delle DF */ if (!ValidateDFData()) return; try { _dfMutable.Id = txtDFID.Text; _dfMutable.AgencyId = GetAgencyValue(); _dfMutable.Version = txtVersion.Text; _dfMutable.Names.Clear(); foreach (ITextTypeWrapperMutableObject name in AddTextName.TextObjectList) { _dfMutable.Names.Add(name); } _dfMutable.Descriptions.Clear(); if (AddTextDescription.TextObjectList != null) { foreach (ITextTypeWrapperMutableObject descr in AddTextDescription.TextObjectList) { _dfMutable.Descriptions.Add(descr); } } _dfMutable.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); if (txtURI.Text != String.Empty) _dfMutable.Uri = new Uri(txtURI.Text); if (txtValidFrom.Text != String.Empty) _dfMutable.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (txtValidTo.Text != String.Empty) _dfMutable.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); _dfMutable.Annotations.Clear(); if (AnnotationGeneral.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneral.AnnotationObjectList) { _dfMutable.AddAnnotation(annotation); } string[] DSDValues = txtDSD.Text.Split(','); IStructureReference dsdRef = new StructureReferenceImpl(DSDValues[1], DSDValues[0], DSDValues[2], SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dsd), new string[] { _ntdString }); _dfMutable.DataStructureRef = dsdRef; SetDfToSession(); WSModel wsModel = new WSModel(); XmlDocument xRet = wsModel.SubmitStructure(_sdmxObjects); string err = Utils.GetXMLResponseError(xRet); if (err != "") { Utils.ShowDialog(err); return; } //Session[_snInsDf] = null; //Session[_snSdmxObjects] = null; //Utils.ShowDialog("Operation succesfully"); Utils.ResetBeforeUnload(); Utils.AppendScript("location.href='./DataFlow.aspx';"); } catch (Exception ex) { Utils.ShowDialog(ex.Message); } }
private bool SendQuerySubmit(IDataConsumerSchemeMutableObject dataConsumerScheme) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); sdmxObjects.AddDataConsumerScheme(dataConsumerScheme.ImmutableInstance); WSModel modelDataConsumerScheme = new WSModel(); XmlDocument result = modelDataConsumerScheme.SubmitStructure(sdmxObjects); Utils.GetXMLResponseError(result); return true; } catch (Exception ex) { return false; } }
private IAgencySchemeMutableObject GetAgencySchemeFromSession() { try { if (Session[KEY_PAGE_SESSION] == null) { if (_artIdentity.ToString() != string.Empty) { WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetAgencyScheme(_artIdentity, false,false); IAgencyScheme agencyScheme = sdmxObject.AgenciesSchemes.FirstOrDefault(); Session[KEY_PAGE_SESSION] = agencyScheme.MutableInstance; } else { throw new Exception(); } } return (IAgencySchemeMutableObject)Session[KEY_PAGE_SESSION]; } catch (Exception ex) { return null; } }
private ISdmxObjects GetCatObjects() { try { WSModel wsModel = new WSModel(); return wsModel.GetAllCategorisation(false); } catch (Exception ex) { return null; } }
private IOrganisationUnitSchemeMutableObject GetOrganizationUnitSchemeFromSession() { try { if (Session[KEY_PAGE_SESSION] == null) { if (_artIdentity.ToString() != string.Empty) { WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetOrganisationUnitScheme(_artIdentity, false,false); IOrganisationUnitSchemeObject ous = sdmxObject.OrganisationUnitSchemes.FirstOrDefault(); Session[KEY_PAGE_SESSION] = ous.MutableInstance; } else { throw new Exception(); } } return (IOrganisationUnitSchemeMutableObject)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; }
public static void PopulateCmbAgencies(DropDownList ddlAgencies, bool excludeAgenciesForUser) { ddlAgencies.Items.Clear(); if (HttpContext.Current.Session[SESSION_KEYS.USER_OK] != null && ((bool)HttpContext.Current.Session[SESSION_KEYS.USER_OK]) == true && excludeAgenciesForUser) { User currentUser = HttpContext.Current.Session[SESSION_KEYS.USER_DATA] as User; string currentLanguageSession = HttpContext.Current.Session[SESSION_KEYS.KEY_LANG] as string; if (currentUser != null) { List<UserAgency> currentUserAgencies = currentUser.agencies.ToList<UserAgency>(); List<UserAgency> currentUserAgenciesForCurrentLanguage = currentUser.agencies.Where<UserAgency>(currentAgency => currentAgency.lang.Equals(currentLanguageSession)).ToList<UserAgency>(); List<UserAgency> currentUserAgenciesForDifferentLanguages = currentUser.agencies.Where<UserAgency>(currentAgency => !currentAgency.lang.Equals(currentLanguageSession)).ToList<UserAgency>(); List<string> agenciesAlreadyAdded = new List<string>(); foreach (UserAgency ag in currentUserAgenciesForCurrentLanguage) { string currentAgencyId = ag.id; ListItem tmpItem = null; //if (!ag.text.Trim().Equals(string.Empty)) //{ // tmpItem = new ListItem(string.Format("{0} - {1}", ag.id, ag.text)); //} //else //{ tmpItem = new ListItem(ag.id); //} ddlAgencies.Items.Add(tmpItem); agenciesAlreadyAdded.Add(currentAgencyId); } foreach (UserAgency ag in currentUserAgenciesForDifferentLanguages) { string currentAgencyId = ag.id; ListItem tmpItem = tmpItem = new ListItem(ag.id); if (!agenciesAlreadyAdded.Contains(currentAgencyId)) { ddlAgencies.Items.Add(tmpItem); agenciesAlreadyAdded.Add(currentAgencyId); } } } } else { WSModel dal = new WSModel(); //if (true) //{ // GetXmlAgencies(ddlAgencies); // return; //} ISdmxObjects agencies; try { agencies = dal.GetAllAgencyScheme(false); } catch (Exception ex) { if (ex.Message == "Not Implemented") return; throw ex; } if (agencies.AgenciesSchemes != null && agencies.AgenciesSchemes.Count > 0) { ISTATUtils.LocalizedUtils loc = new ISTATUtils.LocalizedUtils(Utils.LocalizedCulture); foreach (IAgencyScheme aScheme in agencies.AgenciesSchemes) { foreach (IAgency ag in aScheme.Items) { ListItem tmpItem = null; string agencyDescription = loc.GetNameableDescription(ag); if (agencyDescription.Trim().Equals(string.Empty)) { tmpItem = new ListItem(ag.Id); } else { tmpItem = new ListItem(string.Format("{0} - {1}", ag.Id, agencyDescription)); } if (!ddlAgencies.Items.Contains(tmpItem)) { ddlAgencies.Items.Add(tmpItem); } } } } } }
private ISdmxObjects GetSdmxObjectsWithRef() { ISdmxObjects sdmxObjects; ISdmxObjects sdmxObjectsTemp; bool stub; WSModel dal = new WSModel(); sdmxObjects = GetSdmxObjects(); stub = (GetDotSTATExportType() == DotStatExportType.DSD); foreach (IDimension dim in sdmxObjects.DataStructures.First().DimensionList.Dimensions) { if (dim.HasCodedRepresentation()) { var rep = dim.Representation.Representation; sdmxObjectsTemp = dal.GetCodeList(new ArtefactIdentity(rep.MaintainableId, rep.AgencyId, rep.Version), stub,false); sdmxObjects.AddCodelist(sdmxObjectsTemp.Codelists.First()); } } foreach (IAttributeObject att in sdmxObjects.DataStructures.First().Attributes) { if (att.HasCodedRepresentation()) { var rep = att.Representation.Representation; sdmxObjectsTemp = dal.GetCodeList(new ArtefactIdentity(rep.MaintainableId, rep.AgencyId, rep.Version), stub,false); sdmxObjects.AddCodelist(sdmxObjectsTemp.Codelists.First()); } } return sdmxObjects; }
private ICodelistMutableObject GetCodeListFromSession() { try { if (Session[KEY_PAGE_SESSION] == null) { if (_artIdentity.ToString() != string.Empty) { WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetCodeList(_artIdentity, false,false); ICodelistObject cl = sdmxObject.Codelists.FirstOrDefault(); ICodelistMutableObject codelistMutableObject = cl.MutableInstance; var sortedCodes = codelistMutableObject.Items.OrderBy<ICodeMutableObject, int>( o => { var corder = o.Annotations.FirstOrDefault(mutableObject => string.Equals(mutableObject.Type, "@ORDER@")); return corder != null ? int.Parse(corder.Text[0].Value) : 0; }).ToArray(); codelistMutableObject.Items.Clear(); foreach (ICodeMutableObject code in sortedCodes) { codelistMutableObject.Items.Add(code); } //codelistMutableObject.Items.Add(sortedCodes); //var sortedCodes = codelistMutableObject.Items.OrderBy<ICode, int>(o => //{ // var corder = o.Annotations.FirstOrDefault(mutableObject => string.Equals(mutableObject.Type, "@ORDER@")); // return corder != null ? int.Parse(corder.Text[0].Value) : 0; //}).ToArray(); Session[KEY_PAGE_SESSION] = codelistMutableObject; //Session[KEY_PAGE_SESSION] = cl.MutableInstance; } else { throw new Exception(); } } return (ICodelistMutableObject)Session[KEY_PAGE_SESSION]; } catch (Exception ex) { return null; } }
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.GetDataFlow(new ArtefactIdentity(SearchBar1.ucID, SearchBar1.ucAgency, SearchBar1.ucVersion, ucIsFinalArtefact), true, true); if (SearchBar1.ucName.Trim() != string.Empty) { foreach (IDataflowObject df in sdmxInput.Dataflows) { if (localizedUtils.GetNameableName(df).Contains(SearchBar1.ucName.Trim())) mutableObj.AddDataflow(df.MutableInstance); } sdmxFinal = mutableObj.ImmutableObjects; } else sdmxFinal = sdmxInput; } catch (Exception ex) { throw ex; } return sdmxFinal; }
protected void btnNewCodeOnFinalStructure_Click(object sender, EventArgs e) { string id = txt_id.Text; string agency = txtAgenciesReadOnly.Text; string[] tmpVersionParts = txt_version.Text.Split( '.' ); bool[] versionsAvailable = { tmpVersionParts.Length > 0, tmpVersionParts.Length > 1, tmpVersionParts.Length > 2 }; int v1 = (versionsAvailable[0] ? Convert.ToInt32( tmpVersionParts[0] ) : 0 ); int v2 = (versionsAvailable[1] ? Convert.ToInt32( tmpVersionParts[1] ) : 0 ); int v3 = (versionsAvailable[2] ? Convert.ToInt32( tmpVersionParts[2] ) : 0 ); EndPointElement epe = (EndPointElement)Session["CurrentEndPointObject"]; WSClient wsClient = new WSClient(epe.IREndPoint); Service1SoapClient client = wsClient.GetClient(); // Recupero l'id della codelist int foundCodelistId = 0, foundParentCodeId = 0, insertedCodeId = 0, foundLocalizedNameStringId = 0, foundLocalizedDescStringId = 0; client.GetCodelistId( id, agency, versionsAvailable[0], v1, versionsAvailable[1], v2, versionsAvailable[2], v3, ref foundCodelistId ); string codeId = txt_id_new.Text.Trim(), parentCode = txt_parentid_new.Text.Trim(), codeOrder = txt_order_new.Text.Trim(); #region CODE ID if ( !ValidationUtils.CheckIdFormat( codeId ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_id_format; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return ; } #endregion #region CODE NAMES if ((AddTextName_new.TextObjectList == null) || (AddTextName_new.TextObjectList != null && AddTextName_new.TextObjectList.Count == 0 ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_list_name_format; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } #endregion #region PARANT ID if ( codeId.Equals( parentCode ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_parent_id_same_value; Utils.AppendScript( "openPopUp('df-Dimension-update', 600 );" ); Utils.AppendScript("location.href= '#codes';"); return; } #endregion #region CODE ORDER int tmpOrder = 0; if (!codeOrder.Equals(string.Empty) && !int.TryParse( codeOrder, out tmpOrder ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_order_format_invalid; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } else { if ( tmpOrder < 0 ) { lblErrorOnNewInsert.Text = Resources.Messages.err_order_less_than_zero; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } } #endregion if ( !client.GetDsdCodeId( foundCodelistId, parentCode, ref foundParentCodeId ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_while_retrieving_code; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } if ( !client.InsertDsdCode( codeId, foundCodelistId.ToString(), foundParentCodeId, ref insertedCodeId ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_while_inserting_code; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } if ( AddTextName_new.TextObjectList != null ) { foreach ( var name in AddTextName_new.TextObjectList ) { if ( !client.InsertLocalizedString( insertedCodeId, name.Value, "Name", name.Locale, ref foundLocalizedNameStringId ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_while_inserting_code_name; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } } } if ( AddTextDescription_new.TextObjectList != null ) { foreach ( var desc in AddTextDescription_new.TextObjectList ) { if ( !client.InsertLocalizedString( insertedCodeId, desc.Value, "Desc", desc.Locale, ref foundLocalizedDescStringId ) ) { lblErrorOnNewInsert.Text = Resources.Messages.err_while_inserting_code_desc; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#codes';"); return; } } } txt_id_new.Text = string.Empty; txt_parentid_new.Text = string.Empty; AddTextDescription_new.ClearTextObjectListWithOutJS(); AddTextName_new.ClearTextObjectListWithOutJS(); WSModel wsModel = new WSModel(); ISdmxObjects sdmxObject = wsModel.GetCodeList(_artIdentity, false,false); ICodelistObject cl = sdmxObject.Codelists.FirstOrDefault(); Session[KEY_PAGE_SESSION] = cl.MutableInstance; BindData(); Utils.AppendScript("location.href= '#codes';"); }
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.GetOrganisationUnitScheme(new ArtefactIdentity(SearchBar1.ucID, SearchBar1.ucAgency, SearchBar1.ucVersion), true,true); if (SearchBar1.ucName.Trim() != string.Empty) { foreach (IOrganisationUnitSchemeObject ous in sdmxInput.OrganisationUnitSchemes) { if (localizedUtils.GetNameableName(ous).ToUpper().Contains(SearchBar1.ucName.Trim().ToUpper())) mutableObj.AddOrganisationUnitScheme(ous.MutableInstance); } sdmxFinal = mutableObj.ImmutableObjects; } else sdmxFinal = sdmxInput; } catch (Exception ex) { throw ex; } return sdmxFinal; }
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; }
protected void btnConfirmImport_Click(object sender, EventArgs e) { bool oneRowIsOk = false; GridViewRowCollection rows = gridView.Rows; foreach (GridViewRow row in rows) { if (((CheckBox)row.Cells[4].Controls[1]).Checked) { oneRowIsOk = true; break; } } if (oneRowIsOk) { WSModel wsModel = new WSModel(); XmlDocument xDocStructure = new XmlDocument(); XmlDocument xDocMessage = new XmlDocument(); XmlDocument xRet; WSUtils utils = new WSUtils(); List<ImportedItem> myItems = Session[IMPORTED_ITEMS_STRING] as List<ImportedItem>; ISdmxObjects sdmxObjects = (ISdmxObjects)Session[IMPORTED_SDMX_OBJECT]; ISdmxObjects newSdmxObjects = new SdmxObjectsImpl(); List<ImportedItem> reportItems = new List<ImportedItem>(); string objectsSummary = string.Empty; foreach (GridViewRow row in gridView.Rows) { string currentId = ((Label)row.Cells[0].Controls[1]).Text; string currentAgency = ((Label)row.Cells[1].Controls[1]).Text; string currentVersion = ((Label)row.Cells[2].Controls[1]).Text; ImportedItem myCurrentItem = myItems.Find(item => item.ID.Equals(currentId) && item.Agency.Equals(currentAgency) && item.Version.Equals(currentVersion)); if (((CheckBox)row.Cells[4].Controls[1]).Checked) { switch (myCurrentItem._type) { case "CODELIST": ICodelistObject tmpCodeList = sdmxObjects.Codelists.First(codelist => codelist.Id.Equals(currentId) && codelist.AgencyId.Equals(currentAgency) && codelist.Version.Equals(currentVersion)); newSdmxObjects.AddCodelist(tmpCodeList); objectsSummary += string.Format(Resources.Messages.msg_codelist_imported, tmpCodeList.Id, tmpCodeList.AgencyId, tmpCodeList.Version); break; case "CONCEPT_SCHEME": IConceptSchemeObject tmpConceptScheme = sdmxObjects.ConceptSchemes.First(conceptScheme => conceptScheme.Id.Equals(currentId) && conceptScheme.AgencyId.Equals(currentAgency) && conceptScheme.Version.Equals(currentVersion)); newSdmxObjects.AddConceptScheme(tmpConceptScheme); objectsSummary += string.Format(Resources.Messages.msg_concept_scheme_imported, tmpConceptScheme.Id, tmpConceptScheme.AgencyId, tmpConceptScheme.Version); break; case "CATEGORY_SCHEME": ICategorySchemeObject tmpCategoryScheme = sdmxObjects.CategorySchemes.First(categoryScheme => categoryScheme.Id.Equals(currentId) && categoryScheme.AgencyId.Equals(currentAgency) && categoryScheme.Version.Equals(currentVersion)); newSdmxObjects.AddCategoryScheme(tmpCategoryScheme); objectsSummary += string.Format(Resources.Messages.msg_category_scheme_imported, tmpCategoryScheme.Id, tmpCategoryScheme.AgencyId, tmpCategoryScheme.Version); break; case "DSD": IDataStructureObject tmpDataStructure = sdmxObjects.DataStructures.First(dataStructure => dataStructure.Id.Equals(currentId) && dataStructure.AgencyId.Equals(currentAgency) && dataStructure.Version.Equals(currentVersion)); newSdmxObjects.AddDataStructure(tmpDataStructure); objectsSummary += string.Format(Resources.Messages.msg_data_structure_imported, tmpDataStructure.Id, tmpDataStructure.AgencyId, tmpDataStructure.Version); break; case "AGENCY_SCHEME": IAgencyScheme tmpAgencyScheme = sdmxObjects.AgenciesSchemes.First(agencyScheme => agencyScheme.Id.Equals(currentId) && agencyScheme.AgencyId.Equals(currentAgency) && agencyScheme.Version.Equals(currentVersion)); newSdmxObjects.AddAgencyScheme(tmpAgencyScheme); objectsSummary += string.Format(Resources.Messages.msg_agency_scheme_imported, tmpAgencyScheme.Id, tmpAgencyScheme.AgencyId, tmpAgencyScheme.Version); break; case "DATA_PROVIDER_SCHEME": IDataProviderScheme tmpDataProviderScheme = sdmxObjects.DataProviderSchemes.First(dataProviderScheme => dataProviderScheme.Id.Equals(currentId) && dataProviderScheme.AgencyId.Equals(currentAgency) && dataProviderScheme.Version.Equals(currentVersion)); newSdmxObjects.AddDataProviderScheme(tmpDataProviderScheme); objectsSummary += string.Format(Resources.Messages.msg_data_provider_scheme_imported, tmpDataProviderScheme.Id, tmpDataProviderScheme.AgencyId, tmpDataProviderScheme.Version); break; case "DATA_CONSUMER_SCHEME": IDataConsumerScheme tmpDataConsumerScheme = sdmxObjects.DataConsumerSchemes.First(dataConsumerScheme => dataConsumerScheme.Id.Equals(currentId) && dataConsumerScheme.AgencyId.Equals(currentAgency) && dataConsumerScheme.Version.Equals(currentVersion)); newSdmxObjects.AddDataConsumerScheme(tmpDataConsumerScheme); objectsSummary += string.Format(Resources.Messages.msg_data_consumer_scheme_imported, tmpDataConsumerScheme.Id, tmpDataConsumerScheme.AgencyId, tmpDataConsumerScheme.Version); break; case "ORGANIZATION_UNIT_SCHEME": IOrganisationUnitSchemeObject tmpOrganizationUnitScheme = sdmxObjects.OrganisationUnitSchemes.First(organizationUnitScheme => organizationUnitScheme.Id.Equals(currentId) && organizationUnitScheme.AgencyId.Equals(currentAgency) && organizationUnitScheme.Version.Equals(currentVersion)); newSdmxObjects.AddOrganisationUnitScheme(tmpOrganizationUnitScheme); objectsSummary += string.Format(Resources.Messages.msg_organization_unit_scheme_imported, tmpOrganizationUnitScheme.Id, tmpOrganizationUnitScheme.AgencyId, tmpOrganizationUnitScheme.Version); break; case "STRUCTURE_SET": IStructureSetObject tmpStructureSet = sdmxObjects.StructureSets.First(structureSet => structureSet.Id.Equals(currentId) && structureSet.AgencyId.Equals(currentAgency) && structureSet.Version.Equals(currentVersion)); newSdmxObjects.AddStructureSet(tmpStructureSet); objectsSummary += string.Format(Resources.Messages.msg_structure_set_imported, tmpStructureSet.Id, tmpStructureSet.AgencyId, tmpStructureSet.Version); break; case "CONTENT_CONSTRAINT": IContentConstraintObject tmpContentConstraint = sdmxObjects.ContentConstraintObjects.First(contentConstraint => contentConstraint.Id.Equals(currentId) && contentConstraint.AgencyId.Equals(currentAgency) && contentConstraint.Version.Equals(currentVersion)); newSdmxObjects.AddContentConstraintObject(tmpContentConstraint); objectsSummary += string.Format(Resources.Messages.msg_content_constraint_imported, tmpContentConstraint.Id, tmpContentConstraint.AgencyId, tmpContentConstraint.Version); break; case "HIERARCHICAL_CODELIST": IHierarchicalCodelistObject tmpHierarchicalCodelist = sdmxObjects.HierarchicalCodelists.First(hierarchicalCodelist => hierarchicalCodelist.Id.Equals(currentId) && hierarchicalCodelist.AgencyId.Equals(currentAgency) && hierarchicalCodelist.Version.Equals(currentVersion)); newSdmxObjects.AddHierarchicalCodelist(tmpHierarchicalCodelist); objectsSummary += string.Format(Resources.Messages.msg_hierarchical_codelist_imported, tmpHierarchicalCodelist.Id, tmpHierarchicalCodelist.AgencyId, tmpHierarchicalCodelist.Version); break; case "CATEGORISATION": ICategorisationObject tmpCategorisation = sdmxObjects.Categorisations.First(cat => cat.Id.Equals(currentId) && cat.AgencyId.Equals(currentAgency) && cat.Version.Equals(currentVersion)); newSdmxObjects.AddCategorisation(tmpCategorisation); objectsSummary += string.Format(Resources.Messages.msg_categorisation_imported, tmpCategorisation.Id, tmpCategorisation.AgencyId, tmpCategorisation.Version); break; } reportItems.Add(myCurrentItem); } } Session[REPORT_ITEMS] = reportItems; // Carico l'SDMXObject in un XML Message da passare al WS //xDocMessage = utils.GetXmlMessage(newSdmxObjects); newSdmxObjects = PopolateAnnotationID(newSdmxObjects); //Richiamo il metodo SubmitStructure per l'inserimento nel DB try { xRet = wsModel.SubmitStructure(newSdmxObjects); } catch (Exception ex) { Utils.ShowDialog(ex.Message); Utils.ForceBlackClosing(); return; } string CheckError = Utils.GetXMLResponseError(xRet); if (CheckError != String.Empty) { Utils.ShowDialog(CheckError); Utils.ForceBlackClosing(); return; } // lblInfo.Text = CreateArtefactImportedString(sdmxObjects); lblInfo.Text = objectsSummary; gridView.DataSource = null; gridView.DataBind(); } else { Utils.ShowDialog( Resources.Messages.err_at_least_one_row ); Utils.AppendScript("openPopUp('importedItemsGridDiv', 600);"); return; } Utils.AppendScript("openPopUp('dialog-form', 600);"); /*gridView.DataSource = myItems; gridView.DataBind();*/ }