예제 #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);
        }
예제 #2
0
        public GEDCOMRepositoryRecord CreateRepository()
        {
            GEDCOMRepositoryRecord result = new GEDCOMRepositoryRecord(this, this, "", "");

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

            AddRecord(result);
            return(result);
        }
예제 #3
0
        public GEDCOMRepositoryCitation AddRepository(GEDCOMRepositoryRecord repRec)
        {
            GEDCOMRepositoryCitation cit = null;

            if (repRec != null)
            {
                cit       = new GEDCOMRepositoryCitation(Owner, this, "", "");
                cit.Value = repRec;
                RepositoryCitations.Add(cit);
            }

            return(cit);
        }
예제 #4
0
        public void RemoveRepository(GEDCOMRepositoryRecord repRec)
        {
            if (repRec == null)
            {
                throw new ArgumentNullException("repRec");
            }

            foreach (GEDCOMRepositoryCitation repCit in fRepositoryCitations)
            {
                GEDCOMRepositoryRecord rep = repCit.Value as GEDCOMRepositoryRecord;

                if (rep == repRec)
                {
                    fRepositoryCitations.Delete(repCit);
                    break;
                }
            }
        }