Ejemplo n.º 1
0
        /// <summary>
        /// Update the marriage / divorce information for the two people.
        /// </summary>
        private static void ImportMarriage(Person husband, Person wife, XmlNode node)
        {
            // Return right away if there are not two people.
            if (husband == null || wife == null)
            {
                return;
            }

            // See if a marriage (or divorce) is specified.
            if (node.SelectSingleNode("MARR") != null || node.SelectSingleNode("DIV") != null)
            {
                // Get dates.
                DateTime?      marriageDate = GetValueDate(node, "MARR/DATE");
                DateTime?      divorceDate  = GetValueDate(node, "DIV/DATE");
                SpouseModifier modifier     = GetDivorced(node) ? SpouseModifier.Former : SpouseModifier.Current;

                // Add info to husband.
                if (husband.GetSpouseRelationship(wife) == null)
                {
                    SpouseRelationship husbandMarriage = new SpouseRelationship(wife, modifier);
                    husbandMarriage.MarriageDate = marriageDate;
                    husbandMarriage.DivorceDate  = divorceDate;
                    husband.Relationships.Add(husbandMarriage);
                }

                // Add info to wife.
                if (wife.GetSpouseRelationship(husband) == null)
                {
                    SpouseRelationship wifeMarriage = new SpouseRelationship(husband, modifier);
                    wifeMarriage.MarriageDate = marriageDate;
                    wifeMarriage.DivorceDate  = divorceDate;
                    wife.Relationships.Add(wifeMarriage);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add Spouse relationship between the person and the spouse with the provided spouse relationship type.
        /// </summary>
        public void AddSpouse(Person person, Person spouse, SpouseModifier spouseType)
        {
            //assign spouses to each other
            person.Relationships.Add(new SpouseRelationship(spouse, spouseType));
            spouse.Relationships.Add(new SpouseRelationship(person, spouseType));

            //add the spouse to the main people list
            if (!this.Contains(spouse))
            {
                this.Add(spouse);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Performs the business logic for updating the spouse relationship status
        /// </summary>
        public static void UpdateSpouseStatus(Person person, Person spouse, SpouseModifier modifier)
        {
            foreach (Relationship relationship in person.Relationships)
            {
                if (relationship.RelationshipType == RelationshipType.Spouse && relationship.RelationTo.Equals(spouse))
                {
                    ((SpouseRelationship)relationship).SpouseModifier = modifier;
                    break;
                }
            }

            foreach (Relationship relationship in spouse.Relationships)
            {
                if (relationship.RelationshipType == RelationshipType.Spouse && relationship.RelationTo.Equals(person))
                {
                    ((SpouseRelationship)relationship).SpouseModifier = modifier;
                    break;
                }
            }
        }
Ejemplo n.º 4
0
 public SpouseRelationship(Person person, SpouseModifier spouseType)
 {
     RelationshipType = RelationshipType.Spouse;
     spouseModifier   = spouseType;
     RelationTo       = person;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs the business logic for adding the Spousal relationship between the person and the spouse.
        /// In the case of existing people, do not hook up other siblings etc.  Allow the user to do this manually.
        /// </summary>
        public static void AddExistingSpouse(PeopleCollection family, Person person, Person spouse, SpouseModifier modifier)
        {
            // Assume the spouse's gender based on the counterpart of the person's gender
            if (person.Gender == Gender.Male)
            {
                spouse.Gender = Gender.Female;
            }
            else
            {
                spouse.Gender = Gender.Male;
            }

            if (person.Spouses != null)
            {
                // If specifying a new married spouse, make existing spouses former.
                if (modifier == SpouseModifier.Current)
                {
                    foreach (Relationship relationship in person.Relationships)
                    {
                        if (relationship.RelationshipType == RelationshipType.Spouse)
                        {
                            ((SpouseRelationship)relationship).SpouseModifier = SpouseModifier.Former;
                        }
                    }
                }
                family.AddSpouse(person, spouse, modifier);
            }

            // Setter for property change notification
            person.HasSpouse = true;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Performs the business logic for adding the Spousal relationship between the person and the spouse.
        /// </summary>
        public static void AddSpouse(PeopleCollection family, Person person, Person spouse, SpouseModifier modifier)
        {
            // Assume the spouse's gender based on the counterpart of the person's gender
            if (person.Gender == Gender.Male)
            {
                spouse.Gender = Gender.Female;
            }
            else
            {
                spouse.Gender = Gender.Male;
            }

            if (person.Spouses != null)
            {
                switch (person.Spouses.Count)
                {
                // No existing spouse
                case 0:
                    family.AddSpouse(person, spouse, modifier);

                    // Add any of the children as the child of the spouse.
                    if (person.Children != null || person.Children.Count > 0)
                    {
                        foreach (Person child in person.Children)
                        {
                            family.AddChild(spouse, child, ParentChildModifier.Natural);
                        }
                    }
                    break;

                // Existing spouse(s)
                default:
                    // If specifying a new married spouse, make existing spouses former.
                    if (modifier == SpouseModifier.Current)
                    {
                        foreach (Relationship relationship in person.Relationships)
                        {
                            if (relationship.RelationshipType == RelationshipType.Spouse)
                            {
                                ((SpouseRelationship)relationship).SpouseModifier = SpouseModifier.Former;
                            }
                        }
                    }

                    family.AddSpouse(person, spouse, modifier);
                    break;
                }

                // Setter for property change notification
                person.HasSpouse = true;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs the business logic for updating the spouse status
        /// </summary>
        public static void UpdateSpouseStatus(Person person, Person spouse, SpouseModifier modifier)
        {
            foreach (Relationship relationship in person.Relationships)
            {
                if (relationship.RelationshipType == RelationshipType.Spouse && relationship.RelationTo.Equals(spouse))
                {
                    ((SpouseRelationship)relationship).SpouseModifier = modifier;
                    break;
                }
            }

            foreach (Relationship relationship in spouse.Relationships)
            {
                if (relationship.RelationshipType == RelationshipType.Spouse && relationship.RelationTo.Equals(person))
                {
                    ((SpouseRelationship)relationship).SpouseModifier = modifier;
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Performs the business logic for adding the Spousal relationship between the person and the spouse.
        /// </summary>
        public static void AddSpouse(PeopleCollection family, Person person, Person spouse, SpouseModifier modifier)
        {
            // Assume the spouse's gender based on the counterpart of the person's gender
            if (person.Gender == Gender.Male)
                spouse.Gender = Gender.Female;
            else
                spouse.Gender = Gender.Male;

            if (person.Spouses != null)
            {
                switch (person.Spouses.Count)
                {
                    // No existing spouse	
                    case 0:
                        family.AddSpouse(person, spouse, modifier);

                        // Add any of the children as the child of the spouse.
                        if (person.Children != null || person.Children.Count > 0)
                        {
                            foreach (Person child in person.Children)
                            {
                                family.AddChild(spouse, child, ParentChildModifier.Natural);
                            }
                        }
                        break;

                    // Existing spouse(s)
                    default:
                        // If specifying a new married spouse, make existing spouses former.
                        if (modifier == SpouseModifier.Current)
                        {
                            foreach (Relationship relationship in person.Relationships)
                            {
                                if (relationship.RelationshipType == RelationshipType.Spouse)
                                    ((SpouseRelationship)relationship).SpouseModifier = SpouseModifier.Former;
                            }
                        }
                        
                        family.AddSpouse(person, spouse, modifier);
                        break;
                }

                // Setter for property change notification
                person.HasSpouse = true;
            }
        }
Ejemplo n.º 9
0
 public SpouseRelationship(Shape person, SpouseModifier spouseType)
 {
     RelationshipType    = RelationshipType.Spouse;
     this.spouseModifier = spouseType;
     this.RelationTo     = person;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Performs the business logic for adding the Spousal relationship between the person and the spouse.
 /// </summary>
 public static void AddSpouse(UMLCollection family, Shape person, Shape spouse, SpouseModifier modifier)
 {
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Update the marriage / divorce information for the two people.
        /// </summary>
        private static void ImportMarriage(Person husband, Person wife, XmlNode node, XmlDocument doc)
        {
            // Return right away if there are not two people.
            if (husband == null || wife == null)
            {
                return;
            }

            // See if a marriage (or divorce) is specified.
            if (node.SelectSingleNode("MARR") != null || node.SelectSingleNode("DIV") != null)
            {
                string   marriageDateDescriptor     = GetValueDateDescriptor(node, "MARR/DATE");
                DateTime?marriageDate               = GetValueDate(node, "MARR/DATE");
                string   marriagePlace              = GetValue(node, "MARR/PLAC");
                string   marriageSource             = GetValueId(node, "MARR/SOUR");
                string   marriageCitation           = GetValue(node, "MARR/SOUR/PAGE");
                string   marriageCitationActualText = GetValue(node, "MARR/SOUR/DATA/TEXT");

                string marriageCitationNote = ImportEventNote(node, "MARR/SOUR/NOTE", doc);
                string marriageLink         = string.Empty;

                if (GetValue(node, "MARR/SOUR/OBJE/FORM") == "URL")  //get correct link if present
                {
                    marriageLink = GetValue(node, "MARR/SOUR/OBJE/TITL");
                }

                if (string.IsNullOrEmpty(marriageLink))  //if no link see if there is one in the note
                {
                    marriageLink = GetLink(marriageCitationNote);
                }

                string   divorceDateDescriptor     = GetValueDateDescriptor(node, "DIV/DATE");
                DateTime?divorceDate               = GetValueDate(node, "DIV/DATE");
                string   divorceSource             = GetValueId(node, "DIV/SOUR");
                string   divorceCitation           = GetValue(node, "DIV/SOUR/PAGE");
                string   divorceCitationActualText = GetValue(node, "DIV/SOUR/DATA/TEXT");

                string divorceCitationNote = ImportEventNote(node, "DIV/SOUR/NOTE", doc);
                string divorceLink         = string.Empty;

                if (GetValue(node, "DIV/SOUR/OBJE/FORM") == "URL")  //get correct link if present
                {
                    divorceLink = GetValue(node, "DIV/SOUR/OBJE/TITL");
                }

                if (string.IsNullOrEmpty(divorceLink))  //if no link see if there is one in the note
                {
                    divorceLink = GetLink(divorceCitationNote);
                }

                SpouseModifier modifier = GetDivorced(node) ? SpouseModifier.Former : SpouseModifier.Current;

                // Add info to husband.
                if (husband.GetSpouseRelationship(wife) == null)
                {
                    SpouseRelationship husbandMarriage = new SpouseRelationship(wife, modifier);

                    husbandMarriage.MarriageDate           = marriageDate;
                    husbandMarriage.MarriageDateDescriptor = marriageDateDescriptor;
                    husbandMarriage.MarriagePlace          = marriagePlace;

                    husbandMarriage.MarriageCitation           = marriageCitation;
                    husbandMarriage.MarriageSource             = marriageSource;
                    husbandMarriage.MarriageLink               = marriageLink;
                    husbandMarriage.MarriageCitationNote       = marriageCitationNote;
                    husbandMarriage.MarriageCitationActualText = marriageCitationActualText;

                    husbandMarriage.DivorceDate           = divorceDate;
                    husbandMarriage.DivorceDateDescriptor = divorceDateDescriptor;

                    husbandMarriage.DivorceCitation           = divorceCitation;
                    husbandMarriage.DivorceSource             = divorceSource;
                    husbandMarriage.DivorceLink               = divorceLink;
                    husbandMarriage.DivorceCitationNote       = divorceCitationNote;
                    husbandMarriage.DivorceCitationActualText = divorceCitationActualText;

                    husband.Relationships.Add(husbandMarriage);
                }

                // Add info to wife.
                if (wife.GetSpouseRelationship(husband) == null)
                {
                    SpouseRelationship wifeMarriage = new SpouseRelationship(husband, modifier);
                    wifeMarriage.MarriageDate           = marriageDate;
                    wifeMarriage.MarriageDateDescriptor = marriageDateDescriptor;
                    wifeMarriage.MarriagePlace          = marriagePlace;

                    wifeMarriage.MarriageCitation           = marriageCitation;
                    wifeMarriage.MarriageSource             = marriageSource;
                    wifeMarriage.MarriageLink               = marriageLink;
                    wifeMarriage.MarriageCitationNote       = marriageCitationNote;
                    wifeMarriage.MarriageCitationActualText = marriageCitationActualText;

                    wifeMarriage.DivorceDate           = divorceDate;
                    wifeMarriage.DivorceDateDescriptor = divorceDateDescriptor;

                    wifeMarriage.DivorceCitation           = divorceCitation;
                    wifeMarriage.DivorceSource             = divorceSource;
                    wifeMarriage.DivorceLink               = divorceLink;
                    wifeMarriage.DivorceCitationNote       = divorceCitationNote;
                    wifeMarriage.DivorceCitationActualText = divorceCitationActualText;

                    wife.Relationships.Add(wifeMarriage);
                }
            }
            else
            {
                SpouseRelationship wifeMarriage    = new SpouseRelationship(husband, SpouseModifier.Current);
                SpouseRelationship husbandMarriage = new SpouseRelationship(wife, SpouseModifier.Current);

                wife.Relationships.Add(wifeMarriage);
                husband.Relationships.Add(husbandMarriage);
            }
        }