Example #1
0
        public void Test_ShowXInfo()
        {
            StringList summary = new StringList();

            summary.Clear();
            GKUtils.ShowFamilyInfo(fContext, null, null);
            GDMFamilyRecord famRec = fContext.Tree.XRefIndex_Find("F1") as GDMFamilyRecord;

            GKUtils.ShowFamilyInfo(fContext, famRec, summary);

            summary.Clear();
            GKUtils.ShowGroupInfo(null, null, null);
            GDMGroupRecord grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            GKUtils.ShowGroupInfo(fContext, grpRec, summary);

            summary.Clear();
            GKUtils.ShowMultimediaInfo(null, null, null);
            GDMMultimediaRecord mmRec = fContext.Tree.XRefIndex_Find("O1") as GDMMultimediaRecord;

            GKUtils.ShowMultimediaInfo(fContext, mmRec, summary);

            summary.Clear();
            GKUtils.ShowNoteInfo(null, null, null);
            GDMNoteRecord noteRec = fContext.Tree.XRefIndex_Find("N1") as GDMNoteRecord;

            GKUtils.ShowNoteInfo(fContext, noteRec, summary);

            summary.Clear();
            GKUtils.ShowPersonInfo(fContext, null, null);
            GDMIndividualRecord indRec = fContext.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;

            GKUtils.ShowPersonInfo(fContext, indRec, summary);

            summary.Clear();
            GKUtils.ShowSourceInfo(null, null, null);
            GDMSourceRecord srcRec = fContext.Tree.XRefIndex_Find("S1") as GDMSourceRecord;

            GKUtils.ShowSourceInfo(fContext, srcRec, summary);

            summary.Clear();
            GKUtils.ShowRepositoryInfo(null, null, null);
            GDMRepositoryRecord repRec = fContext.Tree.XRefIndex_Find("R1") as GDMRepositoryRecord;

            GKUtils.ShowRepositoryInfo(fContext, repRec, summary);

            summary.Clear();
            GKUtils.ShowResearchInfo(null, null, null);
            GDMResearchRecord resRec = fContext.Tree.XRefIndex_Find("RS1") as GDMResearchRecord;

            GKUtils.ShowResearchInfo(fContext, resRec, summary);

            summary.Clear();
            GKUtils.ShowTaskInfo(null, null, null);
            GDMTaskRecord taskRec = fContext.Tree.XRefIndex_Find("TK1") as GDMTaskRecord;

            GKUtils.ShowTaskInfo(fContext, taskRec, summary);

            summary.Clear();
            GKUtils.ShowCommunicationInfo(null, null, null);
            GDMCommunicationRecord commRec = fContext.Tree.XRefIndex_Find("CM1") as GDMCommunicationRecord;

            GKUtils.ShowCommunicationInfo(fContext, commRec, summary);

            summary.Clear();
            GKUtils.ShowLocationInfo(null, null, null);
            GDMLocationRecord locRec = fContext.Tree.XRefIndex_Find("L1") as GDMLocationRecord;

            GKUtils.ShowLocationInfo(fContext, locRec, summary);
        }
        public override void UpdateView()
        {
            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;
            GlobalOptions        options = GlobalOptions.Instance;

            fView.NameCombo.Clear();
            fView.NameCombo.Add("*");
            fView.NameCombo.AddStrings(options.NameFilters);

            fView.ResidenceCombo.Clear();
            fView.ResidenceCombo.Add("*");
            fView.ResidenceCombo.AddStrings(options.ResidenceFilters);

            fView.EventValCombo.Clear();
            fView.EventValCombo.AddStrings(options.EventFilters);

            int lifeSel;

            if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                lifeSel = (int)iFilter.FilterLifeMode;
                fView.SetLifeEnabled(true);
                fView.AliveBeforeDate.Text = iFilter.AliveBeforeDate;
            }
            else
            {
                lifeSel = -1;
                fView.SetLifeEnabled(false);
                fView.AliveBeforeDate.Text = "";
            }

            fView.SetLifeRadio(lifeSel);
            fView.SetSexRadio((int)iFilter.Sex);

            fView.NameCombo.Text              = iFilter.Name;
            fView.ResidenceCombo.Text         = iFilter.Residence;
            fView.EventValCombo.Text          = iFilter.EventVal;
            fView.OnlyPatriarchsCheck.Checked = iFilter.PatriarchOnly;

            GDMTree tree = Base.Context.Tree;

            var values = new StringList();

            fView.GroupCombo.Clear();
            int num = tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GDMRecord rec = tree[i];
                if (rec is GDMGroupRecord)
                {
                    values.AddObject((rec as GDMGroupRecord).GroupName, rec);
                }
            }
            values.Sort();
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcAny), null);
            fView.GroupCombo.AddStrings(values);
            if (iFilter.FilterGroupMode != FilterGroupMode.Selected)
            {
                fView.GroupCombo.SelectedIndex = (int)iFilter.FilterGroupMode;
            }
            else
            {
                GDMGroupRecord groupRec = tree.XRefIndex_Find(iFilter.GroupRef) as GDMGroupRecord;
                if (groupRec != null)
                {
                    fView.GroupCombo.Text = groupRec.GroupName;
                }
            }

            values = new StringList();
            fView.SourceCombo.Clear();
            for (int i = 0; i < tree.RecordsCount; i++)
            {
                GDMRecord rec = tree[i];
                if (rec is GDMSourceRecord)
                {
                    values.AddObject((rec as GDMSourceRecord).ShortTitle, rec);
                }
            }
            values.Sort();
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcAny), null);
            fView.SourceCombo.AddStrings(values);
            if (iFilter.SourceMode != FilterGroupMode.Selected)
            {
                fView.SourceCombo.SelectedIndex = (int)iFilter.SourceMode;
            }
            else
            {
                GDMSourceRecord sourceRec = tree.XRefIndex_Find(iFilter.SourceRef) as GDMSourceRecord;
                if (sourceRec != null)
                {
                    fView.SourceCombo.Text = sourceRec.ShortTitle;
                }
            }
        }
Example #3
0
        // TODO: rollback changes when exception!
        private void ParseSource()
        {
            int srcYear;

            if (!int.TryParse(edSourceYear.Text, out srcYear))
            {
                ShowError(fLangMan.LS(FLS.LSID_SourceYearInvalid));
                return;
            }

            string srcName = cbSource.Text;
            string srcPage = edPage.Text;
            string place   = edPlace.Text;

            GDMSourceRecord srcRec = null;

            if (!string.IsNullOrEmpty(srcName))
            {
                srcRec = fBase.Context.FindSource(srcName);
                if (srcRec == null)
                {
                    srcRec            = fBase.Context.Tree.CreateSource();
                    srcRec.ShortTitle = srcName;
                }
            }

            GDMIndividualRecord iMain = null;

            int num = dataGridView1.Rows.Count;

            for (int r = 0; r < num; r++)
            {
                DataGridViewRow row = dataGridView1.Rows[r];

                string lnk     = CheckStr((string)row.Cells[0].Value);
                string nm      = CheckStr((string)row.Cells[1].Value);
                string pt      = CheckStr((string)row.Cells[2].Value);
                string fm      = CheckStr((string)row.Cells[3].Value);
                string age     = CheckStr((string)row.Cells[4].Value);
                string comment = CheckStr((string)row.Cells[5].Value);

                if (!string.IsNullOrEmpty(lnk))
                {
                    PersonLink link = GetLinkByName(lnk);
                    if (link == PersonLink.plNone)
                    {
                        continue;
                    }

                    GDMSex sx = fBase.Context.DefineSex(nm, pt);
                    GDMIndividualRecord iRec = fBase.Context.CreatePersonEx(nm, pt, fm, sx, false);

                    if (!string.IsNullOrEmpty(age) && ConvertHelper.IsDigits(age))
                    {
                        int birthYear = srcYear - int.Parse(age);
                        fBase.Context.CreateEventEx(iRec, GEDCOMTagName.BIRT, "ABT " + birthYear.ToString(), "");
                    }

                    if (!string.IsNullOrEmpty(place))
                    {
                        GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, GEDCOMTagName.RESI, "", "");
                        evt.Place.StringValue = place;
                    }

                    if (!string.IsNullOrEmpty(comment))
                    {
                        GDMNoteRecord noteRec = fBase.Context.Tree.CreateNote();
                        noteRec.SetNoteText(comment);
                        iRec.AddNote(noteRec);
                    }

                    if (srcRec != null)
                    {
                        iRec.AddSource(srcRec, srcPage, 0);
                    }

                    fBase.NotifyRecord(iRec, RecordAction.raAdd);

                    GDMFamilyRecord family = null;

                    if (link == PersonLink.plPerson)
                    {
                        iMain = iRec;
                        string evName = "";

                        if (rbSK_Met.Checked)
                        {
                            switch (cbEventType.SelectedIndex)
                            {
                            case  0:
                                evName = GEDCOMTagName.BIRT;
                                break;

                            case  1:
                                evName = GEDCOMTagName.DEAT;
                                break;

                            case  2:
                                evName = GEDCOMTagName.MARR;
                                break;
                            }
                        }

                        if (evName == GEDCOMTagName.BIRT || evName == GEDCOMTagName.DEAT)
                        {
                            GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), "");
                            evt.Place.StringValue = place;
                        }
                        else if (evName == GEDCOMTagName.MARR)
                        {
                            family = fBase.Context.GetMarriageFamily(iRec, true);
                            GDMCustomEvent evt = fBase.Context.CreateEventEx(family, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), "");
                            evt.Place.StringValue = place;
                        }
                    }
                    else
                    {
                        if (iMain == null)
                        {
                            throw new PersonScanException(fLangMan.LS(FLS.LSID_BasePersonInvalid));
                        }
                        else
                        {
                            switch (link)
                            {
                            case PersonLink.plFather:
                            case PersonLink.plMother:
                                family = fBase.Context.GetParentsFamily(iMain, true);
                                family.AddSpouse(iRec);
                                break;

                            case PersonLink.plGodparent:
                                iMain.AddAssociation(fLangMan.LS(FLS.LSID_PLGodparent), iRec);
                                break;

                            case PersonLink.plSpouse:
                                family = fBase.Context.GetMarriageFamily(iMain, true);
                                family.AddSpouse(iRec);
                                break;

                            case PersonLink.plChild:
                                family = fBase.Context.GetMarriageFamily(iMain, true);
                                family.AddChild(iRec);
                                break;
                            }
                        }
                    }
                }
            }

            InitSourceControls();
        }
Example #4
0
        private void PrepareData()
        {
            mainIndex = new StringList();
            byIndex   = new StringList();
            dyIndex   = new StringList();

            bpIndex = new StringList();
            dpIndex = new StringList();

            deathCauses  = new StringList();
            occuIndex    = new StringList();
            reliIndex    = new StringList();
            sourcesIndex = new StringList();

            GDMRecord rec;

            var iEnum = fTree.GetEnumerator(GDMRecordType.rtIndividual);

            while (iEnum.MoveNext(out rec))
            {
                GDMIndividualRecord iRec = (GDMIndividualRecord)rec;
                string text = GKUtils.GetNameString(iRec, true, false);
                string st;

                mainIndex.AddObject(text, iRec);

                int evNum = iRec.Events.Count;
                for (int k = 0; k < evNum; k++)
                {
                    GDMCustomEvent evt = iRec.Events[k];
                    if (evt == null)
                    {
                        continue;
                    }

                    int srcNum2 = evt.SourceCitations.Count;
                    for (int m = 0; m < srcNum2; m++)
                    {
                        GDMSourceRecord src = evt.SourceCitations[m].Value as GDMSourceRecord;
                        if (src == null)
                        {
                            continue;
                        }

                        st = src.ShortTitle;
                        if (string.IsNullOrEmpty(st))
                        {
                            st = src.Title.Lines.Text;
                        }
                        PrepareSpecIndex(sourcesIndex, st, iRec);
                    }

                    // The analysis places
                    // st = ev.Detail.Place.StringValue;
                    // if (!string.IsNullOrEmpty(st)) PrepareSpecIndex(places, st, iRec);

                    var evtType = evt.GetTagType();
                    if (evtType == GEDCOMTagType.BIRT)
                    {
                        // Analysis on births
                        PrepareEventYear(byIndex, evt, iRec);
                        st = GKUtils.GetPlaceStr(evt, false);
                        if (!string.IsNullOrEmpty(st))
                        {
                            PrepareSpecIndex(bpIndex, st, iRec);
                        }
                    }
                    else if (evtType == GEDCOMTagType.DEAT)
                    {
                        // Analysis by causes of death
                        PrepareEventYear(dyIndex, evt, iRec);
                        st = GKUtils.GetPlaceStr(evt, false);
                        if (!string.IsNullOrEmpty(st))
                        {
                            PrepareSpecIndex(dpIndex, st, iRec);
                        }

                        st = evt.Cause;
                        if (!string.IsNullOrEmpty(st))
                        {
                            PrepareSpecIndex(deathCauses, st, iRec);
                        }
                    }
                    else if (evtType == GEDCOMTagType.OCCU)
                    {
                        // Analysis by occupation
                        st = evt.StringValue;
                        if (!string.IsNullOrEmpty(st))
                        {
                            PrepareSpecIndex(occuIndex, st, iRec);
                        }
                    }
                    else if (evtType == GEDCOMTagType.RELI)
                    {
                        // Analysis by religion
                        st = evt.StringValue;
                        if (!string.IsNullOrEmpty(st))
                        {
                            PrepareSpecIndex(reliIndex, st, iRec);
                        }
                    }
                }

                int srcNum = iRec.SourceCitations.Count;
                for (int k = 0; k < srcNum; k++)
                {
                    GDMSourceRecord src = iRec.SourceCitations[k].Value as GDMSourceRecord;
                    if (src == null)
                    {
                        continue;
                    }

                    st = src.ShortTitle;
                    if (string.IsNullOrEmpty(st))
                    {
                        st = src.Title.Lines.Text;
                    }
                    PrepareSpecIndex(sourcesIndex, st, iRec);
                }
            }

            mainIndex.Sort();

            BookCatalogs[(int)BookCatalog.Catalog_BirthYears].Index  = byIndex;
            BookCatalogs[(int)BookCatalog.Catalog_DeathYears].Index  = dyIndex;
            BookCatalogs[(int)BookCatalog.Catalog_BirthPlaces].Index = bpIndex;
            BookCatalogs[(int)BookCatalog.Catalog_DeathPlaces].Index = dpIndex;
            BookCatalogs[(int)BookCatalog.Catalog_DeathCauses].Index = deathCauses;
            BookCatalogs[(int)BookCatalog.Catalog_Occupations].Index = occuIndex;
            BookCatalogs[(int)BookCatalog.Catalog_Religion].Index    = reliIndex;
            BookCatalogs[(int)BookCatalog.Catalog_Sources].Index     = sourcesIndex;
        }
Example #5
0
 public override void Fetch(GDMRecord aRec)
 {
     fRec = (aRec as GDMSourceRecord);
 }
Example #6
0
        public static GDMRecord AddRecord(IBaseWindow baseWin, GDMRecordType rt, Target target)
        {
            bool      result = false;
            GDMRecord rec    = null;

            switch (rt)
            {
            case GDMRecordType.rtIndividual:
            {
                // FIXME: legacy code, checkit
                if (target == null)
                {
                    target            = new Target();
                    target.TargetMode = TargetMode.tmParent;
                }

                GDMIndividualRecord indivRec = null;
                result = ModifyIndividual(baseWin, ref indivRec, target.TargetIndividual, target.TargetMode, target.NeedSex);
                rec    = indivRec;
                break;
            }

            case GDMRecordType.rtFamily:
            {
                if (target == null)
                {
                    target = new Target();
                }

                TargetMode famTarget = (target.TargetMode != TargetMode.tmFamilyChild) ? TargetMode.tmNone : target.TargetMode;

                GDMFamilyRecord fam = null;
                result = ModifyFamily(baseWin, ref fam, famTarget, target.TargetIndividual);
                rec    = fam;
                break;
            }

            case GDMRecordType.rtNote:
            {
                GDMNoteRecord note = null;
                result = ModifyNote(baseWin, ref note);
                rec    = note;
                break;
            }

            case GDMRecordType.rtMultimedia:
            {
                GDMMultimediaRecord mmRec = null;
                result = ModifyMedia(baseWin, ref mmRec);
                rec    = mmRec;
                break;
            }

            case GDMRecordType.rtSource:
            {
                GDMSourceRecord src = null;
                result = ModifySource(baseWin, ref src);
                rec    = src;
                break;
            }

            case GDMRecordType.rtRepository:
            {
                GDMRepositoryRecord rep = null;
                result = ModifyRepository(baseWin, ref rep);
                rec    = rep;
                break;
            }

            case GDMRecordType.rtGroup:
            {
                GDMGroupRecord grp = null;
                result = ModifyGroup(baseWin, ref grp);
                rec    = grp;
                break;
            }

            case GDMRecordType.rtResearch:
            {
                GDMResearchRecord rsr = null;
                result = ModifyResearch(baseWin, ref rsr);
                rec    = rsr;
                break;
            }

            case GDMRecordType.rtTask:
            {
                GDMTaskRecord tsk = null;
                result = ModifyTask(baseWin, ref tsk);
                rec    = tsk;
                break;
            }

            case GDMRecordType.rtCommunication:
            {
                GDMCommunicationRecord comm = null;
                result = ModifyCommunication(baseWin, ref comm);
                rec    = comm;
                break;
            }

            case GDMRecordType.rtLocation:
            {
                GDMLocationRecord loc = null;
                result = ModifyLocation(baseWin, ref loc);
                rec    = loc;
                break;
            }
            }

            return((result) ? rec : null);
        }
Example #7
0
 public static int CountAllMFRs(this GDMSourceRecord sourRec)
 {
     return(0);
 }
Example #8
0
        public static GDMSourceCitation AddSource(this IGDMStructWithSourceCitations _struct, GDMSourceRecord sourceRec, string page, int quality)
        {
            GDMSourceCitation cit = null;

            if (sourceRec != null)
            {
                cit      = new GDMSourceCitation();
                cit.XRef = sourceRec.XRef;
                cit.Page = page;
                cit.CertaintyAssessment = quality;
                _struct.SourceCitations.Add(cit);
            }

            return(cit);
        }
Example #9
0
        public static void FillContext(IBaseContext context)
        {
            // a null result if the record is not defined
            GDMCustomEvent evt = context.CreateEventEx(null, GEDCOMTagName.BIRT, "xxxxx", "xxxxx");

            Assert.IsNull(evt);

            // first individual (I1)
            GDMIndividualRecord iRec = context.CreatePersonEx("Ivan", "Ivanovich", "Ivanov", GDMSex.svMale, true);

            Assert.IsNotNull(iRec);

            evt = iRec.FindEvent(GEDCOMTagType.BIRT);
            Assert.IsNotNull(evt);
            evt.Date.ParseString("28 DEC 1990");
            evt.Place.StringValue = "Ivanovo";

            GDMCustomEvent evtd = context.CreateEventEx(iRec, GEDCOMTagName.DEAT, "28 DEC 2010", "Ivanovo");

            Assert.IsNotNull(evtd);

            // second individual, wife (I2)
            GDMIndividualRecord iRec2 = context.CreatePersonEx("Maria", "Petrovna", "Ivanova", GDMSex.svFemale, true);

            evt = iRec2.FindEvent(GEDCOMTagType.BIRT);
            Assert.IsNotNull(evt);
            evt.Date.ParseString("17 MAR 1991");
            evt.Place.StringValue = "Ivanovo";

            iRec.AddAssociation("spouse", iRec2);

            // third individual, child (I3)
            GDMIndividualRecord iRec3 = context.CreatePersonEx("Anna", "Ivanovna", "Ivanova", GDMSex.svFemale, true);

            evt = iRec3.FindEvent(GEDCOMTagType.BIRT);
            Assert.IsNotNull(evt);
            evt.Date.ParseString("11 FEB 2010");
            evt.Place.StringValue = "Ivanovo";

            // their family
            GDMFamilyRecord famRec = context.Tree.CreateFamily();

            Assert.IsNotNull(famRec);
            famRec.AddSpouse(iRec);
            famRec.AddSpouse(iRec2);
            famRec.AddChild(iRec3);

            context.CreateEventEx(famRec, GEDCOMTagName.MARR, "01 JAN 2000", "unknown");

            // individual outside the family (I4)
            GDMIndividualRecord iRec4 = context.CreatePersonEx("Alex", "", "Petrov", GDMSex.svMale, true);

            evt = iRec4.FindEvent(GEDCOMTagType.BIRT);
            Assert.IsNotNull(evt);
            evt.Date.ParseString("15 JUN 1989");
            evt.Place.StringValue = "Far Forest";

            evt = context.CreateEventEx(iRec4, GEDCOMTagName.RESI, "12 FEB", "Far Forest");
            Assert.IsNotNull(evt);

            // fifth (I5)
            GDMIndividualRecord iRec5 = context.CreatePersonEx("Anna", "", "Jones", GDMSex.svFemale, false);

            Assert.IsNotNull(iRec5);

            // sixth (I6)
            GDMIndividualRecord iRec6 = context.CreatePersonEx("Mary", "", "Jones", GDMSex.svFemale, false);

            Assert.IsNotNull(iRec6);
            evt = context.CreateEventEx(iRec6, GEDCOMTagName.BIRT, "12 FEB 1650", "Far Forest");

            GDMFamilyRecord famRec2 = context.Tree.CreateFamily();

            Assert.IsNotNull(famRec2);
            famRec2.AddSpouse(iRec3);
            //famRec2.AddSpouse(iRec4);
            famRec2.AddChild(iRec5);
            famRec2.AddChild(iRec6);

            // group for tests
            GDMGroupRecord groupRec = context.Tree.CreateGroup();

            groupRec.GroupName = "GroupTest";
            Assert.IsNotNull(groupRec, "group1 != null");
            groupRec.AddMember(iRec);

            // location for tests
            GDMLocationRecord locRec = context.Tree.CreateLocation();

            locRec.LocationName = "Test Location";
            locRec.Map.Lati     = 5.11111;
            locRec.Map.Long     = 7.99999;
            Assert.IsNotNull(locRec, "locRec != null");

            // repository for tests
            GDMRepositoryRecord repoRec = context.Tree.CreateRepository();

            repoRec.RepositoryName = "Test repository";
            Assert.IsNotNull(repoRec, "repoRec != null");

            // research for tests
            GDMResearchRecord resRec = context.Tree.CreateResearch();

            resRec.ResearchName = "Test research";
            Assert.IsNotNull(resRec, "resRec != null");

            // source for tests
            GDMSourceRecord srcRec = context.Tree.CreateSource();

            srcRec.ShortTitle = "Test source";
            Assert.IsNotNull(srcRec, "srcRec != null");
            iRec.AddSource(srcRec, "p1", 0);

            // note for tests
            GDMNoteRecord noteRec = context.Tree.CreateNote();

            noteRec.SetNoteText("Test note");
            Assert.IsNotNull(noteRec, "noteRec != null");
            iRec.AddNote(noteRec);

            // task for tests
            GDMTaskRecord tskRec = context.Tree.CreateTask();

            tskRec.Goal = "Test task";
            Assert.IsNotNull(tskRec, "tskRec != null");

            // media for tests
            GDMMultimediaRecord mediaRec = context.Tree.CreateMultimedia();

            mediaRec.FileReferences.Add(new GDMFileReferenceWithTitle());
            GDMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0];

            fileRef.Title = "Test multimedia";
            fileRef.LinkFile("sample.png");
            Assert.IsNotNull(mediaRec, "mediaRec != null");
            iRec.AddMultimedia(mediaRec);

            // communication for tests
            GDMCommunicationRecord commRec = context.Tree.CreateCommunication();

            commRec.CommName = "Test communication";
            Assert.IsNotNull(commRec, "commRec != null");
        }
Example #10
0
        public object gt_find_source(string name)
        {
            GDMSourceRecord srcRec = fBase.Context.FindSource(name);

            return(srcRec);
        }
Example #11
0
        private void GenStep(PedigreePerson parent, GDMIndividualRecord iRec, int level, int familyOrder)
        {
            if (iRec == null)
            {
                return;
            }

            PedigreePerson res = new PedigreePerson();

            res.Parent      = parent;
            res.IRec        = iRec;
            res.Level       = level;
            res.ChildIdx    = 0;
            res.FamilyOrder = familyOrder;
            fPersonList.Add(res);

            if (fOptions.PedigreeOptions.IncludeSources)
            {
                int num = iRec.SourceCitations.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMSourceRecord sourceRec = iRec.SourceCitations[i].Value as GDMSourceRecord;
                    if (sourceRec == null)
                    {
                        continue;
                    }

                    string srcName = GKUtils.MergeStrings(sourceRec.Title.Lines);
                    if (srcName == "")
                    {
                        srcName = sourceRec.ShortTitle;
                    }

                    int j = fSourceList.IndexOf(srcName);
                    if (j < 0)
                    {
                        j = fSourceList.Add(srcName);
                    }

                    res.Sources.Add((j + 1).ToString());
                }
            }

            if (fKind == PedigreeKind.pkAscend)
            {
                if (iRec.ChildToFamilyLinks.Count > 0)
                {
                    GDMFamilyRecord family = iRec.ChildToFamilyLinks[0].Family;
                    if (fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        GDMIndividualRecord prnt;

                        prnt = family.Wife.Individual;
                        GenStep(res, prnt, level + 1, 1);

                        prnt = family.Husband.Individual;
                        GenStep(res, prnt, level + 1, 1);
                    }
                }
            }
            else
            {
                int num2 = iRec.SpouseToFamilyLinks.Count;
                for (int j = 0; j < num2; j++)
                {
                    GDMFamilyRecord family = iRec.SpouseToFamilyLinks[j].Family;
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    fBase.Context.ProcessFamily(family);

                    int num3 = family.Children.Count;
                    for (int i = 0; i < num3; i++)
                    {
                        GDMIndividualRecord child = family.Children[i].Individual;
                        GenStep(res, child, level + 1, i + 1);
                    }
                }
            }
        }
Example #12
0
 public CreatorRecordSource(GDMTree tree, IProgressCallback progress, string w3cFile, GDMSourceRecord sr) : base(tree, progress, w3cFile)
 {
     fSourceRecord = sr;
 }
Example #13
0
        public override void UpdateView()
        {
            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;
            GlobalOptions        options = GlobalOptions.Instance;

            fView.NameCombo.Clear();
            fView.NameCombo.Add("*");
            fView.NameCombo.AddStrings(options.NameFilters);

            fView.ResidenceCombo.Clear();
            fView.ResidenceCombo.Add("*");
            fView.ResidenceCombo.AddStrings(options.ResidenceFilters);

            fView.EventValCombo.Clear();
            fView.EventValCombo.AddStrings(options.EventFilters);

            int lifeSel;

            if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                lifeSel = (int)iFilter.FilterLifeMode;
                fView.SetLifeEnabled(true);
                fView.AliveBeforeDate.Text = iFilter.AliveBeforeDate;
            }
            else
            {
                lifeSel = -1;
                fView.SetLifeEnabled(false);
                fView.AliveBeforeDate.Text = "";
            }

            fView.SetLifeRadio(lifeSel);
            fView.SetSexRadio((int)iFilter.Sex);

            fView.NameCombo.Text              = iFilter.Name;
            fView.ResidenceCombo.Text         = iFilter.Residence;
            fView.EventValCombo.Text          = iFilter.EventVal;
            fView.OnlyPatriarchsCheck.Checked = iFilter.PatriarchOnly;

            GDMTree tree = Base.Context.Tree;

            fView.GroupCombo.Clear();
            fView.GroupCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.GroupCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.GroupCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcAny), null);
            var groups = GKUtils.GetGroups(tree);

            foreach (var item in groups)
            {
                fView.GroupCombo.AddItem <GDMRecord>(item.GroupName, item);
            }

            if (iFilter.FilterGroupMode != FilterGroupMode.Selected)
            {
                fView.GroupCombo.SelectedIndex = (int)iFilter.FilterGroupMode;
            }
            else
            {
                GDMGroupRecord groupRec = tree.XRefIndex_Find(iFilter.GroupRef) as GDMGroupRecord;
                if (groupRec != null)
                {
                    fView.GroupCombo.Text = groupRec.GroupName;
                }
            }

            fView.SourceCombo.Clear();
            fView.SourceCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.SourceCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.SourceCombo.AddItem <GDMRecord>(LangMan.LS(LSID.LSID_SrcAny), null);
            var sources = GKUtils.GetSources(tree);

            foreach (var item in sources)
            {
                fView.SourceCombo.AddItem <GDMRecord>(item.ShortTitle, item);
            }

            if (iFilter.SourceMode != FilterGroupMode.Selected)
            {
                fView.SourceCombo.SelectedIndex = (int)iFilter.SourceMode;
            }
            else
            {
                GDMSourceRecord sourceRec = tree.XRefIndex_Find(iFilter.SourceRef) as GDMSourceRecord;
                if (sourceRec != null)
                {
                    fView.SourceCombo.Text = sourceRec.ShortTitle;
                }
            }
        }
Example #14
0
        public static bool EditRecord(IBaseWindow baseWin, GDMRecord rec)
        {
            bool result = false;

            switch (rec.RecordType)
            {
            case GDMRecordType.rtIndividual:
                GDMIndividualRecord ind = rec as GDMIndividualRecord;
                result = ModifyIndividual(baseWin, ref ind, null, TargetMode.tmNone, GDMSex.svUnknown);
                break;

            case GDMRecordType.rtFamily:
                GDMFamilyRecord fam = rec as GDMFamilyRecord;
                result = ModifyFamily(baseWin, ref fam, TargetMode.tmNone, null);
                break;

            case GDMRecordType.rtNote:
                GDMNoteRecord note = rec as GDMNoteRecord;
                result = ModifyNote(baseWin, ref note);
                break;

            case GDMRecordType.rtMultimedia:
                GDMMultimediaRecord mmRec = rec as GDMMultimediaRecord;
                result = ModifyMedia(baseWin, ref mmRec);
                break;

            case GDMRecordType.rtSource:
                GDMSourceRecord src = rec as GDMSourceRecord;
                result = ModifySource(baseWin, ref src);
                break;

            case GDMRecordType.rtRepository:
                GDMRepositoryRecord rep = rec as GDMRepositoryRecord;
                result = ModifyRepository(baseWin, ref rep);
                break;

            case GDMRecordType.rtGroup:
                GDMGroupRecord grp = rec as GDMGroupRecord;
                result = ModifyGroup(baseWin, ref grp);
                break;

            case GDMRecordType.rtResearch:
                GDMResearchRecord rsr = rec as GDMResearchRecord;
                result = ModifyResearch(baseWin, ref rsr);
                break;

            case GDMRecordType.rtTask:
                GDMTaskRecord tsk = rec as GDMTaskRecord;
                result = ModifyTask(baseWin, ref tsk);
                break;

            case GDMRecordType.rtCommunication:
                GDMCommunicationRecord comm = rec as GDMCommunicationRecord;
                result = ModifyCommunication(baseWin, ref comm);
                break;

            case GDMRecordType.rtLocation:
                GDMLocationRecord loc = rec as GDMLocationRecord;
                result = ModifyLocation(baseWin, ref loc);
                break;
            }

            return(result);
        }
Example #15
0
 private static int ItemsCompare(GDMSourceRecord item1, GDMSourceRecord item2)
 {
     return(item1.ShortTitle.CompareTo(item2.ShortTitle));
 }
Example #16
0
        public static List <BackReference> GetBackReferences(this GDMSourceRecord record)
        {
            var result = new List <BackReference>();

            return(result);
        }
Example #17
0
        public void Test_FindSource()
        {
            GDMSourceRecord srcRec = fContext.FindSource("test source");

            Assert.IsNull(srcRec);
        }
Example #18
0
 public static GDMSourceCitation FindSourceCitation(this IGDMStructWithSourceCitations _struct, GDMSourceRecord sourceRec)
 {
     if (sourceRec != null && _struct.HasSourceCitations)
     {
         int num = _struct.SourceCitations.Count;
         for (int i = 0; i < num; i++)
         {
             var sourCit = _struct.SourceCitations[i];
             if (sourCit.XRef == sourceRec.XRef)
             {
                 return(sourCit);
             }
         }
     }
     return(null);
 }