Ejemplo n.º 1
0
 public PersonalEvent(EventType type, GEDCOMRecord rec, GEDCOMCustomEvent evt)
 {
     Type  = type;
     Rec   = rec;
     Event = evt;
     Date  = (evt == null) ? UDN.CreateEmpty() : evt.Date.GetUDN();
 }
        public void CreateLocationRecord()
        {
            PlaceObj pObj = fView.PlacesList.GetSelectedData() as PlaceObj;

            if (pObj == null)
            {
                return;
            }

            if (pObj.Name.IndexOf("[*]") == 0)
            {
                AppHost.StdDialogs.ShowMessage(LangMan.LS(LSID.LSID_PlaceAlreadyInBook));
            }
            else
            {
                GEDCOMLocationRecord loc = fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, new object[] { pObj.Name }) as GEDCOMLocationRecord;
                if (loc == null)
                {
                    return;
                }

                int num = pObj.Facts.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = pObj.Facts[i];
                    evt.Place.StringValue    = loc.LocationName;
                    evt.Place.Location.Value = loc;
                }

                CheckPlaces();
                fBase.RefreshLists(false);
            }
        }
Ejemplo n.º 3
0
        public object gt_create_event(object recPtr, string sign)
        {
            GEDCOMRecordWithEvents rec = recPtr as GEDCOMRecordWithEvents;
            GEDCOMCustomEvent      evt = fBase.Context.CreateEventEx(rec, sign, "", "");

            return(evt);
        }
Ejemplo n.º 4
0
        private void UpdateControls()
        {
            try
            {
                lvEvents.BeginUpdate();

                lvEvents.Clear();
                lvEvents.AddColumn(fPlugin.LangMan.LS(CLS.LSID_Date), 80, false);
                lvEvents.AddColumn(fPlugin.LangMan.LS(CLS.LSID_Event), 90, false);
                lvEvents.AddColumn(fPlugin.LangMan.LS(CLS.LSID_Description), 130, false);
                lvEvents.AddColumn(fPlugin.LangMan.LS(CLS.LSID_Place), 200, false);
                lvEvents.AddColumn(fPlugin.LangMan.LS(CLS.LSID_Cause), 130, false);

                for (int i = 0; i < fEvents.Count; i++)
                {
                    EventRecord       eventRec = fEvents[i];
                    GEDCOMCustomEvent evt      = eventRec.Event;

                    lvEvents.AddItem(eventRec, new object[] { new GEDCOMDateItem(evt.Date.Value),
                                                              GKUtils.GetEventName(evt),
                                                              GKUtils.GetRecordName(eventRec.Record, false),
                                                              evt.Place.StringValue,
                                                              GKUtils.GetEventCause(evt) });
                }

                lvEvents.ResizeColumn(0);
            }
            finally
            {
                lvEvents.EndUpdate();
            }
        }
Ejemplo n.º 5
0
        public void Test_GEDCOMEventToDateStr()
        {
            GEDCOMIndividualRecord iRec = fContext.Tree.XRefIndex_Find("I1") as GEDCOMIndividualRecord;

            GEDCOMCustomEvent evt = iRec.FindEvent("BIRT");

            Assert.IsNotNull(evt);

            string st2 = GKUtils.GEDCOMEventToDateStr(null, DateFormat.dfYYYY_MM_DD, false);

            Assert.AreEqual("", st2);

            st2 = GKUtils.GEDCOMEventToDateStr(evt, DateFormat.dfYYYY_MM_DD, false);
            Assert.AreEqual("1990.12.28", st2);

            evt.Cause = "test cause";
            st2       = GKUtils.GetEventCause(evt);
            Assert.AreEqual("test cause", st2);

            string ds = GKUtils.GEDCOMEventToDateStr(evt, DateFormat.dfDD_MM_YYYY, false);

            Assert.AreEqual("28.12.1990", ds);

            ds = GKUtils.GEDCOMEventToDateStr(evt, DateFormat.dfYYYY_MM_DD, false);
            Assert.AreEqual("1990.12.28", ds);

            ds = GKUtils.GEDCOMEventToDateStr(evt, DateFormat.dfYYYY, false);
            Assert.AreEqual("1990", ds);

            ds = GKUtils.GEDCOMEventToDateStr(null, DateFormat.dfYYYY, false);
            Assert.AreEqual("", ds);
        }
Ejemplo n.º 6
0
        protected static object GetDateValue(GEDCOMCustomEvent evt, bool isVisible)
        {
            if (evt == null)
            {
                return((isVisible) ? null : (object)UDN.CreateEmpty());
            }

            return(GetDateValue(evt.Date.Value, isVisible));
        }
Ejemplo n.º 7
0
        public override void Setup()
        {
            base.Setup();

            fBase  = new BaseWindowStub();
            fEvent = new GEDCOMIndividualEvent(fBase.Context.Tree, null, "", "");

            fDialog       = new EventEditDlg(fBase);
            fDialog.Event = fEvent;
        }
Ejemplo n.º 8
0
        public void gt_set_event_place(object evPtr, string place)
        {
            GEDCOMCustomEvent evt = evPtr as GEDCOMCustomEvent;

            if (evt == null)
            {
                return;
            }

            evt.Place.StringValue = place;
        }
Ejemplo n.º 9
0
        public void gt_set_event_value(object evPtr, string value)
        {
            GEDCOMCustomEvent evt = evPtr as GEDCOMCustomEvent;

            if (evt == null)
            {
                return;
            }

            evt.StringValue = value;
        }
Ejemplo n.º 10
0
        private void btnSelectPlaces_Click(object sender, EventArgs e)
        {
            GEDCOMIndividualRecord ind = null;

            bool condBirth     = false;
            bool condDeath     = false;
            bool condResidence = false;

            if (radTotal.Checked)
            {
                condBirth     = chkBirth.Checked.GetValueOrDefault();
                condDeath     = chkDeath.Checked.GetValueOrDefault();
                condResidence = chkResidence.Checked.GetValueOrDefault();
            }
            else if (radSelected.Checked && (cmbPersons.SelectedIndex >= 0))
            {
                GKComboItem item = (GKComboItem)cmbPersons.Items[cmbPersons.SelectedIndex];
                ind = (item.Tag as GEDCOMIndividualRecord);
            }

            fMapBrowser.ShowLines = (ind != null && chkLinesVisible.Checked.GetValueOrDefault());
            fMapPoints.Clear();

            int num = fPlaces.Count;

            for (int i = 0; i < num; i++)
            {
                MapPlace place = fPlaces[i];
                if (place.Points.Count < 1)
                {
                    continue;
                }

                int num2 = place.PlaceRefs.Count;
                for (int j = 0; j < num2; j++)
                {
                    GEDCOMCustomEvent evt = place.PlaceRefs[j].Event;

                    if ((ind != null && (evt.Parent == ind)) || (condBirth && evt.Name == "BIRT") || (condDeath && evt.Name == "DEAT") || (condResidence && evt.Name == "RESI"))
                    {
                        PlacesLoader.AddPoint(fMapPoints, place.Points[0], place.PlaceRefs[j]);
                    }
                }
            }

            if (ind != null)
            {
                // sort points by date
                fMapPoints.QuickSort(MapPointsCompare);
            }

            PlacesLoader.CopyPoints(fMapBrowser, fMapPoints, ind != null);
        }
Ejemplo n.º 11
0
        public override bool Accept()
        {
            try {
                fEvent.Place.StringValue    = fView.Place.Text;
                fEvent.Place.Location.Value = fTempLocation;
                fEvent.Classification       = fView.EventName.Text;
                fEvent.Cause  = fView.Cause.Text;
                fEvent.Agency = fView.Agency.Text;

                GEDCOMCustomDate dt = AssembleDate();
                if (dt == null)
                {
                    throw new ArgumentNullException("dt");
                }

                fEvent.Date.ParseString(dt.StringValue);

                int eventType = fView.EventType.SelectedIndex;
                if (fEvent is GEDCOMFamilyEvent)
                {
                    fEvent.SetName(GKData.FamilyEvents[eventType].Sign);
                }
                else
                {
                    fEvent.SetName(GKData.PersonEvents[eventType].Sign);
                    if (GKData.PersonEvents[eventType].Kind == PersonEventKind.ekFact)
                    {
                        fEvent.StringValue = fView.Attribute.Text;
                    }
                    else
                    {
                        fEvent.StringValue = "";
                    }
                }

                if (fEvent is GEDCOMIndividualEvent)
                {
                    if (GKData.PersonEvents[eventType].Kind == PersonEventKind.ekFact)
                    {
                        GEDCOMIndividualAttribute attr = new GEDCOMIndividualAttribute(fEvent.Owner, fEvent.Parent, "", "");
                        attr.Assign(fEvent);
                        fEvent = attr;
                    }
                }

                CommitChanges();

                return(true);
            } catch (Exception ex) {
                Logger.LogWrite("EventEditController.Accept(): " + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 12
0
        public void SelectPlaces()
        {
            GEDCOMIndividualRecord ind = null;

            bool condBirth     = false;
            bool condDeath     = false;
            bool condResidence = false;

            if (fView.TotalRadio.Checked)
            {
                condBirth     = fView.BirthCheck.Checked;
                condDeath     = fView.DeathCheck.Checked;
                condResidence = fView.ResidenceCheck.Checked;
            }
            else if (fView.SelectedRadio.Checked && (fView.PersonsCombo.SelectedIndex >= 0))
            {
                ind = (fView.PersonsCombo.SelectedTag as GEDCOMIndividualRecord);
            }

            fView.MapBrowser.ShowLines = (ind != null && fView.LinesVisibleCheck.Checked);
            fMapPoints.Clear();

            int num = fPlaces.Count;

            for (int i = 0; i < num; i++)
            {
                MapPlace place = fPlaces[i];
                if (place.Points.Count < 1)
                {
                    continue;
                }

                int num2 = place.PlaceRefs.Count;
                for (int j = 0; j < num2; j++)
                {
                    GEDCOMCustomEvent evt = place.PlaceRefs[j].Event;

                    if ((ind != null && (evt.Parent == ind)) || (condBirth && evt.Name == "BIRT") || (condDeath && evt.Name == "DEAT") || (condResidence && evt.Name == "RESI"))
                    {
                        PlacesLoader.AddPoint(fMapPoints, place.Points[0], place.PlaceRefs[j]);
                    }
                }
            }

            if (ind != null)
            {
                // sort points by date
                fMapPoints.QuickSort(MapPointsCompare);
            }

            PlacesLoader.CopyPoints(fView.MapBrowser, fMapPoints, ind != null);
        }
Ejemplo n.º 13
0
        private void ExtractEvents(EventType type, List <PersonalEvent> list, IGEDCOMRecordWithEvents record)
        {
            int num = record.Events.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMCustomEvent evt = record.Events[i];
                if (evt.GetChronologicalYear() != 0)
                {
                    list.Add(new PersonalEvent(type, (GEDCOMRecord)record, evt));
                }
            }
        }
Ejemplo n.º 14
0
        // TODO: checking this function, its incorrect logic
        public int gt_get_event_year(object evPtr)
        {
            GEDCOMCustomEvent evt = evPtr as GEDCOMCustomEvent;

            if (evt == null)
            {
                return(0);
            }

            GEDCOMDate date = evt.Date.Value as GEDCOMDate;

            return((date == null) ? 0 : date.Year);
        }
Ejemplo n.º 15
0
        public object gt_get_person_event_ex(object recPtr, string sign)
        {
            GEDCOMIndividualRecord iRec = recPtr as GEDCOMIndividualRecord;

            if (iRec == null)
            {
                return(null);
            }

            GEDCOMCustomEvent evt = iRec.FindEvent(sign);

            return(evt);
        }
Ejemplo n.º 16
0
        public object gt_get_person_event(object recPtr, int idx)
        {
            GEDCOMIndividualRecord iRec = recPtr as GEDCOMIndividualRecord;

            if (iRec == null)
            {
                return(null);
            }

            GEDCOMCustomEvent evt = iRec.Events[idx];

            return(evt);
        }
Ejemplo n.º 17
0
        private void AddPlace(GEDCOMPlace place, GEDCOMCustomEvent placeEvent)
        {
            try
            {
                GEDCOMLocationRecord locRec = place.Location.Value as GEDCOMLocationRecord;

                string placeName = (locRec != null) ? locRec.LocationName : place.StringValue;

                var      node = FindTreeNode(placeName);
                MapPlace mapPlace;

                if (node == null)
                {
                    mapPlace      = new MapPlace();
                    mapPlace.Name = placeName;
                    fPlaces.Add(mapPlace);

                    node = new GKTreeNode(placeName, mapPlace);
                    fBaseRoot.Children.Add(node);

                    if (locRec == null)
                    {
                        AppHost.Instance.RequestGeoCoords(placeName, mapPlace.Points);

                        int num = mapPlace.Points.Count;
                        for (int i = 0; i < num; i++)
                        {
                            GeoPoint pt      = mapPlace.Points[i];
                            string   ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                            node.Children.Add(new GKTreeNode(ptTitle, pt));
                        }
                    }
                    else
                    {
                        GeoPoint pt = new GeoPoint(locRec.Map.Lati, locRec.Map.Long, placeName);
                        mapPlace.Points.Add(pt);

                        string ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                        node.Children.Add(new GKTreeNode(ptTitle, pt));
                    }
                }
                else
                {
                    mapPlace = (((GKTreeNode)node).Tag as MapPlace);
                }

                mapPlace.PlaceRefs.Add(new PlaceRef(placeEvent));
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.AddPlace(): " + ex.Message);
            }
        }
Ejemplo n.º 18
0
        private static void PrepareEventYear(StringList index, GEDCOMCustomEvent evt, GEDCOMIndividualRecord iRec)
        {
            if (evt == null)
            {
                return;
            }

            int dtY = evt.GetChronologicalYear();

            if (dtY != 0)
            {
                PrepareSpecIndex(index, dtY.ToString(), iRec);
            }
        }
Ejemplo n.º 19
0
 public void gt_set_event_date(object evPtr, string date)
 {
     try
     {
         GEDCOMCustomEvent evt = evPtr as GEDCOMCustomEvent;
         if (evt != null && date != "")
         {
             evt.Date.ParseString(date);
         }
     }
     catch
     {
         throw new ScriptException(LangMan.LS(LSID.LSID_DateFormatInvalid) + ": " + date);
     }
 }
Ejemplo n.º 20
0
        private void AcceptChanges()
        {
            fEvent.Place.StringValue    = txtEventPlace.Text;
            fEvent.Place.Location.Value = fLocation;
            fEvent.Classification       = txtEventName.Text;
            fEvent.Cause  = txtEventCause.Text;
            fEvent.Agency = txtEventOrg.Text;

            GEDCOMCustomDate dt = AssembleDate();

            if (dt == null)
            {
                throw new ArgumentNullException("dt");
            }

            fEvent.Date.ParseString(dt.StringValue);

            if (fEvent is GEDCOMFamilyEvent)
            {
                fEvent.SetName(GKData.FamilyEvents[cmbEventType.SelectedIndex].Sign);
            }
            else
            {
                int id = cmbEventType.SelectedIndex;
                fEvent.SetName(GKData.PersonEvents[id].Sign);
                if (GKData.PersonEvents[id].Kind == PersonEventKind.ekFact)
                {
                    fEvent.StringValue = txtAttribute.Text;
                }
                else
                {
                    fEvent.StringValue = "";
                }
            }

            if (fEvent is GEDCOMIndividualEvent)
            {
                int id = cmbEventType.SelectedIndex;
                if (GKData.PersonEvents[id].Kind == PersonEventKind.ekFact)
                {
                    GEDCOMIndividualAttribute attr = new GEDCOMIndividualAttribute(fEvent.Owner, fEvent.Parent, "", "");
                    attr.Assign(fEvent);
                    fEvent = attr;
                }
            }

            CommitChanges();
        }
Ejemplo n.º 21
0
        public override void UpdateContents()
        {
            var dataOwner = fDataOwner as GEDCOMRecordWithEvents;

            if (fSheetList == null || dataOwner == null)
            {
                return;
            }

            try
            {
                fSheetList.ClearItems();

                for (int i = 0; i < dataOwner.Events.Count; i++)
                {
                    GEDCOMCustomEvent evt = dataOwner.Events[i];

                    object[] itemsData = new object[5];
                    itemsData[0] = (i + 1);
                    itemsData[1] = GKUtils.GetEventName(evt);
                    itemsData[2] = new GEDCOMDateItem(evt.Date.Value);
                    if (fPersonsMode)
                    {
                        string st = evt.Place.StringValue;
                        if (evt.StringValue != "")
                        {
                            st = st + " [" + evt.StringValue + "]";
                        }
                        itemsData[3] = st;
                    }
                    else
                    {
                        itemsData[3] = evt.Place.StringValue;
                    }
                    itemsData[4] = GKUtils.GetEventCause(evt);

                    fSheetList.AddItem(evt, itemsData);
                }

                fSheetList.ResizeColumn(1);
                fSheetList.ResizeColumn(2);
                fSheetList.ResizeColumn(3);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("EventsListModel.UpdateContents(): " + ex.Message);
            }
        }
Ejemplo n.º 22
0
        public override float IsMatch(GEDCOMTag tag, MatchParams matchParams)
        {
            if (tag == null)
            {
                return(0.0f);
            }
            GEDCOMCustomEvent ev = (GEDCOMCustomEvent)tag;

            // match date
            float dateMatch = 0.0f;
            float locMatch  = 0.0f;
            int   matches   = 0;

            GEDCOMDateValue dtVal  = this.Date;
            GEDCOMDateValue dtVal2 = ev.Date;

            matches += 1;
            if (dtVal != null && dtVal2 != null)
            {
                dateMatch = dtVal.IsMatch(dtVal2, matchParams);
            }

            // match location - late code-on by option implementation
            if (matchParams.CheckEventPlaces)
            {
                matches += 1;

                if (this.Place == null && ev.Place == null)
                {
                    locMatch = 100.0f;
                }
                else if (this.Place != null && ev.Place != null && this.Place.StringValue == ev.Place.StringValue)
                {
                    locMatch = 100.0f;
                }
            }

            float match = (dateMatch + locMatch) / matches;

            return(match);
        }
Ejemplo n.º 23
0
        private void ListPlaces_DblClick(object sender, EventArgs e)
        {
            GKListItem item = ListPlaces.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            PlaceObj pObj = item.Data as PlaceObj;

            if (pObj == null)
            {
                return;
            }

            if (pObj.Name.IndexOf("[*]") == 0)
            {
                AppHost.StdDialogs.ShowMessage(LangMan.LS(LSID.LSID_PlaceAlreadyInBook));
            }
            else
            {
                GEDCOMLocationRecord loc = fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, new object[] { pObj.Name }) as GEDCOMLocationRecord;
                if (loc == null)
                {
                    return;
                }

                int num = pObj.Facts.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = pObj.Facts[i];
                    evt.Place.StringValue    = loc.LocationName;
                    evt.Place.Location.Value = loc;
                }

                CheckPlaces();
                Base.RefreshLists(false);
            }
        }
Ejemplo n.º 24
0
        private void CollectData()
        {
            int num = fBase.Context.Tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = fBase.Context.Tree[i];
                if (rec.RecordType != GEDCOMRecordType.rtIndividual)
                {
                    continue;
                }

                GEDCOMIndividualRecord iRec = (GEDCOMIndividualRecord)rec;

                int num2 = iRec.Events.Count;
                for (int k = 0; k < num2; k++)
                {
                    GEDCOMCustomEvent ev = iRec.Events[k];

                    if (ev.Name == "BIRT" || ev.Name == "DEAT")
                    {
                        int year = ev.GetChronologicalYear();
                        if (year != 0)
                        {
                            if (fYearMin > year)
                            {
                                fYearMin = year;
                            }
                            if (fYearMax < year)
                            {
                                fYearMax = year;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
        private void GetEventField(StatsMode mode, List <StatsItem> values, GEDCOMIndividualRecord iRec, string evtName)
        {
            string            v   = "?";
            GEDCOMCustomEvent evt = iRec.FindEvent(evtName);

            if (evt == null)
            {
                return;
            }

            int dtY = evt.GetChronologicalYear();

            if (dtY == 0 && (mode != StatsMode.smBirthPlaces && mode != StatsMode.smDeathPlaces))
            {
                return;
            }

            switch (mode)
            {
            case StatsMode.smBirthYears:
            case StatsMode.smDeathYears:
                v = Convert.ToString(dtY);
                break;

            case StatsMode.smBirthTenYears:
            case StatsMode.smDeathTenYears:
                v = Convert.ToString(dtY / 10 * 10);
                break;

            case StatsMode.smBirthPlaces:
            case StatsMode.smDeathPlaces:
                v = evt.Place.StringValue;
                break;
            }

            CheckVal(values, v);
        }
Ejemplo n.º 26
0
        private bool ProcessRecordEvent(bool redo)
        {
            GEDCOMRecordWithEvents rwe = fObj as GEDCOMRecordWithEvents;
            GEDCOMCustomEvent      evt = fNewVal as GEDCOMCustomEvent;

            if (rwe == null || evt == null)
            {
                return(false);
            }

            if (fType == OperationType.otRecordEventRemove)
            {
                redo = !redo;
            }
            if (redo)
            {
                rwe.AddEvent(evt);
            }
            else
            {
                rwe.Events.Extract(evt); // bugfix(no delete!)
            }
            return(true);
        }
Ejemplo n.º 27
0
        private void CollectData()
        {
            int num = fBase.Context.Tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecordWithEvents rec = fBase.Context.Tree[i] as GEDCOMRecordWithEvents;
                if (rec == null)
                {
                    continue;
                }

                int eventsCount = rec.Events.Count;
                for (int k = 0; k < eventsCount; k++)
                {
                    GEDCOMCustomEvent evt = rec.Events[k];
                    UDN udn = evt.Date.GetUDN();
                    if (!udn.IsEmpty())
                    {
                        fEvents.Add(new EventRecord(evt, rec));
                    }
                }
            }
        }
Ejemplo n.º 28
0
        private void PrepareEvent(string iName, GEDCOMCustomEvent ev)
        {
            GEDCOMAddress addr = ev.Address;

            if (addr == null)
            {
                return;
            }

            string addrStr = addr.Address.Text.Trim();

            if (addrStr != "")
            {
                string city = addr.AddressCity;
                if (city != "")
                {
                    addrStr = city + ", " + addrStr;
                }
                AddItem(fAdrList, iName, addrStr);
            }

            foreach (GEDCOMTag tag in addr.PhoneNumbers)
            {
                AddItem(fPhonesList, iName, tag.StringValue);
            }

            foreach (GEDCOMTag tag in addr.EmailAddresses)
            {
                AddItem(fMailsList, iName, tag.StringValue);
            }

            foreach (GEDCOMTag tag in addr.WebPages)
            {
                AddItem(fWebsList, iName, tag.StringValue);
            }
        }
Ejemplo n.º 29
0
        public static void FillContext(IBaseContext context)
        {
            // a null result if the record is not defined
            GEDCOMCustomEvent evt = context.CreateEventEx(null, "BIRT", "xxxxx", "xxxxx");

            Assert.IsNull(evt);

            // first individual
            GEDCOMIndividualRecord iRec = context.CreatePersonEx("Ivan", "Ivanovich", "Ivanov", GEDCOMSex.svMale, true);

            Assert.IsNotNull(iRec);

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

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

            Assert.IsNotNull(evtd);

            // second individual, wife
            GEDCOMIndividualRecord iRec2 = context.CreatePersonEx("Maria", "Petrovna", "Ivanova", GEDCOMSex.svFemale, true);

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

            iRec.AddAssociation("spouse", iRec2);

            // third individual, child
            GEDCOMIndividualRecord iRec3 = context.CreatePersonEx("Anna", "Ivanovna", "Ivanova", GEDCOMSex.svFemale, true);

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

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

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

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

            // individual outside the family
            GEDCOMIndividualRecord iRec4 = context.CreatePersonEx("Alex", "", "Petrov", GEDCOMSex.svMale, true);

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

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

            // fifth
            GEDCOMIndividualRecord iRec5 = context.CreatePersonEx("Anna", "", "Jones", GEDCOMSex.svFemale, false);

            Assert.IsNotNull(iRec5);

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

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

            // location for tests
            GEDCOMLocationRecord 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
            GEDCOMRepositoryRecord repoRec = context.Tree.CreateRepository();

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

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

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

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

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

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

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

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

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

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

            mediaRec.AddTag("FILE", "", null);
            GEDCOMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0];

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

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

            commRec.CommName = "Test communication";
            Assert.IsNotNull(commRec, "commRec != null");
        }
Ejemplo n.º 30
0
 public PlaceRef(GEDCOMCustomEvent evt)
 {
     Event = evt;
     Date  = (evt == null) ? new DateTime(0) : evt.Date.GetDateTime();
 }