Exemplo n.º 1
0
 private void dgFamilies_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         string famID = (string)dgFamilies.CurrentRow.Cells["FamilyID"].Value;
         Family fam   = ft.GetFamily(famID);
         if (fam != null)
         {
             if ((reportType == ReportType.MismatchedChildrenStatus || reportType == ReportType.MissingChildrenStatus) && ModifierKeys.Equals(Keys.Shift))
             {
                 List <IDisplayColourCensus> list = fam.Members.ToList <IDisplayColourCensus>();
                 ColourCensus rs = new ColourCensus(Countries.UNITED_KINGDOM, list);
                 MainForm.DisposeDuplicateForms(rs);
                 rs.Show();
                 rs.Focus();
             }
             else
             {
                 Facts factForm = new Facts(fam);
                 MainForm.DisposeDuplicateForms(factForm);
                 factForm.Show();
             }
         }
     }
 }
Exemplo n.º 2
0
        private void AddAllFamilyMembersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Individual ind = dgIndividuals.CurrentRow.DataBoundItem as Individual;

            isLoading = true;
            foreach (Individual i in ft.GetFamily(ind))
            {
                SelectIndividual(i);
            }
            isLoading = false;
            BuildMap();
        }
Exemplo n.º 3
0
        public static void ReadIndividualRecord(FamilyTree gedcom, Individual individual, List <Models.TreeNode> children)
        {
            foreach (var child in children)
            {
                switch (child.Tag)
                {
                case "NAME":
                    if (child.HasValue)
                    {
                        var name = new IndividualName();
                        name.FullName = child.GetTextValue();
                        ReadeName(gedcom, name, child.Children);
                        if (individual.IndividualNames == null)
                        {
                            individual.IndividualNames = new List <IndividualName>();
                        }
                        individual.IndividualNames.Add(name);
                    }
                    break;

                case "SEX":
                    if (child.HasValue)
                    {
                        switch (child.GetTextValue())
                        {
                        case "M":
                            individual.Sex = IndividualSex.M;
                            break;

                        case "F":
                            individual.Sex = IndividualSex.F;
                            break;

                        case "U":
                            individual.Sex = IndividualSex.U;
                            break;
                        }
                    }
                    break;

                case "DEAT":
                case "BIRT":
                    var individualEvent = new IndividualEvent();
                    individualEvent.Type = IndividualEventType.Birth;
                    ReadEvent(gedcom, individualEvent, child.Children);
                    if (individual.Events == null)
                    {
                        individual.Events = new List <IndividualEvent>();
                    }
                    individual.Events.Add(individualEvent);
                    break;

                //case "OCCU":
                //    if (!child.HasValue)
                //        break;
                //    var individualAttribute = new IndividualAttribute();
                //    individualAttribute.Text = child.GetTextValue();
                //    individualAttribute.Type = child.Tag;
                //    ParseAttribute(gedcom, individualAttribute, child.Childs);
                //    individual.Attributes.Add(individualAttribute);
                //    break;

                /*case "ADOP" :
                 *  Console.WriteLine(child.RawLine);
                 *  foreach (var ch in child.Childs) {
                 *      Console.WriteLine("\t{0}",ch.RawLine);
                 *  }
                 *  break; */
                case "FAMC":
                    if (child.HasValue)
                    {
                        var family = gedcom.GetFamily(child.GetTextValue());
                        if (family != null)
                        {
                            if (individual.ChildInFamilies == null)
                            {
                                individual.ChildInFamilies = new List <Family>();
                            }
                            individual.ChildInFamilies.Add(family);
                        }
                    }
                    break;

                case "FAMS":
                    if (child.HasValue)
                    {
                        var family = gedcom.GetFamily(child.GetTextValue());
                        if (family != null)
                        {
                            if (individual.ParentInFamilies == null)
                            {
                                individual.ParentInFamilies = new List <Family>();
                            }
                            individual.ParentInFamilies.Add(family);
                        }
                    }
                    break;     //NMR
                    //case "NCHI":
                    //    if (child.HasValue)
                    //        individual.KnowChilds = child.GetInt32Value();

                    //    break;
                    //case "NMR":
                    //    if (child.HasValue)
                    //        individual.KnowMarriages = child.GetInt32Value();
                    //    break;
                }
            }
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            var family = new FamilyTree();

            family = family.Create();

            Console.WriteLine("Press (1) for Show Tree, (2) for Search in the Family, (3) for Get Family, (4) for Get income of Family.");
            try
            {
                var input = Convert.ToInt32(Console.ReadLine());

                switch (input)
                {
                case (int)ChoiceEnum.Show:
                {
                    family.ShowTree();

                    break;
                }

                case (int)ChoiceEnum.Search:
                {
                    Console.WriteLine("Enter First/Last Name starts with: ");
                    var readLine = Console.ReadLine();

                    if (readLine != null)
                    {
                        family.SearchByName(readLine);
                    }

                    break;
                }

                case (int)ChoiceEnum.GetFamily:
                {
                    family.GetFamily();

                    break;
                }

                case (int)ChoiceEnum.GetIncome:
                {
                    family.GetFamilyIncome();

                    break;
                }

                default:
                {
                    Console.WriteLine("Wrong Choice ... Bye");
                    break;
                }
                }
                Console.WriteLine("\n Income Validation for Persons");
                var validations = family.Person.PersonValidation();
                foreach (var validateResult in validations)
                {
                    Console.WriteLine(validateResult);
                }
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.WriteLine("Bye");
            }
        }