/// <summary>
        /// Updates a CompanyResponse record and returns the number of records affected
        /// </summary>
        public static int Update(CompanyResponseDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);
            SqlParameter _Response = new SqlParameter("Response", SqlDbType.VarChar);
            
            _PermitKey.Value = DO.PermitKey;
            _TOCID.Value = DO.TOCID;
            _Response.Value = DO.Response;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _TOCID,
                _Response
            };

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

            return DataCommon.ExecuteScalar("[dbo].[CompanyResponse_Update]", _params, pid);
        }
        /// <summary>
        /// Creates a new CompanyResponse record using async
        /// </summary>
        public static async Task CreateAsync(CompanyResponseDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);
            SqlParameter _Response = new SqlParameter("Response", SqlDbType.VarChar);
            
            _PermitKey.Value = DO.PermitKey;
            _TOCID.Value = DO.TOCID;
            _Response.Value = DO.Response;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _TOCID,
                _Response
            };

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

            await DataCommon.ExecuteNonQueryAsync("[dbo].[CompanyResponse_Insert]", _params, pid);
            
        }
        /// <summary>
        /// Gets all CompanyResponse records
        /// </summary>
        public static async Task<CompanyResponseDO[]> GetAllAsync()
        {

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

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

                CompanyResponseDO obj = new CompanyResponseDO();
                
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID"));
                obj.Response = sr.GetString(sr.GetOrdinal("Response"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Selects CompanyResponse records by PK
        /// </summary>
        public static async Task<CompanyResponseDO[]> GetByPKAsync(Int32 PermitKey,
 Int32 TOCID)
        {

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

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

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


            List<CompanyResponseDO> objs = new List<CompanyResponseDO>();
			
            while(sr.Read())
            {
                CompanyResponseDO obj = new CompanyResponseDO();
				
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID"));
                obj.Response = sr.GetString(sr.GetOrdinal("Response"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Deletes a CompanyResponse record
        /// </summary>
        public static async Task<int> DeleteAsync(CompanyResponseDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);
            
            _PermitKey.Value = DO.PermitKey;
            _TOCID.Value = DO.TOCID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _TOCID
            };

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

            return await DataCommon.ExecuteScalarAsync("[dbo].[CompanyResponse_Delete]", _params, pid);
        }