コード例 #1
0
        public void GenerateDescendantsFamilyList(int individualId, int depth)
        {
            if ((descendantIds.ContainsKey(individualId)) && (UniqueDescendants == true))
            {
                //do nothing since we can ignore it
            }
            else
            {
                DataSet individualDS = dbAccess.GetIndividual(individualId);
                if (!descendantIds.ContainsKey(individualId))
                {
                    descendantIds.Add(individualId, individualId);
                }
                IndividualCount++;

                if (GenerationCount < depth)
                {
                    GenerationCount = depth;
                }

                if (individualDS.Tables[0].Rows.Count > 0)
                {
                    int         parentFamilyId = (int)(individualDS.Tables[0].Rows[0]["ParentFamilyId"]);
                    Individualg individual     = new Individualg(individualId, individualDS.Tables[0].Rows[0]["Firstname"].ToString(), individualDS.Tables[0].Rows[0]["Surname"].ToString(), individualDS.Tables[0].Rows[0]["Gender"].ToString(), individualDS.Tables[0].Rows[0]["BornDate"].ToString(), individualDS.Tables[0].Rows[0]["BornPlace"].ToString(), individualDS.Tables[0].Rows[0]["DiedDate"].ToString(), individualDS.Tables[0].Rows[0]["DiedPlace"].ToString(), parentFamilyId);
                    descendantList[depth].Add(individual);

                    if (depth < MaxDepth)
                    {
                        DataSet familyDS = dbAccess.GetFamilyByPerson(individualId);
                        for (int i = 0; i < familyDS.Tables[0].Rows.Count; i++)
                        {
                            int familyId = (int)(familyDS.Tables[0].Rows[i]["ID"]);

                            int     husbandId = (int)(familyDS.Tables[0].Rows[i]["HusbandId"]);
                            int     wifeId    = (int)(familyDS.Tables[0].Rows[i]["WifeId"]);
                            Familyg family    = new Familyg(familyId, husbandId, wifeId, familyDS.Tables[0].Rows[i]["MarriageDate"].ToString(), familyDS.Tables[0].Rows[i]["MarriagePlace"].ToString());
                            descendantFamilyList[depth].Add(family);

                            DataSet familyChildrenDS = dbAccess.GetFamilyChildren(familyId);

                            for (int j = 0; j < familyChildrenDS.Tables[0].Rows.Count; j++)
                            {
                                GenerateDescendantsFamilyList((int)(familyChildrenDS.Tables[0].Rows[j]["ChildId"]), depth + 1);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void GenerateAncestryFamilyList(int individualId, int depth)
        {
            if ((ancestryIds.ContainsKey(individualId)) && (UniqueAncestors == true))
            {
                //do nothing since we can ignore it
            }
            else
            {
                DataSet individualDS = dbAccess.GetIndividual(individualId);
                if (!ancestryIds.ContainsKey(individualId))
                {
                    ancestryIds.Add(individualId, individualId);
                }
                IndividualCount++;

                if (GenerationCount < depth)
                {
                    GenerationCount = depth;
                }

                if (individualDS.Tables[0].Rows.Count > 0)
                {
                    int         parentFamilyId = (int)(individualDS.Tables[0].Rows[0]["ParentFamilyId"]);
                    Individualg individual     = new Individualg(individualId, individualDS.Tables[0].Rows[0]["Firstname"].ToString(), individualDS.Tables[0].Rows[0]["Surname"].ToString(), individualDS.Tables[0].Rows[0]["Gender"].ToString(), individualDS.Tables[0].Rows[0]["BornDate"].ToString(), individualDS.Tables[0].Rows[0]["BornPlace"].ToString(), individualDS.Tables[0].Rows[0]["DiedDate"].ToString(), individualDS.Tables[0].Rows[0]["DiedPlace"].ToString(), parentFamilyId);
                    ancestryList[depth].Add(individual);

                    if (depth < MaxDepth)
                    {
                        DataSet familyDS = dbAccess.GetFamily(parentFamilyId);
                        if (familyDS.Tables[0].Rows.Count > 0)
                        {
                            int     husbandId = (int)(familyDS.Tables[0].Rows[0]["HusbandId"]);
                            int     wifeId    = (int)(familyDS.Tables[0].Rows[0]["WifeId"]);
                            Familyg family    = new Familyg(parentFamilyId, husbandId, wifeId, familyDS.Tables[0].Rows[0]["MarriageDate"].ToString(), familyDS.Tables[0].Rows[0]["MarriagePlace"].ToString());
                            ancestryFamilyList[depth].Add(family);
                            if (husbandId != -1)
                            {
                                GenerateAncestryFamilyList(husbandId, depth + 1);
                            }
                            if (wifeId != -1)
                            {
                                GenerateAncestryFamilyList(wifeId, depth + 1);
                            }
                        }
                    }
                }
            }
        }