/// <summary>
        /// Deletes a MiningEquipment record
        /// </summary>
        public static int Delete(MiningEquipmentDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _EquipmentDescription = new SqlParameter("EquipmentDescription", SqlDbType.VarChar);
            SqlParameter _Purpose = new SqlParameter("Purpose", SqlDbType.VarChar);

            _PermitKey.Value = DO.PermitKey;
            _EquipmentDescription.Value = DO.EquipmentDescription;
            _Purpose.Value = DO.Purpose;

            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _EquipmentDescription,
                _Purpose
            };

            return DataCommon.ExecuteScalar("[dbo].[MiningEquipment_Delete]", _params, "dbo");
        }
        /// <summary>
        /// Creates a new MiningEquipment record
        /// </summary>
        public static void Create(MiningEquipmentDO DO)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _EquipmentDescription = new SqlParameter("EquipmentDescription", SqlDbType.VarChar);
            SqlParameter _Purpose = new SqlParameter("Purpose", SqlDbType.VarChar);
            SqlParameter _Units = new SqlParameter("Units", SqlDbType.Int);

            _PermitKey.Value = DO.PermitKey;
            _EquipmentDescription.Value = DO.EquipmentDescription;
            _Purpose.Value = DO.Purpose;
            _Units.Value = DO.Units;

            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _EquipmentDescription,
                _Purpose,
                _Units
            };

            DataCommon.ExecuteNonQuery("[dbo].[MiningEquipment_Insert]", _params, "dbo");
        }
        /// <summary>
        /// Gets all MiningEquipment records
        /// </summary>
        public static MiningEquipmentDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[MiningEquipment_GetAll]", new SqlParameter[] { }, "dbo");

            List<MiningEquipmentDO> objs = new List<MiningEquipmentDO>();

            while(sr.Read()){

                MiningEquipmentDO obj = new MiningEquipmentDO();

                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.EquipmentDescription = sr.GetString(sr.GetOrdinal("EquipmentDescription"));
                obj.Purpose = sr.GetString(sr.GetOrdinal("Purpose"));
                obj.Units = sr.GetInt32(sr.GetOrdinal("Units"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Selects MiningEquipment records by PK
        /// </summary>
        public static MiningEquipmentDO[] GetByPK(Int32 PermitKey,
 String EquipmentDescription,
 String Purpose)
        {
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _EquipmentDescription = new SqlParameter("EquipmentDescription", SqlDbType.VarChar);
            SqlParameter _Purpose = new SqlParameter("Purpose", SqlDbType.VarChar);

            _PermitKey.Value = PermitKey;
            _EquipmentDescription.Value = EquipmentDescription;
            _Purpose.Value = Purpose;

            SqlParameter[] _params = new SqlParameter[] {
                _PermitKey,
                _EquipmentDescription,
                _Purpose
            };

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[MiningEquipment_GetByPK]", _params, "dbo");

            List<MiningEquipmentDO> objs = new List<MiningEquipmentDO>();

            while(sr.Read())
            {
                MiningEquipmentDO obj = new MiningEquipmentDO();

                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.EquipmentDescription = sr.GetString(sr.GetOrdinal("EquipmentDescription"));
                obj.Purpose = sr.GetString(sr.GetOrdinal("Purpose"));
                obj.Units = sr.GetInt32(sr.GetOrdinal("Units"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }