Beispiel #1
0
        public bool DeleteRepositoryRecord(GEDCOMRepositoryRecord repRec)
        {
            if (repRec == null)
            {
                return(false);
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = this[i];
                if (rec.RecordType == GEDCOMRecordType.rtSource)
                {
                    GEDCOMSourceRecord srcRec = (GEDCOMSourceRecord)rec;
                    for (int j = srcRec.RepositoryCitations.Count - 1; j >= 0; j--)
                    {
                        if (srcRec.RepositoryCitations[j].Value == repRec)
                        {
                            srcRec.RepositoryCitations.Delete(srcRec.RepositoryCitations[j]);
                        }
                    }
                }
            }

            DeleteRecord(repRec);
            return(true);
        }
Beispiel #2
0
        public GEDCOMSourceRecord CreateSource()
        {
            GEDCOMSourceRecord result = new GEDCOMSourceRecord(this, this, "", "");

            result.InitNew();
            result.ChangeDate.ChangeDateTime = DateTime.Now;

            AddRecord(result);
            return(result);
        }
        public override void MoveTo(GEDCOMRecord targetRecord, bool clearDest)
        {
            GEDCOMSourceRecord targetSource = targetRecord as GEDCOMSourceRecord;

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

            StringList titl = new StringList();
            StringList orig = new StringList();
            StringList publ = new StringList();
            StringList text = new StringList();

            try
            {
                titl.Text = (targetSource.Title.Text + "\n" + Title.Text).Trim();
                orig.Text = (targetSource.Originator.Text + "\n" + Originator.Text).Trim();
                publ.Text = (targetSource.Publication.Text + "\n" + Publication.Text).Trim();
                text.Text = (targetSource.Text.Text + "\n" + Text.Text).Trim();

                DeleteTag("TITL");
                DeleteTag("TEXT");
                DeleteTag("ABBR");
                DeleteTag("PUBL");
                DeleteTag("AUTH");

                base.MoveTo(targetRecord, clearDest);

                targetSource.Title       = titl;
                targetSource.Originator  = orig;
                targetSource.Publication = publ;
                targetSource.Text        = text;

                while (fRepositoryCitations.Count > 0)
                {
                    GEDCOMRepositoryCitation obj = fRepositoryCitations.Extract(0);
                    obj.ResetParent(targetSource);
                    targetSource.RepositoryCitations.Add(obj);
                }
            }
            finally
            {
                titl.Dispose();
                orig.Dispose();
                publ.Dispose();
                text.Dispose();
            }
        }
Beispiel #4
0
        public GEDCOMSourceCitation AddSource(GEDCOMSourceRecord sourceRec, string page, int quality)
        {
            GEDCOMSourceCitation cit = null;

            if (sourceRec != null)
            {
                cit       = new GEDCOMSourceCitation(Owner, this, "", "");
                cit.Value = sourceRec;
                cit.Page  = page;
                cit.CertaintyAssessment = quality;
                SourceCitations.Add(cit);
            }

            return(cit);
        }
Beispiel #5
0
        public int IndexOfSource(GEDCOMSourceRecord sourceRec)
        {
            if (sourceRec != null)
            {
                int num = fSourceCitations.Count;
                for (int i = 0; i < num; i++)
                {
                    if (fSourceCitations[i].XRef == sourceRec.XRef)
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
        public override float IsMatch(GEDCOMTag tag, MatchParams matchParams)
        {
            GEDCOMSourceRecord otherSource = tag as GEDCOMSourceRecord;

            if (otherSource == null)
            {
                return(0.0f);
            }

            float match = 0.0f;

            if (string.Compare(FiledByEntry, otherSource.FiledByEntry, true) == 0)
            {
                match = 100.0f;
            }

            return(match);
        }
Beispiel #7
0
        public bool DeleteSourceRecord(GEDCOMSourceRecord srcRec)
        {
            if (srcRec == null)
            {
                return(false);
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = this[i];
                for (int j = rec.SourceCitations.Count - 1; j >= 0; j--)
                {
                    if (rec.SourceCitations[j].Value == srcRec)
                    {
                        rec.SourceCitations.DeleteAt(j);
                    }
                }
            }

            DeleteRecord(srcRec);
            return(true);
        }