コード例 #1
0
        public bool UpdateIndividual(IndividualClass tempIndividual, PersonUpdateType updateType)
        {
            if (individualList.ContainsKey(tempIndividual.GetXrefName()))
            {
                IndividualClass updatePerson = individualList[tempIndividual.GetXrefName()];

                if ((updateType & PersonUpdateType.ChildFamily) != 0)
                {
                    updatePerson.SetFamilyChildList(tempIndividual.GetFamilyChildList());
                }
                if ((updateType & PersonUpdateType.SpouseFamily) != 0)
                {
                    updatePerson.SetFamilySpouseList(tempIndividual.GetFamilySpouseList());
                }
                if ((updateType & PersonUpdateType.Name) != 0)
                {
                    updatePerson.SetPersonalName(tempIndividual.GetPersonalName());
                }
                if ((updateType & PersonUpdateType.Events) != 0)
                {
                    updatePerson.SetEventList(tempIndividual.GetEventList());
                }

                individualList[tempIndividual.GetXrefName()] = updatePerson;
                return(true);
            }
            else
            {
                trace.TraceEvent(TraceEventType.Error, 0, "Error: Can't update {0} as it is not in the database!", tempIndividual.GetXrefName());
            }
            return(false);
        }
コード例 #2
0
        private void SetPersonProperties(ref IndividualClass person)
        {
            if (propertyList != null)
            {
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.GivenName, propertyList[0].Value.ToString());
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.MiddleName, propertyList[1].Value.ToString());
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.Surname, propertyList[2].Value.ToString());
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.BirthSurname, propertyList[3].Value.ToString());
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.NameString, propertyList[4].Value.ToString());
                person.GetPersonalName().SetName(PersonalNameClass.PartialNameType.PublicName, propertyList[5].Value.ToString());

                switch ((PersonPropertySex)propertyList[SexIndex].Value)
                {
                case PersonPropertySex.Female:
                    person.SetSex(IndividualClass.IndividualSexType.Female);
                    break;

                case PersonPropertySex.Male:
                    person.SetSex(IndividualClass.IndividualSexType.Male);
                    break;

                case PersonPropertySex.Unknown:
                    person.SetSex(IndividualClass.IndividualSexType.Unknown);
                    break;
                }

                IList <IndividualEventClass> eventList = person.GetEventList();

                familyTree.UpdateIndividual(person, PersonUpdateType.ChildFamily | PersonUpdateType.Events | PersonUpdateType.Name | PersonUpdateType.SpouseFamily);
            }
            else
            {
                trace.TraceEvent(TraceEventType.Error, 0, "error no proplist");
            }
        }
コード例 #3
0
        private void GetPersonProperties(IndividualClass person)
        {
            if (propertyList != null)
            {
                propertyList[0].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.GivenName);
                propertyList[1].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.MiddleName);
                propertyList[2].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname);
                propertyList[3].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname);
                propertyList[4].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.NameString);
                propertyList[5].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.PublicName);

                switch (person.GetSex())
                {
                case IndividualClass.IndividualSexType.Female:
                    propertyList[SexIndex].Value = PersonPropertySex.Female;
                    break;

                case IndividualClass.IndividualSexType.Male:
                    propertyList[SexIndex].Value = PersonPropertySex.Male;
                    break;

                case IndividualClass.IndividualSexType.Unknown:
                    propertyList[SexIndex].Value = PersonPropertySex.Unknown;
                    break;
                }

                IList <IndividualEventClass> eventList = person.GetEventList();

                if (eventList != null)
                {
                    foreach (IndividualEventClass ev in eventList)
                    {
                        switch (ev.GetEventType())
                        {
                        case IndividualEventClass.EventType.Birth:
                            propertyList[BirthIndex].Value     = ev.GetDate().ToDateTime();
                            propertyList[BirthIndex + 1].Value = ev.GetAddress();
                            trace.TraceInformation("Birth: " + ev.GetAddress() + " " + ev.GetPlace() + " " + ev.ToString());
                            break;

                        case IndividualEventClass.EventType.Death:
                            propertyList[DeathIndex].Value     = ev.GetDate().ToDateTime();
                            propertyList[DeathIndex + 1].Value = ev.GetAddress();
                            trace.TraceInformation("Death: " + ev.GetAddress() + " " + ev.GetPlace() + " " + ev.ToString());
                            break;
                        }
                    }
                }
                if (propertyList[BirthIndex].Value == null)
                {
                    propertyList[BirthIndex].Value = DateTime.MinValue;
                }
                if (propertyList[DeathIndex].Value == null)
                {
                    propertyList[DeathIndex].Value = DateTime.MinValue;
                }
            }
            else
            {
                trace.TraceEvent(TraceEventType.Error, 0, "error no proplist");
            }
        }
コード例 #4
0
        public void SetSelectedPerson(IndividualClass person)
        {
            trace.TraceInformation("SetSelectedPerson");
            if (person != null)
            {
                selectedPerson = person;

                if (propertyList != null)
                {
                    propertyList[0].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.GivenName);
                    propertyList[1].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.MiddleName);
                    propertyList[2].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname);
                    propertyList[3].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname);
                    propertyList[4].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.NameString);

                    switch (person.GetSex())
                    {
                    case IndividualClass.IndividualSexType.Female:
                        propertyList[5].Value = PersonPropertySex.Female;
                        break;

                    case IndividualClass.IndividualSexType.Male:
                        propertyList[5].Value = PersonPropertySex.Male;
                        break;

                    case IndividualClass.IndividualSexType.Unknown:
                        propertyList[5].Value = PersonPropertySex.Unknown;
                        break;
                    }

                    IList <IndividualEventClass> eventList = person.GetEventList();

                    if (eventList != null)
                    {
                        foreach (IndividualEventClass ev in eventList)
                        {
                            switch (ev.GetEventType())
                            {
                            case IndividualEventClass.EventType.Birth:
                                propertyList[6].Value = ev.GetDate().ToDateTime();
                                break;

                            case IndividualEventClass.EventType.Death:
                                propertyList[7].Value = ev.GetDate().ToDateTime();
                                break;
                            }
                        }
                    }
                    if (propertyList[6].Value == null)
                    {
                        propertyList[6].Value = DateTime.MinValue;
                    }
                    if (propertyList[7].Value == null)
                    {
                        propertyList[7].Value = DateTime.MinValue;
                    }
                }
                else
                {
                    trace.TraceEvent(TraceEventType.Error, 0, "error no proplist");
                }
            }
            else
            {
                trace.TraceEvent(TraceEventType.Error, 0, "error no selected person");
            }
        }