/// <summary>
        /// Construct a list of death records matching a specific record, using a user-definable filter predicate
        /// </summary>
        /// <param name="dB">the database to search</param>
        /// <param name="drMatch">the specific death record to match</param>
        /// <param name="filter">the filter predicate used to determine matches to <paramref name="drMatch"/></param>
        /// <returns></returns>
        public static List<IDeathRecord> Matches(Linq2SqlDataContext dB, IDeathRecord drMatch, Func<IDeathRecord, IDeathRecord, bool> filter)
        {
            List<IDeathRecord> lMatches = new List<IDeathRecord>();

            if (drMatch.DeathDate.Year < 1916)
            {
                var query = from c in dB.IllinoisDeathIndexPre1916s
                            where filter( c, drMatch )
                            select c;

                foreach (IDeathRecord indxNext in query)
                    lMatches.Add(indxNext);
            }
            else
            {
                var query = from c in dB.IllinoisDeathIndexPost1915s
                            where filter( c, drMatch )
                            select c;

                foreach (IDeathRecord indxNext in query)
                    lMatches.Add(indxNext);
            }

            return lMatches;
        }
 /// <summary>
 /// Convert a race specification in a database to an enumerated race value
 /// </summary>
 /// <param name="db">The database to consult for a race translation table</param>
 /// <param name="bRace">The race specification to convert</param>
 /// <returns>An enumerated race value</returns>
 /// <exception cref="ArgumentException">if <paramref name="bRace"/> does not represent a valid race value in <paramref name="db"/></exception>
 public static Race GetRace(Linq2SqlDataContext db, byte bRace)
 {
     var sRace = new string(new[] { (char)bRace });
     var query = from e in db.RaceMatches
                 where e.Mnemonic == sRace
                 select e;
     if (query.Any())
         return (Race)query.First().RaceIndex;
     throw new ArgumentException("Invalid race specification \"" + sRace + "\"");
 }
 /// <summary>
 /// Convert a gender specification in a database to an enumerated gender value
 /// </summary>
 /// <param name="db">The database to consult for a gender translation table</param>
 /// <param name="bGender">The gender specification to convert</param>
 /// <returns>An enumerated gender value</returns>
 /// <exception cref="ArgumentException">if <paramref name="bGender"/> does not represent a valid gender value in <paramref name="db"/></exception>
 public static Gender GetGender(Linq2SqlDataContext db, byte bGender)
 {
     var sGender = new string(new[] { (char)bGender });
     var query = from e in db.GenderMatches
             where e.Mnemonic == sGender
             select e;
     if (query.Any())
         return (Gender)query.First().GenderIndex;
     throw new ArgumentException("Invalid gender specification \"" + sGender + "\"");
 }
        /// <summary>
        /// Load event handler for the main form <see cref="Form1"/>
        /// </summary>
        /// <param name="sender">the originator of the event (an instance of <see cref="Form1"/>)</param>
        /// <param name="e">arguments to the event handler</param>
        /// <remarks>This event handler currently loads the database table adapters.
        /// These calls to the <code>TableAdapter.Fill</code> method will ultimately be moved
        /// to another location, to enable selective connection to the database.</remarks>
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                krestniJmenaTableAdapter.Fill(genealogyDataSet.KrestniJmena);
                prijmeniTableAdapter.Fill(genealogyDataSet.Prijmeni);
                givenNameEquivalentsTableAdapter.Fill(genealogyDataSet.GivenNameEquivalents);
                dHDeathIndexTableAdapter.Fill(genealogyDataSet.DHDeathIndex);

                _mdB = new Linq2SqlDataContext();
                Utilities.DataContext = _mdB;

                var query = from c in _mdB.DHDeathIndexes
                            select c.GivenName;

                foreach (string sNext in query)
                {
                    if (!txtFirstName.AutoCompleteCustomSource.Contains(sNext))
                        txtFirstName.AutoCompleteCustomSource.Add(sNext);
                }
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show( @"Unable to load/fill database table adapters:" + Environment.NewLine + ex.Message, @"Database error", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }

            webBrowser1.Navigating += webBrowser1_Navigating;
        }