Beispiel #1
0
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(((IndividualName?.GetHashCode() ?? 0) * 397) ^ (FamilyName?.GetHashCode() ?? 0));
     }
 }
Beispiel #2
0
        public static void ReadeName(FamilyTree gedcom, IndividualName name, List <Models.TreeNode> children)
        {
            foreach (var child in children)
            {
                switch (child.Tag)
                {
                case "TYPE":
                    if (child.HasValue)
                    {
                        switch (child.GetTextValue())
                        {
                        case "AKA":
                            name.Type = IndividualNameType.Aka;
                            break;

                        case "BIRTH":
                            name.Type = IndividualNameType.Birth;
                            break;
                        }
                    }
                    //name.Type = child.GetTextValue();
                    break;

                case "NPFX":
                    if (child.HasValue)
                    {
                        name.Prefix = child.GetTextValue();
                    }
                    break;

                case "GIVN":
                    if (child.HasValue)
                    {
                        name.Given = child.GetTextValue();
                    }
                    break;

                case "NICK":
                    if (child.HasValue)
                    {
                        name.Nickname = child.GetTextValue();
                    }
                    break;

                case "SPFX":
                    if (child.HasValue)
                    {
                        name.SurnamePrefix = child.GetTextValue();
                    }
                    break;

                case "SURN":
                    if (child.HasValue)
                    {
                        name.Surname = child.GetTextValue();
                    }
                    break;

                case "NSFX":
                    if (child.HasValue)
                    {
                        name.Suffix = child.GetTextValue();
                    }
                    break;
                }
            }
        }
Beispiel #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;
                }
            }
        }