/// <summary>
        /// Updates a LocationCounty record and returns the number of records affected
        /// </summary>
        public static int Update(LocationCountyDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);
            
            _PermitKey.Value = DO.PermitKey;
            _CountyID.Value = DO.CountyID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _CountyID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return DataCommon.ExecuteScalar("[dbo].[LocationCounty_Update]", _params, pid);
        }
        /// <summary>
        /// Creates a new LocationCounty record using async
        /// </summary>
        public static async Task CreateAsync(LocationCountyDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);
            
            _PermitKey.Value = DO.PermitKey;
            _CountyID.Value = DO.CountyID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _CountyID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            await DataCommon.ExecuteNonQueryAsync("[dbo].[LocationCounty_Insert]", _params, pid);
            
        }
        /// <summary>
        /// Selects LocationCounty records by PK
        /// </summary>
        public static async Task<LocationCountyDO[]> GetByPKAsync(Int32 PermitKey,
 Int32 CountyID)
        {

            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);
			
            _PermitKey.Value = PermitKey;
            _CountyID.Value = CountyID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _CountyID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[LocationCounty_GetByPK]", _params, pid);


            List<LocationCountyDO> objs = new List<LocationCountyDO>();
			
            while(sr.Read())
            {
                LocationCountyDO obj = new LocationCountyDO();
				
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Gets all LocationCounty records
        /// </summary>
        public static async Task<LocationCountyDO[]> GetAllAsync()
        {

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[LocationCounty_GetAll]", new SqlParameter[] { }, pid);
            
            List<LocationCountyDO> objs = new List<LocationCountyDO>();
            
            while(sr.Read()){

                LocationCountyDO obj = new LocationCountyDO();
                
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }