Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AncestryNode"/> class.
 /// </summary>
 /// <param name="tree">The ancestry tree in which this person belongs.</param>
 /// <param name="number">The one-based index number of where this person is in the specified tree. See remarks.</param>
 /// <remarks>
 /// When calling this constructor, the number parameter is one-based, but the tree indexing is zero-based, and the difference is adjusted automatically.
 /// </remarks>
 public AncestryNode(AncestryTree tree, int number)
 {
     this.number = number;
     this.tree = tree;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AncestryNode"/> class.
 /// </summary>
 /// <param name="tree">The ancestry tree in which this person belongs.</param>
 /// <param name="number">The one-based index number of where this person is in the specified tree. See remarks.</param>
 /// <remarks>
 /// When calling this constructor, the number parameter is one-based, but the tree indexing is zero-based, and the difference is adjusted automatically.
 /// </remarks>
 public AncestryNode(AncestryTree tree, int number)
 {
     this.number = number;
     this.tree   = tree;
 }
        private TreeNode[] RecAddPersonsParents(AncestryTree.AncestryNode ancestryNode)
        {
            TreeNode fatherNode = null;
            TreeNode motherNode = null;

            if (ancestryNode.Person == null) return null;
            if (ancestryNode.Father == null && ancestryNode.Mother == null)  //end of the line Clancy!
                return null;

            if (ancestryNode.Father != null && ancestryNode.Father.Person != null)
            {
                TreeNode[] fatherNodes = RecAddPersonsParents(ancestryNode.Father);
                if (fatherNodes != null && fatherNodes[0] != null)
                {
                    fatherNode =
                        new TreeNode(
                            ancestryNode.Father.Person.DisplayExtension.Name + ": " +
                            ancestryNode.Father.Person.Id, fatherNodes);
                }
                else
                {
                    fatherNode =
                        new TreeNode(ancestryNode.Father.Person.DisplayExtension.Name + ": " +
                                     ancestryNode.Father.Person.Id);
                }
            }

            if (ancestryNode.Mother != null && ancestryNode.Mother.Person != null)
            {
                TreeNode[] motherNodes = RecAddPersonsParents(ancestryNode.Mother);
                if (motherNodes != null && motherNodes[0] != null)
                {
                    motherNode =
                        new TreeNode(
                            ancestryNode.Mother.Person.DisplayExtension.Name + ": " +
                            ancestryNode.Mother.Person.Id, motherNodes);
                }
                else
                {
                    motherNode =
                        new TreeNode(ancestryNode.Mother.Person.DisplayExtension.Name + ": " +
                                     ancestryNode.Mother.Person.Id);
                }
            }

            if (fatherNode == null)
                return new TreeNode[] {motherNode};

            if (motherNode == null)
                return new TreeNode[] {fatherNode};

            return new TreeNode[] { fatherNode, motherNode };
            
        }