示例#1
0
        public bool DeleteTaskRecord(GEDCOMTaskRecord taskRec)
        {
            if (taskRec == 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.Tasks.Count - 1; j >= 0; j--)
                    {
                        if (resRec.Tasks[j].Value == taskRec)
                        {
                            resRec.Tasks.DeleteAt(j);
                        }
                    }
                }
            }

            DeleteRecord(taskRec);
            return(true);
        }
        public void RemoveTask(GEDCOMTaskRecord taskRecord)
        {
            if (taskRecord == null)
            {
                return;
            }

            fTasks.DeleteAt(IndexOfTask(taskRecord));
        }
示例#3
0
        public GEDCOMTaskRecord CreateTask()
        {
            GEDCOMTaskRecord result = new GEDCOMTaskRecord(this, this, "", "");

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

            AddRecord(result);
            return(result);
        }
        public bool AddTask(GEDCOMTaskRecord taskRecord)
        {
            bool result = false;

            if (taskRecord != null)
            {
                GEDCOMPointer ptr = new GEDCOMPointer(Owner, this, "", "");
                ptr.SetNamedValue("_TASK", taskRecord);
                fTasks.Add(ptr);
                result = true;
            }

            return(result);
        }
        public int IndexOfTask(GEDCOMTaskRecord taskRec)
        {
            int result = -1;

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

            return(result);
        }