コード例 #1
0
        private void FillPageWithResult(UPCRMResult result)
        {
            this.vistedNodes      = new Dictionary <IIdentifier, UPMCoINode>();
            this.nodeIdConfigDict = new Dictionary <IIdentifier, UPConfigTreeViewTable>();

            // Root Node Query
            if (result.RowCount == 1)
            {
                UPCRMResultRow row      = (UPCRMResultRow)result.ResultRowAtIndex(0);
                UPMCoINode     rootNode = CoITreeNodeLoader.CreateNodeFromResultRow(row, 0, this.expandChecker, null, null);
                this.vistedNodes[rootNode.Identifier]      = rootNode;
                this.nodeIdConfigDict[rootNode.Identifier] = this.rootTreeNode.RootNode;

                // Only root configured
                if (this.rootTreeNode.RootNode.ChildNodes.Count == 0)
                {
                    UPMCircleOfInfluencePage newPage = this.CreatePageInstance();
                    newPage.RootNode       = rootNode;
                    newPage.Invalid        = false;
                    newPage.ConfigProvider = ((UPMCircleOfInfluencePage)this.Page).ConfigProvider;
                    UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page;
                    this.TopLevelElement = newPage;
                    this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null);
                }

                foreach (UPConfigTreeViewTable childTree in this.rootTreeNode.RootNode.ChildNodes)
                {
                    CoITreeNodeLoader nodeLoader = new CoITreeNodeLoader(rootNode, childTree, this.ViewReference, 0, this.vistedNodes, this.nodeIdConfigDict, this.recordIdentifierInfoAreaConfigMapping);
                    nodeLoader.TheDelegate = this;
                    nodeLoader.Mode        = CoINodeLoaderMode.InitialLoad;
                    this.pendingNodeLoader.Add(nodeLoader);
                    this.pendingNodeLoaderCount++;
                }
                // TODO: This is buggy and will be implemented in CRM-5621

                /*
                 * foreach (CoITreeNodeLoader _loader in this.pendingNodeLoader)
                 * {
                 *  _loader.LoadNodeSubNodes();
                 * }
                 */
            }
            else
            {
                // Request Mode Offline and jump To Online Node
                if (result.RowCount == 0 && this.RequestOption == UPRequestOption.Offline)
                {
                    // Offline Configured and Online Record
                    UPMCircleOfInfluencePage newPage = this.CreatePageInstance();
                    newPage.Status = UPMMessageStatus.MessageStatusWithMessageDetails(string.Empty, LocalizedString.TextOfflineNotAvailable);
                    UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page;
                    this.TopLevelElement = newPage;
                    this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Loads the node sub nodes.
        /// </summary>
        public override void LoadNodeSubNodes()
        {
            this.tmpGroupNode = null;
            string recordIdentification = this.RootNode.GroupNode
                ? ((RecordIdentifier)this.RootNode.Parent.Identifier).RecordIdentification
                : ((RecordIdentifier)this.RootNode.Identifier).RecordIdentification;

            if ((this.childrenTreeConfig.Flags & UPConfigTreeViewTableFlags.HideGroupNode) > 0 || this.RootNode.GroupNode)
            {
                UPContainerMetaInfo query = this.CreateQueryWithRecordIdentifier(recordIdentification);
                if (query != null)
                {
                    query.Find(this.requestOption, this);
                }
                else
                {
                    SimpleIoc.Default.GetInstance <ILogger>().LogWarn("Nodes not loaded. SearchAndList missing?");
                    this.TheDelegate.NodesLoadFailedError(this, null);
                }
            }
            else
            {
                // Create static Group Nodes
                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

                // Create Node
                // id ParentNodeId + SearchAndListName
                string idString = $"Node {this.childrenTreeConfig.SearchAndListName}, {recordIdentification}";
                this.tmpGroupNode        = new UPMCoINode(StringIdentifier.IdentifierWithStringId(idString));
                this.tmpGroupNode.Parent = this.RootNode;
                UPMStringField titleField = new UPMStringField(StringIdentifier.IdentifierWithStringId($"Title {this.childrenTreeConfig.SearchAndListName}"));
                titleField.StringValue = this.childrenTreeConfig.Label;
                List <UPMStringField> fields = new List <UPMStringField> {
                    titleField
                };
                this.tmpGroupNode.Fields     = fields;
                this.tmpGroupNode.InfoFields = fields;
                this.tmpGroupNode.GroupNode  = true;
                //this.tmpGroupNode.Icon = UIImage.UpImageWithFileName(configStore.InfoAreaConfigById(this.childrenTreeConfig.InfoAreaId).ImageName);  // CRM-5007

                // load next Level directly to avoid Empty Static Nodes
                CoITreeNodeLoader loader = new CoITreeNodeLoader(this.tmpGroupNode, this.childrenTreeConfig, this.viewReference, 0, this.vistedNodes, this.nodeConfigMapping, this.recordIdentifierInfoAreaConfigMapping);
                loader.Mode        = CoINodeLoaderMode.InitialLoad;
                loader.TheDelegate = this;
                this.subNodeLoader.Add(loader);
                this.pendingCount++;
                loader.LoadNodeSubNodes();
            }
        }
コード例 #3
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);
            }
        }