示例#1
0
 /// <summary>
 /// Add references to <paramref name="structureReferences"/>
 /// </summary>
 /// <param name="hcl">
 /// The HCL.
 /// </param>
 /// <param name="structureReferences">
 /// The structure references.
 /// </param>
 private static void AddReferences(IHierarchicalCodelistMutableObject hcl, ISet <IStructureReference> structureReferences)
 {
     if (hcl != null && !hcl.Stub)
     {
         foreach (ICodelistRefMutableObject codelistRefMutableObject in hcl.CodelistRef)
         {
             structureReferences.Add(codelistRefMutableObject.CodelistReference);
         }
     }
 }
 /// <summary>
 /// 
 /// </summary>
 private void GetHclFromSession()
 {
     if (Session[_snInsCC] != null)
         _hclMutable = (IHierarchicalCodelistMutableObject)Session[_snInsCC];
 }
        private void CreateEmptyHcl()
        {
            IHierarchicalCodelistMutableObject hclMutable;

            hclMutable = _sdmxUtils.buildHcl(_ntdString + "HCLS_ID", _ntdString + "AGENCY", _ntdCCVersion);
            hclMutable.AddName("en", _ntdString + "HCL_NAME");

            _hclMutable = hclMutable;

            SetHclToSession();

            //hcl.CodelistRef[0]   // CL Reference(N)

            //hcl.Hierarchies[0].HierarchicalCodeObjects[0].CodeReference   //ref del nodo corrente
            //hcl.Hierarchies[0].HierarchicalCodeObjects[0].CodeRefs[0] // ref dei nodi figlio
        }
        //TODO: Riscrivere con le corrette inizializzazioni
        /// <summary>
        /// Imposta il title della pagina con il DF selezionato
        /// </summary>
        //private void SetLabelDetail()
        //{
        //    lblDetail.Text = String.Format("DataFlow: {0}, {1}, {2}", _artIdentity.ID, _artIdentity.Agency, _artIdentity.Version);
        //}
        private void BindData()
        {
            IHierarchicalCodelistObject hcl = _sdmxObjects.HierarchicalCodelists.FirstOrDefault();

            if (hcl == null)
                return;

            if (_action == Action.VIEW)
            {
                _hclMutable = hcl.MutableInstance;
                SetHclToSession();
            }

            SetGeneralTab(hcl);
            SetHierarchyTab(hcl);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Org.Sdmxsource.Sdmx.Api.Exception.SdmxException.SetMessageResolver(new Org.Sdmxsource.Util.ResourceBundle.MessageDecoder());
            GetCodeList1.ucCLSelectedEH += new EventHandler<UserControls.GetCodeListEventArgs>(GetCodeList1_ucCLSelectedEH);

            _hclMutable = null;

            _sdmxUtils = new SDMXUtils();
            _localizedUtils = new LocalizedUtils(Utils.LocalizedCulture);
            _entityMapper = new EntityMapper(Utils.LocalizedLanguage);
            _artIdentity = Utils.GetIdentityFromRequest(Request);

            GetCodeList1.ucAddIconType = AddIconType.cross;

            SetAction();

            if (!IsPostBack)
            {
                CommonInit();
                CurrentEditingAction = EditingAction.Add;
                TreeView1.Nodes.Add(new TreeNode("root", "@root@"));
                TreeView1.Nodes[0].Selected = true;
            }

            EditingAction a = CurrentEditingAction;

            switch (_action)
            {
                case Action.INSERT:
                    SetInsertForm();
                    if (!Page.IsPostBack)
                    {
                        cmbAgencies.Items.Insert(0, new ListItem(String.Empty, String.Empty));
                        cmbAgencies.SelectedIndex = 0;
                    }
                    break;
                case Action.UPDATE:
                    SetEditForm();
                    break;
                case Action.VIEW:
                    SetViewForm();
                    Utils.ResetBeforeUnload();
                    break;
            }

            DuplicateArtefact1.ucStructureType = SdmxStructureEnumType.HierarchicalCodelist;
            DuplicateArtefact1.ucMaintanableArtefact = _hclMutable;
        }
        /// <summary>
        /// Handles the HierarchicalCodelist element child elements
        /// </summary>
        /// <param name="parent">
        /// The parent IHierarchicalCodelistMutableObject object
        /// </param>
        /// <param name="localName">
        /// The name of the current xml element
        /// </param>
        /// <returns>
        /// The <see cref="StructureReaderBaseV20.ElementActions"/>.
        /// </returns>
        private ElementActions HandleChildElements(IHierarchicalCodelistMutableObject parent, object localName)
        {
            ElementActions actions = null;
            if (NameTableCache.IsElement(localName, ElementNameTable.CodelistRef))
            {
                var codelistRefMutableCore = new CodelistRefMutableCore();
                parent.AddCodelistRef(codelistRefMutableCore);
                this._currentCodelistRef = codelistRefMutableCore;
                IReferenceInfo reference = new ReferenceInfo(SdmxStructureEnumType.CodeList);
                this._currentReference = reference;
                actions = this.BuildElementActions(codelistRefMutableCore, DoNothingComplex, HandleTextChildElement);
            }
            else if (NameTableCache.IsElement(localName, ElementNameTable.Hierarchy))
            {
                var hc = new HierarchyMutableCore();
                ParseAttributes(hc, this.Attributes);
                this._currentHierarchy = hc;
                
                //// TODO java 0.9.9 no isFinal 
                ////hc.IsFinal = Helper.TrySetFromAttribute(this.Attributes, AttributeNameTable.isFinal, hc.IsFinal);
                parent.AddHierarchies(hc);
                actions = this.AddNameableAction(hc, this.HandleChildElements);
            }

            return actions;
        }