/// <summary>
        /// Instanciates a Admin1 object from the database via the admin1ID
        /// </summary>
        public Admin1(int admin1ID)
        {
            db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("AG_GetAdmin1Byadmin1ID");
            db.AddInParameter(dbCommand, "admin1ID", DbType.Int32, admin1ID);

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                ColumnFieldList list = new ColumnFieldList(dr);

                if (dr.Read())
                {
                    if (list.IsColumnPresent("admin1ID")) { this._admin1ID = (int)dr["admin1ID"]; }
                    if (list.IsColumnPresent("CountryID")) { this._countryID = (int)dr["CountryID"]; }
                    if (list.IsColumnPresent("admin1CD")) { this._admin1CD = (string)dr["admin1CD"]; }
                    if (list.IsColumnPresent("Name")) { this._name = (string)dr["Name"]; }

                }
                else
                {
                    throw new Exception("There is no Admin1 in the database with the ID " + admin1ID);
                }

                dr.Close();
            }
        }
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of Admin1s
        /// </summary>
        public static List<Admin1> PopulateObjectWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<Admin1> arr = new List<Admin1>();

            Admin1 obj;

            while (dr.Read())
            {
                obj = new Admin1();
                if (list.IsColumnPresent("admin1ID")) { obj._admin1ID = (int)dr["admin1ID"]; }
                if (list.IsColumnPresent("CountryID")) { obj._countryID = (int)dr["CountryID"]; }
                if (list.IsColumnPresent("admin1CD")) { obj._admin1CD = (string)dr["admin1CD"]; }
                if (list.IsColumnPresent("Name")) { obj._name = (string)dr["Name"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }