예제 #1
0
        /// <summary>
        /// Builds the page.
        /// </summary>
        protected override void BuildPage()
        {
            base.BuildPage();
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string rootTreeNodeName             = this.ViewReference.ContextValueForKey("ConfigName");

            if (!string.IsNullOrEmpty(rootTreeNodeName))
            {
                this.rootTreeNode = configStore.TreeViewByName(rootTreeNodeName);
            }

            UPMCircleOfInfluencePage page = this.CreatePageInstance();

            this.TopLevelElement = page;
            if (this.rootTreeNode == null)
            {
                SimpleIoc.Default.GetInstance <ILogger>().LogError($"No treeView found for configName: {rootTreeNodeName}");
                return;
            }

            // Root FieldGroup
            string rootNodeExpandName = this.rootTreeNode.RootNode.ExpandName;

            this.ExpandSettings = configStore.ExpandByName(rootNodeExpandName) ??
                                  configStore.ExpandByName(this.InfoAreaId);

            List <FieldControl> fieldControler = new List <FieldControl>();
            FieldControl        details        = configStore.FieldControlByNameFromGroup("Details", this.ExpandSettings.FieldGroupName);

            if (details != null)
            {
                fieldControler.Add(details);
            }

            FieldControl miniDetails = configStore.FieldControlByNameFromGroup("MiniDetails", this.ExpandSettings.FieldGroupName);

            if (miniDetails != null)
            {
                fieldControler.Add(miniDetails);
            }

            if (fieldControler.Count > 0)
            {
                this.rootNodeFieldControl = new FieldControl(fieldControler);
            }

            this.ApplyViewConfigOnPage(page);
            page.Invalid = true;
            this.ApplyLoadingStatusOnPage(page);
            this.TopLevelElement = page;
        }
        private UPContainerMetaInfo CreateQueryWithRecordIdentifier(string recordIdentifier)
        {
            string childSearchAndListName         = this.childrenTreeConfig.SearchAndListName;
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(childSearchAndListName);
            UPContainerMetaInfo     metainfo      = this.CreateQueryLinkIdSearchAndList(recordIdentifier, this.childrenTreeConfig.LinkId, searchAndList);

            if (metainfo == null)
            {
                return(null);
            }

            if (this.childrenTreeConfig.RecordCount <= 0)
            {
                metainfo.MaxResults = 0;
            }
            else
            {
                metainfo.MaxResults = this.childrenTreeConfig.RecordCount - 1;
            }

            // Add additionalConfig for RecordNodeChilds
            foreach (UPConfigTreeViewTable childTree in this.childrenTreeConfig.ChildNodes)
            {
                if (this.IsRecordNode(childTree))
                {
                    string recordCustomControl = childTree.RecordCustomControl;
                    Dictionary <string, object> customControlDict = recordCustomControl.JsonDictionaryFromString();
                    string nodeType = customControlDict["Type"] as string;
                    if (nodeType.StartsWith("Tree:"))
                    {
                        CoITreeInfoAreaConfig infoAreaConfig = new CoITreeInfoAreaConfig
                        {
                            InfoAreaId = childTree.InfoAreaId,
                            LinkId     = childTree.LinkId
                        };
                        string           jumpTreeConfigName = nodeType.Substring(5);
                        UPConfigTreeView treeConfig         = configStore.TreeViewByName(jumpTreeConfigName);
                        infoAreaConfig.Config             = treeConfig.RootNode;
                        infoAreaConfig.FunctionNameSuffix = childTree.RelationName;
                        infoAreaConfig.Definition         = customControlDict;
                        this.infoAreaConfigs.Add(infoAreaConfig);
                    }
                    else if (nodeType.StartsWith("LinkNode"))
                    {
                        CoITreeInfoAreaConfig infoAreaConfig = new CoITreeInfoAreaConfig
                        {
                            InfoAreaId         = childTree.InfoAreaId,
                            LinkId             = childTree.LinkId,
                            Config             = childTree,
                            FunctionNameSuffix = childTree.RelationName,
                            Definition         = customControlDict
                        };
                        this.infoAreaConfigs.Add(infoAreaConfig);
                    }
                    else
                    {
                        SimpleIoc.Default.GetInstance <ILogger>().LogWarn($"UPCoITree cant handle nodeType: {nodeType}");
                    }
                }
            }

            return(metainfo);
        }