Exemplo n.º 1
0
        public EventEditDlgController(IEventEditDlg view) : base(view)
        {
            fTempLocation = null;

            int num = GKData.DateKinds.Length;

            for (int i = 0; i < num; i++)
            {
                fView.EventDateType.Add(LangMan.LS(GKData.DateKinds[i].Name));
            }

            for (GDMCalendar gc = GDMCalendar.dcGregorian; gc <= GDMCalendar.dcLast; gc++)
            {
                GKData.CalendarStruct cdr = GKData.DateCalendars[(int)gc];
                if (!cdr.HasSupport)
                {
                    continue;
                }

                fView.Date1Calendar.AddItem(LangMan.LS(cdr.Name), gc);
                fView.Date2Calendar.AddItem(LangMan.LS(cdr.Name), gc);
            }

            fView.Date1Calendar.SelectedIndex = 0;
            fView.Date2Calendar.SelectedIndex = 0;

            fView.EventType.Activate();
        }
Exemplo n.º 2
0
        private static void CheckEventPlace(GDMCustomEvent aEvent)
        {
            GDMPlace place = aEvent.FindTag(GEDCOMTagName.PLAC, 0) as GDMPlace;

            if (place == null)
            {
                return;
            }

            GDMPointer placeLocation = place.FindTag(GEDCOMTagName._LOC, 0) as GDMPointer;

            if (placeLocation == null)
            {
                return;
            }

            if (placeLocation.XRef != "" && placeLocation.Value == null)
            {
                placeLocation.XRef = "";
            }

            if (place.StringValue != "")
            {
                GDMLocationRecord loc = placeLocation.Value as GDMLocationRecord;
                if (loc != null && place.StringValue != loc.LocationName)
                {
                    place.StringValue = loc.LocationName;
                }
            }
        }
Exemplo n.º 3
0
        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
            {
                GDMLocationRecord locRec = fBase.Context.SelectRecord(GDMRecordType.rtLocation, new object[] { pObj.Name }) as GDMLocationRecord;
                if (locRec == null)
                {
                    return;
                }

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

                CheckPlaces();
                fBase.RefreshLists(false);
            }
        }
Exemplo n.º 4
0
        public int gt_get_location_usages(object recPtr)
        {
            GDMLocationRecord loc = recPtr as GDMLocationRecord;

            if (loc == null)
            {
                return(-1);
            }

            int usages;

            StringList linkList = null;

            try
            {
                linkList = GKUtils.GetLocationLinks(fBase.Context.Tree, loc);
                usages   = linkList.Count;
            }
            finally
            {
                if (linkList != null)
                {
                    linkList.Dispose();
                }
            }

            return(usages);
        }
Exemplo n.º 5
0
        public override void UpdateView()
        {
            fView.NotesList.ListModel.DataOwner   = fEvent;
            fView.MediaList.ListModel.DataOwner   = fEvent;
            fView.SourcesList.ListModel.DataOwner = fEvent;

            var evtName = fEvent.GetTagName();

            if (fEvent is GDMFamilyEvent)
            {
                SetEventTypes(GKData.FamilyEvents);
                int idx = GKUtils.GetFamilyEventIndex(evtName);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SetSelectedTag(idx);
            }
            else
            {
                SetEventTypes(GKData.PersonEvents);
                int idx = GKUtils.GetPersonEventIndex(evtName);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SetSelectedTag(idx);

                if (idx >= 0 && GKData.PersonEvents[idx].Kind == PersonEventKind.ekFact)
                {
                    fView.Attribute.Text = fEvent.StringValue;
                }
            }

            ChangeEventType();

            fView.Date.Date      = fEvent.Date.Value;
            fView.EventName.Text = fEvent.Classification;
            fView.Cause.Text     = fEvent.Cause;
            fView.Agency.Text    = fEvent.Agency;

            fTempLocation = fBase.Context.Tree.GetPtrValue <GDMLocationRecord>(fEvent.Place.Location);
            UpdatePlace();

            fView.NotesList.UpdateSheet();
            fView.MediaList.UpdateSheet();
            fView.SourcesList.UpdateSheet();
        }
Exemplo n.º 6
0
        private void AddPlace(GDMPlace place, GDMCustomEvent placeEvent)
        {
            try {
                GDMLocationRecord locRec    = place.Location.Value as GDMLocationRecord;
                string            placeName = (locRec != null) ? locRec.LocationName : place.StringValue;

                ITVNode  node = fView.FindTreeNode(placeName);
                MapPlace mapPlace;

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

                    node = fView.PlacesTree.AddNode(fBaseRoot, placeName, mapPlace);

                    if (locRec == null)
                    {
                        PlacesCache.Instance.GetPlacePoints(placeName, mapPlace.Points);
                    }
                    else
                    {
                        GeoPoint pt = new GeoPoint(locRec.Map.Lati, locRec.Map.Long, placeName);
                        mapPlace.Points.Add(pt);
                    }

                    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);
                        fView.PlacesTree.AddNode(node, ptTitle, pt);
                    }
                }
                else
                {
                    mapPlace = (node.Tag as MapPlace);
                }

                mapPlace.PlaceRefs.Add(new PlaceRef(placeEvent));
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.AddPlace(): " + ex.Message);
            }
        }
Exemplo n.º 7
0
        public static bool ModifyLocation(IBaseWindow baseWin, ref GDMLocationRecord locRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GDMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.ResolveDialog <ILocationEditDlg>(baseWin)) {
                    bool exists = locRec != null;
                    if (!exists)
                    {
                        locRec = new GDMLocationRecord(tree);
                        locRec.InitNew();
                    }

                    try {
                        baseWin.Context.LockRecord(locRec);

                        dlg.LocationRecord = locRec;
                        result             = AppHost.Instance.ShowModalX(dlg, false);
                    } finally {
                        baseWin.Context.UnlockRecord(locRec);
                    }

                    if (!exists)
                    {
                        if (result)
                        {
                            tree.AddRecord(locRec);
                        }
                        else
                        {
                            locRec.Dispose();
                            locRec = null;
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Exemplo n.º 8
0
        private static void CheckEventPlace(GDMCustomEvent evt)
        {
            GDMPlace   place         = evt.Place;
            GDMPointer placeLocation = place.Location;

            if (placeLocation.XRef != "" && placeLocation.Value == null)
            {
                placeLocation.XRef = "";
            }

            if (place.StringValue != "")
            {
                GDMLocationRecord locRec = placeLocation.Value as GDMLocationRecord;
                if (locRec != null && place.StringValue != locRec.LocationName)
                {
                    place.StringValue = locRec.LocationName;
                }
            }
        }
Exemplo n.º 9
0
        private static void CheckEventPlace(GDMTree tree, GEDCOMFormat format, GDMPlace place)
        {
            GDMPointer placeLocation = place.Location;

            if (placeLocation.XRef != "" && placeLocation.Value == null)
            {
                placeLocation.XRef = "";
            }

            if (place.StringValue != "")
            {
                GDMLocationRecord locRec = placeLocation.Value as GDMLocationRecord;
                if (locRec != null && place.StringValue != locRec.LocationName)
                {
                    place.StringValue = locRec.LocationName;
                }
            }

            CheckTagWithNotes(tree, format, place);
        }
Exemplo n.º 10
0
        private void CheckEventPlace(GDMPlace place)
        {
            GDMPointer        placeLocation = place.Location;
            GDMLocationRecord locRec        = fTree.GetPtrValue <GDMLocationRecord>(placeLocation);

            if (placeLocation.XRef != "" && locRec == null)
            {
                placeLocation.XRef = "";
            }

            if (place.StringValue != "")
            {
                if (locRec != null && place.StringValue != locRec.LocationName)
                {
                    place.StringValue = locRec.LocationName;
                }
            }

            CheckTagWithNotes(place);
        }
Exemplo n.º 11
0
        public void CreateLocationRecord(IList <object> placesList)
        {
            PlaceObj pObj = placesList.Count > 0 ? (PlaceObj)placesList[0] : null;

            if (pObj == null)
            {
                return;
            }

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

                for (var pi = 0; pi < placesList.Count; pi++)
                {
                    PlaceObj place = (PlaceObj)placesList[pi];
                    int      num   = place.Facts.Count;
                    for (int i = 0; i < num; i++)
                    {
                        GDMCustomEvent evt = place.Facts[i];
                        evt.Place.StringValue   = locRec.LocationName;
                        evt.Place.Location.XRef = locRec.XRef;
                    }
                }

                CheckPlaces();
                fBase.RefreshLists(false);
            }
        }
Exemplo n.º 12
0
        public void Test_LMLocation()
        {
            var listManager = new LocationListMan(fContext);

            Assert.IsNotNull(listManager);

            GDMLocationRecord locRec = fContext.Tree.XRefIndex_Find("L1") as GDMLocationRecord;

            listManager.Fetch(locRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*locat*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*xxxx*";
            Assert.IsFalse(listManager.CheckFilter());

            var lvMock = new ListViewMock();

            listManager.UpdateColumns(lvMock);
            var listItem = new GKListItem("", null);

            listManager.UpdateItem(0, listItem, locRec);
        }
Exemplo n.º 13
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);
            GDMGroupRecord grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            GKUtils.ShowGroupInfo(grpRec, summary);

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

            GKUtils.ShowMultimediaInfo(mmRec, summary);

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

            GKUtils.ShowNoteInfo(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);
            GDMSourceRecord srcRec = fContext.Tree.XRefIndex_Find("S1") as GDMSourceRecord;

            GKUtils.ShowSourceInfo(srcRec, summary);

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

            GKUtils.ShowRepositoryInfo(repRec, summary);

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

            GKUtils.ShowResearchInfo(resRec, summary);

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

            GKUtils.ShowTaskInfo(taskRec, summary);

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

            GKUtils.ShowCommunicationInfo(commRec, summary);

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

            GKUtils.ShowLocationInfo(locRec, summary);
        }
Exemplo n.º 14
0
 public override void Fetch(GDMRecord aRec)
 {
     fRec = (aRec as GDMLocationRecord);
 }
Exemplo n.º 15
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");
        }
Exemplo n.º 16
0
 public void RemovePlace()
 {
     fTempLocation = null;
     UpdatePlace();
 }
Exemplo n.º 17
0
 public void AddPlace()
 {
     fTempLocation = (fBase.Context.SelectRecord(GDMRecordType.rtLocation, null) as GDMLocationRecord);
     UpdatePlace();
 }
Exemplo n.º 18
0
        public override void UpdateView()
        {
            fView.NotesList.ListModel.DataOwner   = fEvent;
            fView.MediaList.ListModel.DataOwner   = fEvent;
            fView.SourcesList.ListModel.DataOwner = fEvent;

            var evtName = fEvent.GetTagName();

            if (fEvent is GDMFamilyEvent)
            {
                SetEventTypes(GKData.FamilyEvents);
                int idx = GKUtils.GetFamilyEventIndex(evtName);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SelectedIndex = idx;
            }
            else
            {
                SetEventTypes(GKData.PersonEvents);
                int idx = GKUtils.GetPersonEventIndex(evtName);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SelectedIndex = idx;

                if (idx >= 0 && GKData.PersonEvents[idx].Kind == PersonEventKind.ekFact)
                {
                    fView.Attribute.Text = fEvent.StringValue;
                }
            }

            ChangeEventType();

            GDMCustomDate date = fEvent.Date.Value;

            if (date is GDMDateRange)
            {
                GDMDateRange dtRange = date as GDMDateRange;

                if (dtRange.After.StringValue == "" && dtRange.Before.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 1;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue == "")
                {
                    fView.EventDateType.SelectedIndex = 2;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 3;
                }

                fView.Date1.NormalizeDate = dtRange.After.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date2.NormalizeDate = dtRange.Before.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SetSelectedTag <GDMCalendar>(dtRange.After.DateCalendar);
                fView.Date2Calendar.SetSelectedTag <GDMCalendar>(dtRange.Before.DateCalendar);
                fView.Date1BC.Checked = dtRange.After.YearBC;
                fView.Date2BC.Checked = dtRange.Before.YearBC;
            }
            else if (date is GDMDatePeriod)
            {
                GDMDatePeriod dtPeriod = date as GDMDatePeriod;

                if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue == "")
                {
                    fView.EventDateType.SelectedIndex = 4;
                }
                else if (dtPeriod.DateFrom.StringValue == "" && dtPeriod.DateTo.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 5;
                }
                else if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 6;
                }

                fView.Date1.NormalizeDate = dtPeriod.DateFrom.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date2.NormalizeDate = dtPeriod.DateTo.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SetSelectedTag <GDMCalendar>(dtPeriod.DateFrom.DateCalendar);
                fView.Date2Calendar.SetSelectedTag <GDMCalendar>(dtPeriod.DateTo.DateCalendar);
                fView.Date1BC.Checked = dtPeriod.DateFrom.YearBC;
                fView.Date2BC.Checked = dtPeriod.DateTo.YearBC;
            }
            else if (date is GDMDate)
            {
                GDMApproximated approximated = (date as GDMDate).Approximated;

                switch (approximated)
                {
                case GDMApproximated.daExact:
                    fView.EventDateType.SelectedIndex = 0;
                    break;

                case GDMApproximated.daAbout:
                    fView.EventDateType.SelectedIndex = 7;
                    break;

                case GDMApproximated.daCalculated:
                    fView.EventDateType.SelectedIndex = 8;
                    break;

                case GDMApproximated.daEstimated:
                    fView.EventDateType.SelectedIndex = 9;
                    break;
                }

                fView.Date1.NormalizeDate = (date as GDMDate).GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SetSelectedTag <GDMCalendar>((date as GDMDate).DateCalendar);
                fView.Date1BC.Checked = (date as GDMDate).YearBC;
            }
            else
            {
                fView.EventDateType.SelectedIndex = 0;
                fView.Date1.NormalizeDate         = "";
                fView.Date1Calendar.SetSelectedTag <GDMCalendar>(GDMCalendar.dcGregorian);
                fView.Date1BC.Checked = false;
            }

            ChangeDateType();
            fView.EventName.Text = fEvent.Classification;
            fView.Cause.Text     = fEvent.Cause;
            fView.Agency.Text    = fEvent.Agency;

            fTempLocation = (fEvent.Place.Location.Value as GDMLocationRecord);
            UpdatePlace();

            fView.NotesList.UpdateSheet();
            fView.MediaList.UpdateSheet();
            fView.SourcesList.UpdateSheet();
        }
Exemplo n.º 19
0
 public EventEditDlgController(IEventEditDlg view) : base(view)
 {
     fTempLocation = null;
     fView.EventType.Activate();
 }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
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);
        }