Example #1
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);
                    }
                }
            }
        }
        // Add this node only with children
        // Also used by ModelControllers

        /// <summary>
        /// Initializes a new instance of the <see cref="CoITreeNodeLoader"/> class.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="_rootNodeTreeConfig">The root node tree configuration.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="vistedNodes">The visted nodes.</param>
        /// <param name="_nodeConfigMapping">The node configuration mapping.</param>
        /// <param name="_recordIdentifierInfoAreaConfigMapping">The record identifier information area configuration mapping.</param>
        public CoITreeNodeLoader(UPMCoINode node, UPConfigTreeViewTable _rootNodeTreeConfig, ViewReference viewReference, int depth,
                                 Dictionary <IIdentifier, UPMCoINode> vistedNodes, Dictionary <IIdentifier, UPConfigTreeViewTable> _nodeConfigMapping,
                                 Dictionary <string, CoITreeInfoAreaConfig> _recordIdentifierInfoAreaConfigMapping)
            : base(node, viewReference, depth, 1, vistedNodes)
        {
            this.childrenTreeConfig = _rootNodeTreeConfig;
            this.nodeConfigMapping  = _nodeConfigMapping;
            this.infoAreaConfigs    = new List <CoITreeInfoAreaConfig>();
            this.recordIdentifierInfoAreaConfigMapping = _recordIdentifierInfoAreaConfigMapping;

            if (!string.IsNullOrEmpty(this.childrenTreeConfig.SearchAndListName))
            {
                this.configName = this.childrenTreeConfig.SearchAndListName;
            }
            else if (this.childrenTreeConfig != null)
            {
                this.configName = this.childrenTreeConfig.ExpandName;
            }

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.expandSettings = configStore.ExpandByName(this.configName);
        }
 private bool IsRecordNode(UPConfigTreeViewTable treeTable)
 {
     return(!string.IsNullOrEmpty(treeTable.RecordCustomControl));
 }
Example #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);
            }
        }