예제 #1
0
        /// <summary>
        /// Switches to edit.
        /// </summary>
        /// <param name="edge">The edge.</param>
        public override void SwitchToEdit(UPMCoIEdge edge)
        {
            string edgeRecordIdentification      = ((RecordIdentifier)edge.Identifier).RecordIdentification;
            string trgtNodeRecordIdentification  = ((RecordIdentifier)edge.TargetNodeIdentifier).RecordIdentification;
            CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[trgtNodeRecordIdentification];
            string editAction = infoAreaConfig.Definition.ValueOrDefault("EdgeEditAction") as string;

            editAction = !string.IsNullOrEmpty(editAction) ? editAction : "EDITRECORD";
            this.SwitchToRecord(edgeRecordIdentification, editAction, false, true, null);
        }
예제 #2
0
        /// <summary>
        /// Switches to detail.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        public override void SwitchToDetail(IIdentifier identifier)
        {
            bool switchToCoi = this.ViewReference.ContextValueForKey("SwitchToCoi") == "true";

            if (identifier is RecordIdentifier)
            {
                string recordIdentification          = ((RecordIdentifier)identifier).RecordIdentification;
                CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[recordIdentification];
                string editAction = infoAreaConfig.Definition.ValueOrDefault("NodeDetailAction") as string;
                editAction = !string.IsNullOrEmpty(editAction) ? editAction : "SHOWRECORD";
                this.SwitchToRecord(recordIdentification, editAction, true, false, switchToCoi ? new SwitchToFirstCoiIndex() : null);
            }
            else
            {
                // Switch to SearchAndList
                string searchAndListName = this.nodeIdConfigDict[identifier].SearchAndListName;
                if (!string.IsNullOrEmpty(searchAndListName))
                {
                    IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
                    SearchAndList           searchAndList = configStore.SearchAndListByName(searchAndListName);
                    if (searchAndList != null)
                    {
                        Dictionary <string, object> dictionary = new Dictionary <string, object>();
                        dictionary["ConfigName"] = searchAndListName;
                        dictionary["InfoArea"]   = searchAndList.InfoAreaId;
                        UPMCoINode            node = this.vistedNodes[identifier];
                        UPConfigTreeViewTable parentConfigTable = this.nodeIdConfigDict[node.Parent.Identifier];
                        if (!string.IsNullOrEmpty(node.Parent.RecordIdentification))
                        {
                            dictionary["LinkRecord"] = node.Parent.RecordIdentification;
                        }

                        if (parentConfigTable.LinkId > 0)
                        {
                            dictionary["LinkId"] = $"{parentConfigTable.LinkId}";
                        }

                        dictionary[Search.Constants.SwipeDetailRecordsConfigName] = "true";
                        string initialRquestOptionString = UPCRMDataStore.StringFromRequestOption(this.RequestOption);
                        if (!string.IsNullOrEmpty(initialRquestOptionString))
                        {
                            dictionary["InitialRequestOption"] = initialRquestOptionString;
                        }

                        UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(new ViewReference(dictionary, "RecordListView"));
                        this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
                    }
                }
            }
        }
        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);
        }
예제 #4
0
        /// <summary>
        /// Loads the next depth for node.
        /// </summary>
        /// <param name="node">The node.</param>
        protected override void LoadNextDepthForNode(UPMCoINode node)
        {
            if (this.RunningDepthLoader.Contains(node.Identifier))
            {
                return;
            }

            UPConfigTreeViewTable config = this.nodeIdConfigDict[node.Identifier];
            bool newLoader = false;

            if (!node.ChildsLoaded && config.ChildNodes.Count > 0)
            {
                this.RunningDepthLoader.Add(node.Identifier);
                foreach (UPConfigTreeViewTable childTree in config.ChildNodes)
                {
                    if (string.IsNullOrEmpty(childTree.RecordCustomControl))
                    {
                        CoITreeNodeLoader loader = new CoITreeNodeLoader(node, childTree, this.ViewReference, 0, this.vistedNodes, this.nodeIdConfigDict, this.recordIdentifierInfoAreaConfigMapping);
                        loader.Mode        = CoINodeLoaderMode.Reload;
                        loader.TheDelegate = this;
                        this.pendingNodeLoader.Add(loader);
                        this.pendingNodeLoaderCount++;
                        newLoader = true;
                    }
                    else
                    {
                        // Lade die subnode fields der infoAreaConfig
                        CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[((RecordIdentifier)node.Identifier).RecordIdentification];
                        if (childTree.LinkId == infoAreaConfig.LinkId && childTree.InfoAreaId == infoAreaConfig.InfoAreaId)
                        {
                            // Bei zwei Kinder mit InfoAreaConfig darf nicht zweimal eine Query auf PB gemacht werden
                            // Es darf nur die ausgeführt werden zu der diese Node passt
                            foreach (UPConfigTreeViewTable _childTree in infoAreaConfig.Config.ChildNodes)
                            {
                                if (string.IsNullOrEmpty(_childTree.RecordCustomControl))
                                {
                                    CoITreeNodeLoader loader = new CoITreeNodeLoader(node, _childTree, this.ViewReference, 0, this.vistedNodes, this.nodeIdConfigDict, this.recordIdentifierInfoAreaConfigMapping);
                                    loader.Mode        = CoINodeLoaderMode.Reload;
                                    loader.TheDelegate = this;
                                    this.pendingNodeLoader.Add(loader);
                                    this.pendingNodeLoaderCount++;
                                    newLoader = true;
                                }
                            }
                        }
                    }
                }

                foreach (CoITreeNodeLoader loader in this.pendingNodeLoader)
                {
                    loader.LoadNodeSubNodes();
                }

                if (!newLoader)
                {
                    node.ChildsLoaded = true;
                    this.InformAboutDidChangeTopLevelElement(this.Page, this.Page, new List <IIdentifier> {
                        node.Identifier
                    }, null);
                }
            }
            else
            {
                node.ChildsLoaded = true;
                this.InformAboutDidChangeTopLevelElement(this.Page, this.Page, new List <IIdentifier> {
                    node.Identifier
                }, null);
            }
        }