예제 #1
0
 private void dgIndividuals_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         string     indID    = (string)dgIndividuals.CurrentRow.Cells["IndividualID"].Value;
         Individual ind      = ft.GetIndividual(indID);
         Facts      factForm = new Facts(ind);
         MainForm.DisposeDuplicateForms(factForm);
         factForm.Show();
     }
 }
예제 #2
0
 void DgReportSheet_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         FamilyTree ft = FamilyTree.Instance;
         if (e.ColumnIndex >= birthColumnIndex && e.ColumnIndex <= burialColumnIndex)
         {
             DataGridViewCell cell  = dgBMDReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex];
             BMDColours       value = (BMDColours)cell.Value;
             if (value != BMDColours.EXACT_DATE)
             {
                 IDisplayColourBMD person = (IDisplayColourBMD)dgBMDReportSheet.Rows[e.RowIndex].DataBoundItem;
                 Individual        ind    = ft.GetIndividual(person.IndividualID);
                 if (e.ColumnIndex == birthColumnIndex || e.ColumnIndex == birthColumnIndex + 1)
                 {
                     ft.SearchBMD(FamilyTree.SearchType.BIRTH, ind, ind.BirthDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null);
                 }
                 else if (e.ColumnIndex >= birthColumnIndex + 2 && e.ColumnIndex <= birthColumnIndex + 4)
                 {
                     FactDate   marriageDate = FactDate.UNKNOWN_DATE;
                     Individual spouse       = null;
                     if (e.ColumnIndex == birthColumnIndex + 2)
                     {
                         marriageDate = ind.FirstMarriageDate;
                         spouse       = ind.FirstSpouse;
                     }
                     if (e.ColumnIndex == birthColumnIndex + 3)
                     {
                         marriageDate = ind.SecondMarriageDate;
                         spouse       = ind.SecondSpouse;
                     }
                     if (e.ColumnIndex == birthColumnIndex + 4)
                     {
                         marriageDate = ind.ThirdMarriageDate;
                         spouse       = ind.ThirdSpouse;
                     }
                     ft.SearchBMD(FamilyTree.SearchType.MARRIAGE, ind, marriageDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, spouse);
                 }
                 else if (e.ColumnIndex == burialColumnIndex || e.ColumnIndex == burialColumnIndex - 1)
                 {
                     ft.SearchBMD(FamilyTree.SearchType.DEATH, ind, ind.DeathDate, cbBMDSearchProvider.SelectedIndex, cbRegion.Text, null);
                 }
             }
         }
         else if (e.ColumnIndex >= 0)
         {
             string     indID    = (string)dgBMDReportSheet.CurrentRow.Cells["IndividualID"].Value;
             Individual ind      = ft.GetIndividual(indID);
             Facts      factForm = new Facts(ind);
             factForm.Show();
         }
     }
 }
예제 #3
0
        public static void ReadFamilyRecord(FamilyTree gedcom, Family family, List <Models.TreeNode> children)
        {
            foreach (var child in children)
            {
                switch (child.Tag)
                {
                case "HUSB":
                    if (child.HasValue)
                    {
                        var husband = gedcom.GetIndividual(child.GetTextValue());
                        if (husband != null)
                        {
                            family.Husband = husband;
                        }
                    }
                    break;

                case "WIFE":
                    if (child.HasValue)
                    {
                        var wife = gedcom.GetIndividual(child.GetTextValue());
                        if (wife != null)
                        {
                            family.Wife = wife;
                        }
                    }
                    break;

                case "CHIL":
                    if (child.HasValue)
                    {
                        var familyChildren = gedcom.GetIndividual(child.GetTextValue());
                        if (familyChildren != null)
                        {
                            if (family.Children == null)
                            {
                                family.Children = new List <Individual>();
                            }
                            family.Children.Add(familyChildren);
                        }
                    }
                    break;

                case "NCHI":
                    if (child.HasValue)
                    {
                        family.NumberOfChildren = (int)child.GetInt32Value();
                    }
                    break;
                }
            }
        }
예제 #4
0
        public Family(XmlNode node, IProgress <string> outputText)
            : this(string.Empty)
        {
            if (node != null)
            {
                XmlNode eHusband = node.SelectSingleNode("HUSB");
                XmlNode eWife    = node.SelectSingleNode("WIFE");
                FamilyID = node.Attributes["ID"].Value;
                string husbandID = eHusband?.Attributes["REF"]?.Value;
                string wifeID    = eWife?.Attributes["REF"]?.Value;
                Husband = ft.GetIndividual(husbandID);
                Wife    = ft.GetIndividual(wifeID);
                if (Husband != null && Wife != null)
                {
                    Wife.MarriedName = Husband.Surname;
                }
                if (Husband != null)
                {
                    Husband.FamiliesAsSpouse.Add(this);
                }
                if (Wife != null)
                {
                    Wife.FamiliesAsSpouse.Add(this);
                }

                // now iterate through child elements of eChildren
                // finding all individuals
                XmlNodeList list = node.SelectNodes("CHIL");
                foreach (XmlNode n in list)
                {
                    if (n.Attributes["REF"] != null)
                    {
                        Individual child = ft.GetIndividual(n.Attributes["REF"].Value);
                        if (child != null)
                        {
                            XmlNode fatherNode = n.SelectSingleNode("_FREL");
                            XmlNode motherNode = n.SelectSingleNode("_MREL");
                            var     father     = ParentalRelationship.GetRelationshipType(fatherNode);
                            var     mother     = ParentalRelationship.GetRelationshipType(motherNode);
                            Children.Add(child);
                            var parent = new ParentalRelationship(this, father, mother);
                            child.FamiliesAsChild.Add(parent);
                            AddParentAndChildrenFacts(child, Husband, father);
                            AddParentAndChildrenFacts(child, Wife, mother);
                        }
                        else
                        {
                            outputText.Report($"Child not found in family: {FamilyRef}\n");
                        }
                    }
                    else
                    {
                        outputText.Report($"Child without a reference found in family: {FamilyRef}\n");
                    }
                }

                AddFacts(node, Fact.ANNULMENT, outputText);
                AddFacts(node, Fact.DIVORCE, outputText);
                AddFacts(node, Fact.DIVORCE_FILED, outputText);
                AddFacts(node, Fact.ENGAGEMENT, outputText);
                AddFacts(node, Fact.MARRIAGE, outputText);
                AddFacts(node, Fact.MARRIAGE_BANN, outputText);
                AddFacts(node, Fact.MARR_CONTRACT, outputText);
                AddFacts(node, Fact.MARR_LICENSE, outputText);
                AddFacts(node, Fact.MARR_SETTLEMENT, outputText);
                AddFacts(node, Fact.SEPARATION, outputText);
                AddFacts(node, Fact.CENSUS, outputText);
                AddFacts(node, Fact.CUSTOM_EVENT, outputText);
                AddFacts(node, Fact.CUSTOM_FACT, outputText);
                AddFacts(node, Fact.REFERENCE, outputText);
                AddFacts(node, Fact.SEALED_TO_SPOUSE, outputText);
                AddFacts(node, Fact.UNKNOWN, outputText);

                //TODO: need to think about family facts having AGE tags in GEDCOM
                if (HasGoodChildrenStatus)
                {
                    CheckChildrenStatusCounts();
                }
                if (MarriageDate.IsKnown && !MarriageDate.Overlaps(FactDate.SAME_SEX_MARRIAGE)) // check for wrongly set gender only if pre-dates same sex marriages
                {
                    if (Husband != null && !Husband.IsMale)
                    {
                        Husband.QuestionGender(this, true);
                    }
                    if (Wife != null && Wife.IsMale)
                    {
                        Wife.QuestionGender(this, false);
                    }
                }
                Children.ToList().Sort(new BirthDateComparer());
            }
        }
예제 #5
0
 private void dgReportSheet_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         FamilyTree ft = FamilyTree.Instance;
         if (e.ColumnIndex >= startColumnIndex && e.ColumnIndex <= endColumnIndex)
         {
             DataGridViewCell cell = dgReportSheet.Rows[e.RowIndex].Cells[e.ColumnIndex];
             int value             = (int)cell.Value;
             if (value >= 1 && value <= 7) // allows any type of record to search census
             {
                 IDisplayColourCensus person = (IDisplayColourCensus)dgReportSheet.Rows[e.RowIndex].DataBoundItem;
                 int censusYear;
                 if (country.Equals(Countries.UNITED_STATES))
                 {
                     censusYear = (1790 + (e.ColumnIndex - startColumnIndex) * 10);
                 }
                 else if (country.Equals(Countries.CANADA))
                 {
                     if (e.ColumnIndex <= dgReportSheet.Columns["Can1901"].Index)
                     {
                         censusYear = (1851 + (e.ColumnIndex - startColumnIndex) * 10);
                     }
                     else
                     {
                         censusYear = (1901 + (e.ColumnIndex - dgReportSheet.Columns["Can1901"].Index) * 5);
                     }
                 }
                 else if (country.Equals(Countries.IRELAND))
                 {
                     censusYear = (1901 + (e.ColumnIndex - startColumnIndex) * 10);
                 }
                 else
                 {
                     if (e.ColumnIndex == C1939.Index)
                     {
                         censusYear = 1939;
                     }
                     else
                     {
                         censusYear = (1841 + (e.ColumnIndex - startColumnIndex) * 10);
                     }
                 }
                 string censusCountry = person.BestLocation(new FactDate(censusYear.ToString())).CensusCountry;
                 if (censusYear == 1939 && !cbCensusSearchProvider.SelectedItem.Equals("Find My Past"))
                 {
                     MessageBox.Show("Unable to search the 1939 National Register on " + cbCensusSearchProvider.SelectedItem + ".", "FTAnalyzer");
                 }
                 else
                 {
                     ft.SearchCensus(censusCountry, censusYear, ft.GetIndividual(person.IndividualID), cbCensusSearchProvider.SelectedIndex);
                 }
             }
         }
         else if (e.ColumnIndex >= 0)
         {
             string     indID    = (string)dgReportSheet.CurrentRow.Cells["IndividualID"].Value;
             Individual ind      = ft.GetIndividual(indID);
             Facts      factForm = new Facts(ind);
             factForm.Show();
         }
     }
 }
예제 #6
0
        public Family(XmlNode node)
            : this(string.Empty)
        {
            if (node != null)
            {
                XmlNode eHusband = node.SelectSingleNode("HUSB");
                XmlNode eWife    = node.SelectSingleNode("WIFE");
                this.FamilyID = node.Attributes["ID"].Value;
                string     husbandID = eHusband == null || eHusband.Attributes["REF"] == null ? null : eHusband.Attributes["REF"].Value;
                string     wifeID    = eWife == null || eWife.Attributes["REF"] == null ? null : eWife.Attributes["REF"].Value;
                FamilyTree ft        = FamilyTree.Instance;
                this.Husband = ft.GetIndividual(husbandID);
                this.Wife    = ft.GetIndividual(wifeID);
                if (Husband != null && Wife != null)
                {
                    Wife.MarriedName = Husband.Surname;
                }
                if (Husband != null)
                {
                    Husband.FamiliesAsParent.Add(this);
                }
                if (Wife != null)
                {
                    Wife.FamiliesAsParent.Add(this);
                }
                // now iterate through child elements of eChildren
                // finding all individuals
                XmlNodeList list = node.SelectNodes("CHIL");
                foreach (XmlNode n in list)
                {
                    if (n.Attributes["REF"] != null)
                    {
                        Individual child = ft.GetIndividual(n.Attributes["REF"].Value);
                        if (child != null)
                        {
                            XmlNode fatherNode = node.SelectSingleNode("CHIL/_FREL");
                            XmlNode motherNode = node.SelectSingleNode("CHIL/_MREL");
                            ParentalRelationship.ParentalRelationshipType father = ParentalRelationship.GetRelationshipType(fatherNode);
                            ParentalRelationship.ParentalRelationshipType mother = ParentalRelationship.GetRelationshipType(motherNode);
                            Children.Add(child);
                            ParentalRelationship parent = new ParentalRelationship(this, father, mother);
                            child.FamiliesAsChild.Add(parent);
                            AddParentAndChildrenFacts(child, Husband, father);
                            AddParentAndChildrenFacts(child, Wife, mother);
                        }
                        else
                        {
                            ft.XmlErrorBox.AppendText("Child not found in family :" + FamilyRef + "\n");
                        }
                    }
                    else
                    {
                        ft.XmlErrorBox.AppendText("Child without a reference found in family : " + FamilyRef + "\n");
                    }
                }

                AddFacts(node, Fact.ANNULMENT);
                AddFacts(node, Fact.DIVORCE);
                AddFacts(node, Fact.DIVORCE_FILED);
                AddFacts(node, Fact.ENGAGEMENT);
                AddFacts(node, Fact.MARRIAGE);
                AddFacts(node, Fact.MARRIAGE_BANN);
                AddFacts(node, Fact.MARR_CONTRACT);
                AddFacts(node, Fact.MARR_LICENSE);
                AddFacts(node, Fact.MARR_SETTLEMENT);
                AddFacts(node, Fact.SEPARATION);
                AddFacts(node, Fact.CENSUS);
                AddFacts(node, Fact.CUSTOM_EVENT);
                AddFacts(node, Fact.CUSTOM_FACT);
                AddFacts(node, Fact.REFERENCE);
                AddFacts(node, Fact.UNKNOWN);
                //TODO: need to think about family facts having AGE tags in GEDCOM
                if (HasGoodChildrenStatus)
                {
                    CheckChildrenStatusCounts();
                }
            }
        }