示例#1
0
        public override void MoveTo(GDMRecord targetRecord, bool clearDest)
        {
            GDMFamilyRecord targetFamily = targetRecord as GDMFamilyRecord;

            if (targetFamily == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            base.MoveTo(targetRecord, clearDest);

            targetFamily.RemoveSpouse(targetFamily.Husband.Individual);
            targetFamily.Husband.XRef = fHusband.XRef;

            targetFamily.RemoveSpouse(targetFamily.Wife.Individual);
            targetFamily.Wife.XRef = fWife.XRef;

            targetFamily.Status = fStatus;

            while (fChildren.Count > 0)
            {
                GDMIndividualLink obj = fChildren.Extract(0);
                obj.ResetOwner(targetFamily);
                targetFamily.Children.Add(obj);
            }
        }
示例#2
0
        public override void MoveTo(GDMRecord targetRecord)
        {
            GDMFamilyRecord targetFamily = targetRecord as GDMFamilyRecord;

            if (targetFamily == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            base.MoveTo(targetRecord);

            targetFamily.RemoveSpouse(fTree.GetPtrValue <GDMIndividualRecord>(targetFamily.Husband));
            targetFamily.Husband.XRef = fHusband.XRef;

            targetFamily.RemoveSpouse(fTree.GetPtrValue <GDMIndividualRecord>(targetFamily.Wife));
            targetFamily.Wife.XRef = fWife.XRef;

            targetFamily.Status = fStatus;

            while (fChildren.Count > 0)
            {
                GDMIndividualLink obj = fChildren.Extract(0);
                targetFamily.Children.Add(obj);
            }
        }
示例#3
0
        public GDMCommunicationRecord(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType._COMM);

            fDate         = new GDMDate(this);
            fCorresponder = new GDMIndividualLink(this);
        }
示例#4
0
        public GDMCommunicationRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._COMM);

            fDate         = new GDMDate();
            fCorresponder = new GDMIndividualLink();
        }
示例#5
0
        public GDMFamilyRecord(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.FAM);

            fHusband  = new GDMIndividualLink(this, (int)GEDCOMTagType.HUSB, string.Empty);
            fWife     = new GDMIndividualLink(this, (int)GEDCOMTagType.WIFE, string.Empty);
            fChildren = new GDMList <GDMIndividualLink>(this);
        }
示例#6
0
        public GDMFamilyRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.FAM);

            fHusband  = new GDMIndividualLink((int)GEDCOMTagType.HUSB, string.Empty);
            fWife     = new GDMIndividualLink((int)GEDCOMTagType.WIFE, string.Empty);
            fChildren = new GDMList <GDMIndividualLink>();
        }
示例#7
0
        public bool AddChild(GDMIndividualRecord child)
        {
            if (child == null)
            {
                return(false);
            }

            GDMIndividualLink ptr = new GDMIndividualLink(this, (int)GEDCOMTagType.CHIL, string.Empty);

            ptr.Individual = child;
            fChildren.Add(ptr);

            GDMChildToFamilyLink chLink = new GDMChildToFamilyLink(child);

            chLink.Family = this;
            child.ChildToFamilyLinks.Add(chLink);

            return(true);
        }
示例#8
0
        public bool AddMember(GDMIndividualRecord member)
        {
            if (member == null)
            {
                return(false);
            }

            GDMIndividualLink mbrLink = new GDMIndividualLink(this, (int)GEDCOMTagType._MEMBER, string.Empty);

            mbrLink.Individual = member;
            fMembers.Add(mbrLink);

            var ptr = new GDMPointer(member, (int)GEDCOMTagType._GROUP, string.Empty);

            ptr.Value = this;
            member.Groups.Add(ptr);

            return(true);
        }
示例#9
0
        public override void MoveTo(GDMRecord targetRecord, bool clearDest)
        {
            GDMIndividualRecord targetIndi = targetRecord as GDMIndividualRecord;

            if (targetIndi == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            /*if (!clearDest) {
             *  DeleteTag(GEDCOMTagType.SEX);
             *  DeleteTag(GEDCOMTagType._UID);
             * }*/

            base.MoveTo(targetRecord, clearDest);

            targetIndi.Sex = fSex;

            while (fPersonalNames.Count > 0)
            {
                GDMPersonalName obj = fPersonalNames.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.AddPersonalName(obj);
            }

            string currentXRef = this.XRef;
            string targetXRef  = targetRecord.XRef;

            while (fChildToFamilyLinks.Count > 0)
            {
                GDMChildToFamilyLink ctfLink = fChildToFamilyLinks.Extract(0);
                GDMFamilyRecord      family  = ctfLink.Family;

                int num = family.Children.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMIndividualLink childPtr = family.Children[i];

                    if (childPtr.XRef == currentXRef)
                    {
                        childPtr.XRef = targetXRef;
                    }
                }

                ctfLink.ResetOwner(targetIndi);
                targetIndi.ChildToFamilyLinks.Add(ctfLink);
            }

            while (fSpouseToFamilyLinks.Count > 0)
            {
                GDMSpouseToFamilyLink stfLink = fSpouseToFamilyLinks.Extract(0);
                GDMFamilyRecord       family  = stfLink.Family;

                if (family.Husband.XRef == currentXRef)
                {
                    family.Husband.XRef = targetXRef;
                }
                else if (family.Wife.XRef == currentXRef)
                {
                    family.Wife.XRef = targetXRef;
                }

                stfLink.ResetOwner(targetIndi);
                targetIndi.SpouseToFamilyLinks.Add(stfLink);
            }

            while (fAssociations.Count > 0)
            {
                GDMAssociation obj = fAssociations.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Associations.Add(obj);
            }

            while (fAliases.Count > 0)
            {
                GDMAlias obj = fAliases.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Aliases.Add(obj);
            }

            while (fGroups.Count > 0)
            {
                GDMPointer obj = fGroups.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Groups.Add(obj);
            }
        }
示例#10
0
        public override void MoveTo(GDMRecord targetRecord)
        {
            GDMIndividualRecord targetIndi = targetRecord as GDMIndividualRecord;

            if (targetIndi == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            base.MoveTo(targetRecord);

            targetIndi.Sex = fSex;

            while (fPersonalNames.Count > 0)
            {
                GDMPersonalName obj = fPersonalNames.Extract(0);
                targetIndi.AddPersonalName(obj);
            }

            string currentXRef = this.XRef;
            string targetXRef  = targetRecord.XRef;

            while (fChildToFamilyLinks.Count > 0)
            {
                GDMChildToFamilyLink ctfLink = fChildToFamilyLinks.Extract(0);
                var family = fTree.GetPtrValue <GDMFamilyRecord>(ctfLink);

                int num = family.Children.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMIndividualLink childPtr = family.Children[i];

                    if (childPtr.XRef == currentXRef)
                    {
                        childPtr.XRef = targetXRef;
                    }
                }

                targetIndi.ChildToFamilyLinks.Add(ctfLink);
            }

            while (fSpouseToFamilyLinks.Count > 0)
            {
                GDMSpouseToFamilyLink stfLink = fSpouseToFamilyLinks.Extract(0);
                var family = fTree.GetPtrValue <GDMFamilyRecord>(stfLink);

                if (family.Husband.XRef == currentXRef)
                {
                    family.Husband.XRef = targetXRef;
                }
                else if (family.Wife.XRef == currentXRef)
                {
                    family.Wife.XRef = targetXRef;
                }

                targetIndi.SpouseToFamilyLinks.Add(stfLink);
            }

            while (fAssociations.Count > 0)
            {
                GDMAssociation obj = fAssociations.Extract(0);
                targetIndi.Associations.Add(obj);
            }

            while (fGroups.Count > 0)
            {
                GDMPointer obj = fGroups.Extract(0);
                targetIndi.Groups.Add(obj);
            }
        }