예제 #1
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;

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

                fEvent.Date.ParseString(dt.StringValue);

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

                if (fEvent is GDMIndividualEvent)
                {
                    if (GKData.PersonEvents[eventType].Kind == PersonEventKind.ekFact)
                    {
                        GDMIndividualAttribute attr = new GDMIndividualAttribute(fEvent.Owner);
                        attr.Assign(fEvent);
                        fEvent = attr;
                    }
                }

                CommitChanges();

                return(true);
            } catch (Exception ex) {
                Logger.WriteError("EventEditController.Accept()", ex);
                return(false);
            }
        }
예제 #2
0
 private static void CheckIndividualEvent(GDMCustomEvent evt, GEDCOMFormat format)
 {
     // Fix for Family Tree Maker 2008 which exports occupation as generic EVEN events
     if (format == GEDCOMFormat.gf_FamilyTreeMaker)
     {
         string subtype = evt.Classification.ToLower();
         if (evt.Id == (int)GEDCOMTagType.EVEN && subtype == "occupation")
         {
             evt.SetName(GEDCOMTagType.OCCU);
             evt.Classification = string.Empty;
         }
     }
 }
예제 #3
0
        private void CheckEvent(GDMCustomEvent evt)
        {
            CheckStructWL(evt);

            // Fix for Family Tree Maker 2008 which exports occupation as generic EVEN events
            if (fFormat == GEDCOMFormat.gf_FamilyTreeMaker)
            {
                string subtype = evt.Classification.ToLower();
                if (evt.Id == (int)GEDCOMTagType.EVEN && subtype == "occupation")
                {
                    evt.SetName(GEDCOMTagType.OCCU);
                    evt.Classification = string.Empty;
                }
            }

            CheckEventPlace(evt.Place);
        }