Beispiel #1
0
        public bool DeleteCommunicationRecord(GEDCOMCommunicationRecord commRec)
        {
            if (commRec == null)
            {
                return(false);
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = this[i];
                if (rec.RecordType == GEDCOMRecordType.rtResearch)
                {
                    GEDCOMResearchRecord resRec = (GEDCOMResearchRecord)rec;
                    for (int j = resRec.Communications.Count - 1; j >= 0; j--)
                    {
                        if (resRec.Communications[j].Value == commRec)
                        {
                            resRec.Communications.DeleteAt(j);
                        }
                    }
                }
            }

            DeleteRecord(commRec);
            return(true);
        }
        public void RemoveCommunication(GEDCOMCommunicationRecord commRecord)
        {
            if (commRecord == null)
            {
                return;
            }

            fCommunications.DeleteAt(IndexOfCommunication(commRecord));
        }
Beispiel #3
0
        public GEDCOMCommunicationRecord CreateCommunication()
        {
            GEDCOMCommunicationRecord result = new GEDCOMCommunicationRecord(this, this, "", "");

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

            AddRecord(result);
            return(result);
        }
        public bool AddCommunication(GEDCOMCommunicationRecord commRecord)
        {
            bool result = false;

            if (commRecord != null)
            {
                GEDCOMPointer ptr = new GEDCOMPointer(Owner, this, "", "");
                ptr.SetNamedValue("_COMM", commRecord);
                fCommunications.Add(ptr);
                result = true;
            }

            return(result);
        }
        public int IndexOfCommunication(GEDCOMCommunicationRecord commRec)
        {
            int result = -1;

            if (commRec != null)
            {
                int num = fCommunications.Count;
                for (int i = 0; i < num; i++)
                {
                    if (fCommunications[i].XRef == commRec.XRef)
                    {
                        result = i;
                        break;
                    }
                }
            }

            return(result);
        }