Esempio n. 1
0
        protected override bool Retrieve(IPersistence persistence, ref ePersistence phase)
        {
            base.Retrieve(persistence, ref phase);
            switch (phase)
            {
            case ePersistence.Initial:
                DataPersistence.Retrieve(persistence);

                string json = persistence.GetFieldValue(Constants.ModelDatasource, "");
                if (json != "")
                {
                    Dictionary <string, List <string> > fromJson = JsonConvert.DeserializeObject <Dictionary <string, List <string> > >(json);
                    foreach (string key in fromJson.Keys)
                    {
                        IMapping mapping = new IMappingImpl();
                        mapping.DecisionModelNode = Tree.GetNodeByReference(key);
                        mapping.FromStringArray(fromJson[key]);

                        DecisionModelDataSources.Add(mapping);
                    }
                }

                break;
            }

            return(true);
        }
Esempio n. 2
0
        protected override void DoDeactivate()
        {
            _DataObject.DecisionModelDataSources.Clear();
            foreach (TreeNode node in Root.Nodes)
            {
                IMapping mapping = new IMappingImpl();
                mapping.DecisionModelNode = node.Tag as IBaseNode;

                foreach (TreeNode tn in node.Nodes)
                {
                    mapping.ExportMaps.Add(tn.Tag as IDataDefinitionExport);
                }

                _DataObject.DecisionModelDataSources.Add(mapping);
            }

            conf.Save();
        }