/// <summary>
        /// Deletes a LifeOfMinePhase record
        /// </summary>
        public static int Delete(LifeOfMinePhaseDO DO)
        {
            SqlParameter _LifeOfMinePhaseID = new SqlParameter("LifeOfMinePhaseID", SqlDbType.Int);

            _LifeOfMinePhaseID.Value = DO.LifeOfMinePhaseID;

            SqlParameter[] _params = new SqlParameter[] {
                _LifeOfMinePhaseID
            };

            return DataCommon.ExecuteScalar("[dbo].[LifeOfMinePhase_Delete]", _params, "dbo");
        }
        /// <summary>
        /// Gets all LifeOfMinePhase records
        /// </summary>
        public static LifeOfMinePhaseDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[LifeOfMinePhase_GetAll]", new SqlParameter[] { }, "dbo");

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

            while(sr.Read()){

                LifeOfMinePhaseDO obj = new LifeOfMinePhaseDO();

                obj.LifeOfMinePhaseID = sr.GetInt32(sr.GetOrdinal("LifeOfMinePhaseID"));
                obj.LifeOfMinePhaseTypeID = sr.GetString(sr.GetOrdinal("LifeOfMinePhaseTypeID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.StartDate = sr.GetDateTime(sr.GetOrdinal("StartDate"));
                obj.EndDate = sr.GetDateTime(sr.GetOrdinal("EndDate"));
                obj.Acreage = sr.GetInt32(sr.GetOrdinal("Acreage"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Creates a new LifeOfMinePhase record
        /// </summary>
        public static int Create(LifeOfMinePhaseDO DO)
        {
            SqlParameter _LifeOfMinePhaseTypeID = new SqlParameter("LifeOfMinePhaseTypeID", SqlDbType.VarChar);
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _StartDate = new SqlParameter("StartDate", SqlDbType.DateTime);
            SqlParameter _EndDate = new SqlParameter("EndDate", SqlDbType.DateTime);
            SqlParameter _Acreage = new SqlParameter("Acreage", SqlDbType.Int);

            _LifeOfMinePhaseTypeID.Value = DO.LifeOfMinePhaseTypeID;
            _PermitKey.Value = DO.PermitKey;
            _StartDate.Value = DO.StartDate;
            _EndDate.Value = DO.EndDate;
            _Acreage.Value = DO.Acreage;

            SqlParameter[] _params = new SqlParameter[] {
                _LifeOfMinePhaseTypeID,
                _PermitKey,
                _StartDate,
                _EndDate,
                _Acreage
            };

            return DataCommon.ExecuteScalar("[dbo].[LifeOfMinePhase_Insert]", _params, "dbo");
        }
        /// <summary>
        /// Selects LifeOfMinePhase records by PK
        /// </summary>
        public static LifeOfMinePhaseDO[] GetByPK(Int32 LifeOfMinePhaseID)
        {
            SqlParameter _LifeOfMinePhaseID = new SqlParameter("LifeOfMinePhaseID", SqlDbType.Int);

            _LifeOfMinePhaseID.Value = LifeOfMinePhaseID;

            SqlParameter[] _params = new SqlParameter[] {
                _LifeOfMinePhaseID
            };

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

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

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

                obj.LifeOfMinePhaseID = sr.GetInt32(sr.GetOrdinal("LifeOfMinePhaseID"));
                obj.LifeOfMinePhaseTypeID = sr.GetString(sr.GetOrdinal("LifeOfMinePhaseTypeID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.StartDate = sr.GetDateTime(sr.GetOrdinal("StartDate"));
                obj.EndDate = sr.GetDateTime(sr.GetOrdinal("EndDate"));
                obj.Acreage = sr.GetInt32(sr.GetOrdinal("Acreage"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }