public PersonEditDlgController(IPersonEditDlg view) : base(view)
        {
            for (GEDCOMRestriction res = GEDCOMRestriction.rnNone; res <= GEDCOMRestriction.rnPrivacy; res++)
            {
                fView.RestrictionCombo.Add(LangMan.LS(GKData.Restrictions[(int)res]));
            }

            for (GEDCOMSex sx = GEDCOMSex.svNone; sx <= GEDCOMSex.svUndetermined; sx++)
            {
                string name  = GKUtils.SexStr(sx);
                IImage image = null;
                #if SEX_SYMBOLS
                switch (sx)
                {
                case GEDCOMSex.svMale:
                    image = AppHost.GfxProvider.LoadResourceImage("sym_male.png", true);
                    break;

                case GEDCOMSex.svFemale:
                    image = AppHost.GfxProvider.LoadResourceImage("sym_female.png", true);
                    break;
                }
                #endif
                fView.SexCombo.AddItem(name, null, image);
            }
        }
Пример #2
0
 public NameEditDlgController(INameEditDlg view) : base(view)
 {
     for (GEDCOMSex sx = GEDCOMSex.svNone; sx <= GEDCOMSex.svLast; sx++)
     {
         fView.SexCombo.Add(GKUtils.SexStr(sx));
     }
 }
Пример #3
0
        public static string GetSexStr(GEDCOMSex value)
        {
            string str;

            switch (value)
            {
            case GEDCOMSex.svMale:
                str = "M";
                break;

            case GEDCOMSex.svFemale:
                str = "F";
                break;

            case GEDCOMSex.svUndetermined:
                str = "U";
                break;

            default:
                str = "";
                break;
            }

            return(str);
        }
        public void UpdatePortrait(bool totalUpdate)
        {
            if (fPortraitImg == null || totalUpdate)
            {
                fPortraitImg = fBase.Context.GetPrimaryBitmap(fPerson, fView.Portrait.Width, fView.Portrait.Height, false);
            }

            IImage img = fPortraitImg;

            if (img == null)
            {
                // using avatar's image
                GEDCOMSex curSex = (GEDCOMSex)fView.SexCombo.SelectedIndex;

                switch (curSex)
                {
                case GEDCOMSex.svMale:
                    img = AppHost.GfxProvider.LoadResourceImage("pi_male_140.png", false);
                    break;

                case GEDCOMSex.svFemale:
                    img = AppHost.GfxProvider.LoadResourceImage("pi_female_140.png", false);
                    break;

                default:
                    break;
                }
            }
            fView.SetPortrait(img);

            bool locked = (fView.RestrictionCombo.SelectedIndex == (int)GEDCOMRestriction.rnLocked);

            fView.SetPortraitAvl((fPortraitImg != null), locked);
        }
Пример #5
0
        private GEDCOMIndividualRecord ParsePerson(StringList buffer, string str, ref int selfId)
        {
            try
            {
                selfId = -1;
                int marrNum = -1;
                int pid_end = 0;

                var plRet = ParsePersonLine(str);
                // extData - (в/б)

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

                pid_end = plRet.Pos;

                if (fPersonsList.ContainsKey(plRet.PersId))
                {
                    fLog.Add(">>>> " + fLangMan.LS(ILS.LSID_ParseError_NumDuplicate) + " \"" + plRet.PersId + "\".");
                    return(null);
                }

                if (NumbersType == PersonNumbersType.pnKonovalov)
                {
                    selfId = int.Parse(plRet.PersId);
                    int.TryParse(plRet.MarNum, out marrNum);
                }

                str = str.Substring(pid_end).Trim();

                GEDCOMSex proposeSex = GetProposeSex(buffer);

                GEDCOMIndividualRecord result = DefinePerson(str, proposeSex);

                fPersonsList.Add(plRet.PersId, result);

                if (!string.IsNullOrEmpty(plRet.ParentId))
                {
                    GEDCOMIndividualRecord parent;
                    if (fPersonsList.TryGetValue(plRet.ParentId, out parent))
                    {
                        AddChild(parent, marrNum, result);
                    }
                    else
                    {
                        fLog.Add(">>>> " + fLangMan.LS(ILS.LSID_ParseError_AncNotFound) + " \"" + plRet.ParentId + "\".");
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("Importer.ParsePerson(): " + ex.Message);
                throw;
            }
        }
Пример #6
0
        public string gt_define_patronymic(string fatherName, string childSex, bool confirm)
        {
            GEDCOMSex sex = (childSex.Length == 1) ? GKUtils.GetSexBySign(childSex[0]) : GEDCOMSex.svNone;

            string childPatronymic = fBase.Context.DefinePatronymic(fatherName, sex, confirm);

            return(childPatronymic);
        }
Пример #7
0
        public object gt_create_person(string name, string patronymic, string surname, string strSex)
        {
            GEDCOMSex sex = (strSex.Length == 1) ? GKUtils.GetSexBySign(strSex[0]) : GEDCOMSex.svNone;

            GEDCOMIndividualRecord iRec = fBase.Context.CreatePersonEx(name, patronymic, surname, sex, false);

            return(iRec);
        }
Пример #8
0
        private void SetTarget(GEDCOMIndividualRecord value)
        {
            try
            {
                fTarget = value;

                if (fTarget != null)
                {
                    ICulture    culture    = fBase.Context.Culture;
                    INamesTable namesTable = AppHost.NamesTable;

                    var parts = GKUtils.GetNameParts(fTarget);
                    txtSurname.Text = parts.Surname;
                    GEDCOMSex sx = (GEDCOMSex)cmbSex.SelectedIndex;

                    switch (fTargetMode)
                    {
                    case TargetMode.tmParent:
                        if (sx == GEDCOMSex.svFemale)
                        {
                            SetMarriedSurname(parts.Surname);
                        }
                        if (culture.HasPatronymic())
                        {
                            cmbPatronymic.Items.Add(namesTable.GetPatronymicByName(parts.Name, GEDCOMSex.svMale));
                            cmbPatronymic.Items.Add(namesTable.GetPatronymicByName(parts.Name, GEDCOMSex.svFemale));
                            cmbPatronymic.Text = namesTable.GetPatronymicByName(parts.Name, sx);
                        }
                        break;

                    case TargetMode.tmChild:
                        switch (sx)
                        {
                        case GEDCOMSex.svMale:
                            if (culture.HasPatronymic())
                            {
                                txtName.Text = namesTable.GetNameByPatronymic(parts.Patronymic);
                            }
                            break;

                        case GEDCOMSex.svFemale:
                            SetMarriedSurname(parts.Surname);
                            break;
                        }
                        break;

                    case TargetMode.tmWife:
                        SetMarriedSurname(parts.Surname);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("PersonEditDlg.SetTarget(" + fTargetMode.ToString() + "): " + ex.Message);
            }
        }
Пример #9
0
        private void CheckSpouses(StringList buffer, GEDCOMIndividualRecord curPerson)
        {
            int num2 = buffer.Count;

            for (int i = 0; i < num2; i++)
            {
                string line = buffer[i];
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                try
                {
                    var slRet = ImportUtils.ParseSpouseLine(line);
                    if (slRet != null)
                    {
                        // define sex
                        string    spSex = slRet.Spouse;
                        GEDCOMSex sx    = (spSex[0] == 'М') ? GEDCOMSex.svMale : GEDCOMSex.svFemale;

                        // extract name
                        line = line.Substring(slRet.Pos).Trim();

                        if (!string.IsNullOrEmpty(line))
                        {
                            GEDCOMIndividualRecord spouse = DefinePerson(line, sx);
                            GEDCOMFamilyRecord     family = GetFamilyByNum(curPerson, slRet.MarrNum);

                            if (spouse == null || family == null)
                            {
                                // TODO: error to log, reporting causes
                            }
                            else
                            {
                                family.AddSpouse(spouse);

                                // extract marriage date
                                if (!string.IsNullOrEmpty(slRet.ExtData))
                                {
                                    string marrDate = slRet.ExtData.Substring(1, slRet.ExtData.Length - 2).Trim();

                                    if (marrDate != "")
                                    {
                                        SetEvent(family, "MARR", marrDate);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogWrite("Importer.CheckSpouses(): " + ex.Message);
                }
            }
        }
Пример #10
0
        public void TakeVal(string val, GEDCOMSex sex, bool ignoreZero)
        {
            int tmp;

            if (int.TryParse(val, out tmp))
            {
                TakeVal(tmp, sex, ignoreZero);
            }
        }
Пример #11
0
        private GEDCOMSex GetProposeSex(StringList buffer)
        {
            GEDCOMSex result = GEDCOMSex.svNone;

            if (buffer == null)
            {
                return(result);
            }

            try
            {
                int num = buffer.Count;
                for (int i = 0; i < num; i++)
                {
                    string line = buffer[i];
                    if (line.Length <= 2)
                    {
                        continue;
                    }

                    char c1 = line[0];
                    char c2 = line[1];
                    if ((c1 == 'М' || c1 == 'Ж') && ((c2 == ' ') || (c2 >= '1' && c2 <= '9')))
                    {
                        // define sex (if spouse is male, then result = female, else result = male)
                        GEDCOMSex res = (c1 == 'М') ? GEDCOMSex.svFemale : GEDCOMSex.svMale;

                        if (result == GEDCOMSex.svNone)
                        {
                            result = res;
                        }
                        else
                        {
                            if (result != res)
                            {
                                fLog.Add(">>>> " + fLangMan.LS(ILS.LSID_SpousesInfoConflict));
                                return(GEDCOMSex.svNone);
                            }
                            else
                            {
                                // matched, checked
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("Importer.GetProposeSex(): " + ex.Message);
            }

            return(result);
        }
Пример #12
0
        public TVPerson(TVPerson parent, GEDCOMIndividualRecord iRec)
        {
            Idx = NextIdx++;

            Parent = parent;
            IRec   = iRec;
            Sex    = iRec.Sex;

            Spouses       = new List <TVPerson>();
            Childs        = new List <TVPerson>();
            BeautySpouses = random.Next(0, 360);
            BeautyChilds  = random.Next(0, 360);
        }
Пример #13
0
        private static void SetLineColor(GEDCOMSex sex)
        {
            switch (sex)
            {
            case GEDCOMSex.svMale:
                OpenGL.glColor3f(0.1F, 0.3F, 0.9F);
                break;

            case GEDCOMSex.svFemale:
                OpenGL.glColor3f(0.9F, 0.3F, 0.1F);
                break;
            }
        }
Пример #14
0
        public void gt_set_person_sex(object recPtr, string strSex)
        {
            GEDCOMIndividualRecord rec = recPtr as GEDCOMIndividualRecord;

            if (rec == null)
            {
                return;
            }

            GEDCOMSex sex = (strSex.Length == 1) ? GKUtils.GetSexBySign(strSex[0]) : GEDCOMSex.svNone;

            rec.Sex = sex;
        }
Пример #15
0
        private void InitSimpleControls()
        {
            EditName.Text       = "";
            EditBirthDate.Text  = "";
            EditBirthPlace.Text = "";
            CheckBirth.Checked  = false;
            EditDeathDate.Text  = "";
            EditDeathPlace.Text = "";
            CheckDeath.Checked  = false;
            MemoNote.Text       = "";

            fSimpleTempSex = GEDCOMSex.svMale;
            btnMale.Text   = new string(fLangMan.LS(FLS.LSID_SexM)[0], 1);
        }
Пример #16
0
        private void BtnMaleClick(object sender, EventArgs e)
        {
            switch (fSimpleTempSex)
            {
            case GEDCOMSex.svMale:
                btnMale.Text   = new string(fLangMan.LS(FLS.LSID_SexF)[0], 1);
                fSimpleTempSex = GEDCOMSex.svFemale;
                break;

            case GEDCOMSex.svFemale:
                btnMale.Text   = new string(fLangMan.LS(FLS.LSID_SexM)[0], 1);
                fSimpleTempSex = GEDCOMSex.svMale;
                break;
            }
        }
Пример #17
0
        private void ParentAdd(GEDCOMSex needSex)
        {
            TreeChartPerson p = fView.TreeBox.Selected;

            if (p == null || p.Rec == null)
            {
                return;
            }

            bool needParent  = false;
            bool familyExist = p.Rec.GetParentsFamily() != null;

            if (familyExist)
            {
                GEDCOMIndividualRecord mother, father;
                GEDCOMFamilyRecord     fam = p.Rec.GetParentsFamily();
                if (fam == null)
                {
                    father = null;
                    mother = null;
                }
                else
                {
                    father = fam.GetHusband();
                    mother = fam.GetWife();
                }

                needParent = (father == null && needSex == GEDCOMSex.svMale) ||
                             (mother == null && needSex == GEDCOMSex.svFemale);
            }

            if (!familyExist || needParent)
            {
                GEDCOMIndividualRecord child  = p.Rec;
                GEDCOMFamilyRecord     fam    = (familyExist) ? p.Rec.GetParentsFamily() : fBase.Context.Tree.CreateFamily();
                GEDCOMIndividualRecord parent = fBase.Context.SelectPerson(null, TargetMode.tmParent, needSex);
                if (parent != null)
                {
                    fam.AddSpouse(parent);
                    if (!familyExist)
                    {
                        fam.AddChild(child);
                    }

                    UpdateChart();
                }
            }
        }
Пример #18
0
        private void InternalChildAdd(GEDCOMSex needSex)
        {
            TreeChartPerson p = fView.TreeBox.Selected;

            if (p == null || p.Rec == null)
            {
                return;
            }

            GEDCOMIndividualRecord child = fBase.Context.AddChildForParent(p.Rec, needSex);

            if (child == null)
            {
                return;
            }

            UpdateChart();
        }
Пример #19
0
        public override void Clear()
        {
            base.Clear();

            FilterGroupMode = FilterGroupMode.All;
            GroupRef        = "";
            if (FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                FilterLifeMode = FilterLifeMode.lmAll;
            }
            Name            = "*";
            AliveBeforeDate = "";
            PatriarchOnly   = false;
            Residence       = "*";
            Sex             = GEDCOMSex.svNone;
            SourceMode      = FilterGroupMode.All;
            SourceRef       = "";
            EventVal        = "*";
        }
Пример #20
0
        public NameEditDlg()
        {
            InitializeComponent();

            for (GEDCOMSex sx = GEDCOMSex.svNone; sx <= GEDCOMSex.svLast; sx++)
            {
                cmbSex.Items.Add(GKUtils.SexStr(sx));
            }

            // SetLang()
            btnAccept.Text      = LangMan.LS(LSID.LSID_DlgAccept);
            btnCancel.Text      = LangMan.LS(LSID.LSID_DlgCancel);
            Title               = LangMan.LS(LSID.LSID_Name);
            lblName.Text        = LangMan.LS(LSID.LSID_Name);
            lblSex.Text         = LangMan.LS(LSID.LSID_Sex);
            grpPatronymics.Text = LangMan.LS(LSID.LSID_Patronymic);
            lblFemale.Text      = LangMan.LS(LSID.LSID_PatFemale);
            lblMale.Text        = LangMan.LS(LSID.LSID_PatMale);
        }
Пример #21
0
        public void SetNameSex(string name, GEDCOMSex sex)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            NameEntry nm = FindName(name);

            if (nm == null)
            {
                nm = AddName(name);
            }

            if (nm.Sex == GEDCOMSex.svNone && sex >= GEDCOMSex.svMale && sex < GEDCOMSex.svUndetermined)
            {
                nm.Sex = sex;
            }
        }
Пример #22
0
        private GEDCOMFamilyRecord GetFamilyByNum(GEDCOMIndividualRecord parent, int marrNum)
        {
            // it's source of ERRORS! but without this - bad! (AddSpouse() not linking parent to family)
            GEDCOMSex sex = parent.Sex;

            if (sex == GEDCOMSex.svNone || sex == GEDCOMSex.svUndetermined)
            {
                parent.Sex = GEDCOMSex.svMale;
            }

            while (parent.SpouseToFamilyLinks.Count < marrNum)
            {
                GEDCOMFamilyRecord fam = fTree.CreateFamily();
                fam.AddSpouse(parent);
            }

            GEDCOMFamilyRecord family = parent.SpouseToFamilyLinks[marrNum - 1].Family;

            return(family);
        }
Пример #23
0
        public GEDCOMSex GetSex(string iName, string iPat, bool canQuery)
        {
            GEDCOMSex result = GEDCOMSex.svNone;

            if (string.IsNullOrEmpty(iName))
            {
                return(result);
            }

            char nc = iName[iName.Length - 1];

            if (StrContains(FEM_ENDINGS, nc))
            {
                if (!string.IsNullOrEmpty(iPat))
                {
                    char pc = iPat[iPat.Length - 1];

                    if (StrContains(FEM_ENDINGS, pc))
                    {
                        result = GEDCOMSex.svFemale;
                    }
                    else if (StrContains(MALE_ENDINGS, pc))
                    {
                        result = GEDCOMSex.svMale;
                    }
                }
            }
            else if (StrContains(MALE_ENDINGS, nc))
            {
                result = GEDCOMSex.svMale;
            }

            if (result == GEDCOMSex.svNone && canQuery)
            {
                string fn  = iName + " " + iPat;
                bool   res = AppHost.StdDialogs.ShowQuestionYN(string.Format(LangMan.LS(LSID.LSID_NotDeterminedPersonSex), fn));
                result = res ? GEDCOMSex.svMale : GEDCOMSex.svFemale;
            }

            return(result);
        }
Пример #24
0
        private GEDCOMIndividualRecord DefinePerson(string str, GEDCOMSex proposeSex)
        {
            var persName = DefinePersonName(str);

            GEDCOMIndividualRecord result = fBase.Context.CreatePersonEx(persName.Name, persName.Patr, persName.Surname, proposeSex, false);

            if (proposeSex == GEDCOMSex.svNone || proposeSex == GEDCOMSex.svUndetermined)
            {
                fBase.Context.CheckPersonSex(result);
            }

            if (persName.BirthDate != "")
            {
                SetEvent(result, "BIRT", persName.BirthDate);
            }
            if (persName.DeathDate != "")
            {
                SetEvent(result, "DEAT", persName.DeathDate);
            }

            return(result);
        }
Пример #25
0
        private static void CheckVal(List <StatsItem> valsList, string val, GEDCOMSex sex = GEDCOMSex.svUndetermined)
        {
            if (sex == GEDCOMSex.svUndetermined)
            {
                if (val == "-1" || val == "" || val == "0")
                {
                    val = "?";
                }
            }

            int vIdx = valsList.FindIndex(delegate(StatsItem lv) { return(lv.Caption == val); });

            StatsItem lvi;

            if (vIdx == -1)
            {
                lvi = new StatsItem(val, sex != GEDCOMSex.svUndetermined);
                valsList.Add(lvi);
            }
            else
            {
                lvi = valsList[vIdx];
            }

            switch (sex)
            {
            case GEDCOMSex.svFemale:
                lvi.ValF = lvi.ValF + 1;
                break;

            case GEDCOMSex.svMale:
                lvi.ValM = lvi.ValM + 1;
                break;

            case GEDCOMSex.svUndetermined:
                lvi.Value = lvi.Value + 1;
                break;
            }
        }
Пример #26
0
        public string GetPatronymicByName(string name, GEDCOMSex sex)
        {
            string result = "";

            NameEntry nm = FindName(name);

            if (nm != null)
            {
                switch (sex)
                {
                case GEDCOMSex.svMale:
                    result = nm.M_Patronymic;
                    break;

                case GEDCOMSex.svFemale:
                    result = nm.F_Patronymic;
                    break;
                }
            }

            return(result);
        }
Пример #27
0
        public void TakeVal(float val, GEDCOMSex sex, bool ignoreZero)
        {
            if (val == 0.0f && ignoreZero)
            {
                return;
            }

            CommonSum += val;
            CommonCount++;

            switch (sex)
            {
            case GEDCOMSex.svFemale:
                FemaleSum += val;
                FemaleCount++;
                break;

            case GEDCOMSex.svMale:
                MaleSum += val;
                MaleCount++;
                break;
            }
        }
Пример #28
0
        public void ImportNames(GEDCOMIndividualRecord iRec)
        {
            if (iRec == null)
            {
                return;
            }

            try
            {
                string childName, childPat;
                var    parts = GKUtils.GetNameParts(iRec);
                childName = parts.Name;
                childPat  = parts.Patronymic;

                GEDCOMSex iSex = iRec.Sex;
                SetNameSex(childName, iSex);

                GEDCOMFamilyRecord     fam    = iRec.GetParentsFamily();
                GEDCOMIndividualRecord father = (fam == null) ? null : fam.GetHusband();

                if (father != null)
                {
                    string fatherNam;
                    parts     = GKUtils.GetNameParts(father);
                    fatherNam = parts.Name;

                    if (IsComparable(fatherNam, childPat))
                    {
                        SetName(fatherNam, childPat, iSex);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("NamesTable.ImportName(): " + ex.Message);
            }
        }
Пример #29
0
        public void Test_RussianCulture()
        {
            GEDCOMIndividualRecord iRec = fContext.Tree.XRefIndex_Find("I3") as GEDCOMIndividualRecord;

            Assert.IsNotNull(iRec);

            ICulture rusCulture = new RussianCulture();

            Assert.IsNotNull(rusCulture);
            Assert.IsTrue(rusCulture.HasPatronymic());
            Assert.IsTrue(rusCulture.HasSurname());

            string[] surnames = rusCulture.GetSurnames(iRec);
            Assert.AreEqual(1, surnames.Length);
            Assert.AreEqual("Ivanova", surnames[0]);
            Assert.Throws(typeof(ArgumentNullException), () => { rusCulture.GetSurnames(null); });


            Assert.AreEqual("Иванов", rusCulture.NormalizeSurname("Иванова", true));
            Assert.AreEqual("Бельский", rusCulture.NormalizeSurname("Бельская", true));
            Assert.AreEqual("Грозный", rusCulture.NormalizeSurname("Грозная", true));
            Assert.AreEqual("Иванов", rusCulture.NormalizeSurname("Иванов", false));
            Assert.AreEqual("Бельский", rusCulture.NormalizeSurname("Бельский", false));
            Assert.AreEqual("Грозный", rusCulture.NormalizeSurname("Грозный", false));

            Assert.AreEqual("?", rusCulture.NormalizeSurname(null, false));
            Assert.AreEqual("?", rusCulture.NormalizeSurname("", false));
            Assert.AreEqual("?", rusCulture.NormalizeSurname("(Иванова)", false));

            Assert.AreEqual("Иванова", rusCulture.GetMarriedSurname("Иванов"));
            Assert.AreEqual("Бельская", rusCulture.GetMarriedSurname("Бельский"));
            Assert.AreEqual("Грозная", rusCulture.GetMarriedSurname("Грозный"));

            Assert.AreEqual("?", rusCulture.GetMarriedSurname(""));
            Assert.AreEqual("?", rusCulture.GetMarriedSurname(null));

            string[] snms = rusCulture.GetSurnames("Бельская (Иванова)", true);
            Assert.AreEqual(2, snms.Length);
            Assert.AreEqual("Бельский", snms[0]);
            Assert.AreEqual("Иванов", snms[1]);

            snms = rusCulture.GetSurnames("Бельская", true);
            Assert.AreEqual(1, snms.Length);
            Assert.AreEqual("Бельский", snms[0]);

            snms = rusCulture.GetSurnames("Бельский", false);
            Assert.AreEqual(1, snms.Length);
            Assert.AreEqual("Бельский", snms[0]);


            GEDCOMSex sx = rusCulture.GetSex("Мария", "Петровна", false);

            Assert.AreEqual(GEDCOMSex.svFemale, sx);

            sx = rusCulture.GetSex("Иван", "Петрович", false);
            Assert.AreEqual(GEDCOMSex.svMale, sx);

            Assert.AreEqual(GEDCOMSex.svNone, rusCulture.GetSex("", "", false));

            Assert.AreEqual("Иванова Ивана Ивановича", rusCulture.GetPossessiveName("Иванов Иван Иванович"));
        }
Пример #30
0
        public void Test_NamesTable()
        {
            using (NamesTable namesTable = new NamesTable())
            {
                Assert.IsNotNull(namesTable);

                NameEntry nameEntry = namesTable.AddName("Ivan");
                Assert.IsNotNull(nameEntry);
                Assert.AreEqual("Ivan", nameEntry.Name);

                nameEntry = namesTable.FindName("Ivan");
                Assert.IsNotNull(nameEntry);

                string pat = namesTable.GetPatronymicByName("Ivan", GEDCOMSex.svMale);
                Assert.IsNull(pat);

                string name = namesTable.GetNameByPatronymic("Ivanovich");
                Assert.AreEqual("", name);

                GEDCOMSex sex = namesTable.GetSexByName("Ivan");
                Assert.AreEqual(GEDCOMSex.svNone, sex);

                namesTable.SetName("Ivan", "Ivanovich", GEDCOMSex.svMale);
                namesTable.SetName("Ivan", "Ivanovna", GEDCOMSex.svFemale);

                pat = namesTable.GetPatronymicByName("Ivan", GEDCOMSex.svMale);
                Assert.AreEqual("Ivanovich", pat);

                pat = namesTable.GetPatronymicByName("Ivan", GEDCOMSex.svFemale);
                Assert.AreEqual("Ivanovna", pat);

                name = namesTable.GetNameByPatronymic("Ivanovich");
                Assert.AreEqual("Ivan", name);

                name = namesTable.GetNameByPatronymic("Ivanovna");
                Assert.AreEqual("Ivan", name);

                namesTable.SetNameSex("Maria", GEDCOMSex.svFemale);
                sex = namesTable.GetSexByName("Maria");
                Assert.AreEqual(GEDCOMSex.svFemale, sex);

                namesTable.SetName("", "", GEDCOMSex.svNone);
                namesTable.SetNameSex("", GEDCOMSex.svNone);

                namesTable.SetName("Anna", "Ivanovna", GEDCOMSex.svFemale);
                sex = namesTable.GetSexByName("Anna");
                Assert.AreEqual(GEDCOMSex.svFemale, sex);

                GEDCOMIndividualRecord iRec = fContext.Tree.XRefIndex_Find("I3") as GEDCOMIndividualRecord;
                Assert.IsNotNull(iRec);
                namesTable.ImportNames(iRec);

                namesTable.ImportNames(null);

                sex = namesTable.GetSexByName("Anna");
                Assert.AreEqual(GEDCOMSex.svFemale, sex);

                string namesFile = TestUtils.GetTempFilePath("names.txt");
                namesTable.SaveToFile(namesFile);
                namesTable.LoadFromFile(namesFile);
            }
        }